在此example的第7步之后,我为SpringBoot命令行应用程序创建了集成测试:
这是我的整合测试
@RunWith(SpringRunner.class)
@SpringBootTest
@TestPropertySource(locations = "classpath:application.integrationtest.properties")
public class IntegrationTest {
@Autowired
private RequestProcessor requestProcessor;
@Test
public void testRequestProcessor() {
requestProcessor.setStandloneFlag(true);
requestProcessor.processRequest();
}
}
当我运行此测试时,它会启动@SpringBootApplication本身,但从不运行集成测试中的@Test方法。 docs说这不应该发生。
为什么@SpringBootTest忽略我的@Test方法并启动应用程序?