TestCase(or test case):
A class that extends the JUnit TestCase class. It contains one or more tests represented by testXXX methods. A test case is used to group together tests that exercise common behaviors. When we mention a test, we mean a testXXX method; and when we mention a test case, we mean a class that extends TestCase --- that is, a set of tests.
TestSuite(or test suite):
A group of tests. A test suite is a convenient way to group together tests that are related. For example, if you don't define a test suite for a TestCase, JUnit automatically provides a test suite that includes all the tests found in the TestCase(more on that later).
TestRunner(or test runner):
A launcher of test suites. JUnit provides several test runners that you can use to execute your tests. There is no TestRunner interface, only a BaseTestRunner that all test runners extend. Thus when we write TestRunner we actually mean any test runner class that extends BaseTestRunner.
本文介绍了 JUnit 中的三个核心概念:TestCase、TestSuite 和 TestRunner。TestCase 是用于组织一系列测试方法的类;TestSuite 则是将多个 TestCase 组合在一起的方式;而 TestRunner 负责执行 TestSuite。理解这些概念对于使用 JUnit 进行单元测试至关重要。
1902

被折叠的 条评论
为什么被折叠?



