我有一些Groovy测试用例(即扩展了
这有意义吗?有哪些替代方案?如何实现自定义的 JUnit Runner?
GroovyTestCase
版本1.8.2的类)。例如:
class TestCaseA extends GroovyTestCase {void testA1() {...} void testA2() {...}} class TestCaseB extends GroovyTestCase {void testB1() {...} void testB2() {...}}我想对测试(测试方法)进行分组。例如:
group X: TestCaseA.testA1, TestCaseB.testB1, TestCaseB.testB2, group Y: TestCaseB.testB2 group Z: TestCaseA.testA1, TestCaseA.testA2为了实现这样的分组,我想添加注释。(我可以更改测试源代码)。例如:
class TestCaseA extends GroovyTestCase {现在我想编写一个自定义的
@TestGroup (TestGroup.X, TestGroup.Z) void testA1() {...}
@TestGroup (TestGroup.Z) void testA2() {...} }
JUnit Runner
,它接收“测试组”(例如作为命令行参数或环境变量),并仅运行带有这些组注释的测试方法。这有意义吗?有哪些替代方案?如何实现自定义的 JUnit Runner?