[JUnit]What are TestCase, TestSuite, BaseTestRunner

JUnit 测试基础概念
本文介绍了 JUnit 中的三个核心概念:TestCase、TestSuite 和 TestRunner。TestCase 是用于组织一系列测试方法的类;TestSuite 则是将多个 TestCase 组合在一起的方式;而 TestRunner 负责执行 TestSuite。理解这些概念对于使用 JUnit 进行单元测试至关重要。

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.

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值