我正在使用concordion进行端到端测试我的spring启动REST API。 我发现我可以让concordion测试用@IntegrationTest注解启动我的Spring应用程序。这工作如果我手动运行1 concorion测试,或所有concordion测试..但如果我包括常规单元测试(没有@IntegrationTest),那么协调测试将失败org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://localhost:8080/myrestservice":Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect.
@IntegrationTest在spring启动时使concordion测试在与“正常”单元测试结合运行时失败
如果我注释我的常规单元测试使用@IntegrationTest注解,它一切正常。但我想知道有没有人知道更好的方法?
编辑: 我的两个concordion测试和我的单元测试有以下其他注释:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(
classes = Application.class,
loader = SpringApplicationContextLoader.class)
@WebAppConfiguration