我设法确保使用下面的属性在Junit 5中创建一个实例 junit.jupiter.testinstance.lifecycle.default = per_class
接下来的问题是如何在套件级别启用它。我将标签用作套件/组测试用例的一种方法,每次运行一次。
eg:
gradle clean tests -PincludeTags=BASICTEST ( this might be execute few test cases in different class ) but still it will create instances for each single class , i m ok for it but i needed a way to not start /stop the process via static flags.
但是我怎么知道还有多少个测试用例,好像执行的测试用例是最后一个测试用例,我需要调用它来停止所有进程/ AfterAll
我需要执行此操作的原因是,我使用Junit 5作为框架进行集成测试(因此涉及启动/停止外部进程),如果我必须调用AfterEach / AfterAll来停止该进程,这可能会很慢>