且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在SureFire测试阶段之前和之后执行脚本

更新时间:2022-06-25 23:36:51

不是使用surefire插件,而是使用它的同级failsafe插件.他们都执行测试,但是处于不同的生命周期阶段.测试中的surefire插件和集成测试中的failsafe插件.请参见生命周期阶段和默认插件绑定.

Not with the surefire plugin but with its sibling the failsafe plugin. They both execute Tests but in different life-cycle phases. The surefire plugin in test and the failsafe plugin in integration-test. See life-cycle phases and the default plugin bindings.

在集成测试阶段运行故障安全插件的优点在于,它具有前阶段和后阶段.

The advantage of the failsafe plugin running in the integration test phase is that there are pre- and post- phases.

由于您提到了一些sql脚本,因此您似乎想准备一个数据库.那时,您实际上不再进行单元测试,而是编写集成测试.因此,在这里使用故障保护插件最有意义.

Since you mention some sql script it seems you want to prepare a database. At that point you are not really doing unit testing anymore but writing an integration test. So using the failsafe plugin makes the most sense here.