如何在模块中执行所有junit5测试之前和之后编写一次代码?
问题描述:
我有一个多模块项目spring boot项目,其中每个模块都产生一个jar.每个模块都有一个带有junit 5测试的src/main/test
.在特定模块中的src/main/test
中的所有测试执行之前和之后,是否可以运行代码?例如,如果我有2个模块A和B,我想要.
I have a multi module project spring boot project, where each module produces a jar. Each module has a src/main/test
with junit 5 tests. Is there a way to run code before and after all the tests in src/main/test
in a specific module execute? For example if I have 2 modules A, and B I want.
- 在模块A中的所有测试执行之前运行代码
- 运行所有测试模块A执行的代码
- 在模块B中的所有测试执行之前运行代码
- 在模块B中的所有测试执行后运行代码