Spring boot @SpringBootTest在maven测试运行时不会失败,而它应该失败
我编写了一个测试来测试SpringBoot启动-验证上下文和所有依赖项是否都已就绪:Spring boot @SpringBootTest在maven测试运行时不会失败,而它应该失败,spring-boot,maven,testing,Spring Boot,Maven,Testing,我编写了一个测试来测试SpringBoot启动-验证上下文和所有依赖项是否都已就绪: package com.beezer.service.triggers; import lombok.extern.log4j.Log4j2; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.spring
package com.beezer.service.triggers;
import lombok.extern.log4j.Log4j2;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest (classes = TriggersServiceApplication.class)
@Log4j2
public class SpringContextTest {
@Test
public void contextLoads() {
log.info("SpringContextTest is running");
}
}
为了测试它,我删除了一个必要的上下文——当手动运行它时,测试会像预期的那样失败,但是当我使用Maven的clean install在整个项目上运行clean install时,测试会成功
你能根据你的经验告诉我为什么它没有失败吗
致意
卡梅尔