从命令行中的可执行jar运行测试SpringBootTest

您所在的位置:网站首页 junit命令行执行 从命令行中的可执行jar运行测试SpringBootTest

从命令行中的可执行jar运行测试SpringBootTest

2024-05-07 09:18| 来源: 网络整理| 查看: 265

我需要运行一个包含所有测试的jar。我可以在jar中构建所有的测试类,但是我不知道如何引导一个主类来在springboot中运行junit测试。我是否可以运行一个命令行来运行jar,并启动所有测试并忽略mainclass。

测试类

代码语言:javascript复制@ExtendWith(SpringExtension.class) @AutoConfigureMockMvc @SpringBootTest @TestPropertySource(locations = "classpath:${test.config.env:application-local.properties}") @TestMethodOrder(OrderAnnotation.class) public class RunIntegrationTest { // All tests }

Pom.xml

代码语言:javascript复制 4.0.0 org.springframework.boot spring-boot-starter-parent 2.3.2.RELEASE ... ... ... ... 1.8 1.8 1.8 org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-test org.junit.vintage junit-vintage-engine target/classes org.springframework.boot spring-boot-maven-plugin

为了在命令行上从构建的jar运行所有测试,我需要执行什么?

代码语言:javascript复制 java -jar build-with-class-test-and-junit-in-it.jar # are there more parameters?


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3