I have a simple unit test that asserts a 200 status code after testing an endpoint. I've confirmed the status code returns 200. If I only run a single test, doesn't matter which one, IntelliJ returns Failed to start: 0 passed, 1 not started. But if I run both tests, even when they're identical to each other (except for the method name), IntelliJ returns Failed to start: 1 passed, 1 not started. Any clue why IntelliJ refuses to acknowledge the true assertion of one of these two identical tests?
Tests
@Test
public void test1() {
final ClientConfig config = new ClientConfig();
final Client client = ClientBuilder.newClient(config);
System.out.println("Test1:point1 hit");
Response response = client.target(baseUrl + "/stats")
.request()
.post(Entity.entity("[]", MediaType.APPLICATION_JSON));
System.out.println("Test1:point2 hit");
assertEquals(200, response.getStatus());
System.out.println("Test1:point3 hit - Status returned: " + response.getStatus());
response.close();
System.out.println("Test1:point4 hit");
}
@Test
public void test2() {
final ClientConfig config = new ClientConfig();
final Client client = ClientBuilder.newClient(config);
System.out.println("Test2:point1 hit");
Response response = client.target(baseUrl + "/stats")
.request()
.post(Entity.entity("[]", MediaType.APPLICATION_JSON));
System.out.println("Test2:point2 hit");
assertEquals(200, response.getStatus());
System.out.println("Test2:point3 hit - Status returned: " + response.getStatus());
response.close();
System.out.println("Test2:point4 hit");
}
Console output
Started in 3693ms, on port(s) 25001 ##teamcity[testStarted name='PerfStatsIT.test1' locationHint='java:test://com.group.performance.osg.web.PerfStatsIT.test1']
Test1:point1 hit
2015-12-18T17:58:36.808Z INFO com.group.performance.osg.web.PerfStatsImpl postStats qtp322561962-16 [] [92bbf2d9-a324-49b1-b3cb-7b3ce0b0fccc] [669abd4d-bfe9-48ba-b131-dbffda2cbf66] [] [] Successful data input. 1ms null
2015-12-18T17:58:36.821Z INFO com.group.performance.osg.web.PerfStatsImpl postStats qtp322561962-16 [] [92bbf2d9-a324-49b1-b3cb-7b3ce0b0fccc] [669abd4d-bfe9-48ba-b131-dbffda2cbf66] [] [] INCOMING http request POST 200 stats 364.07
Test1:point2 hit
Test1:point3 hit - Status returned: 200
Test1:point4 hit
Test2:point1 hit
2015-12-18T17:58:36.883Z INFO com.group.performance.osg.web.PerfStatsImpl postStats qtp322561962-15 [] [e2511b78-4995-453e-8804-8d83b32152fb] [dafaf829-97e5-4828-a863-80cd3f4c6e39] [] [] Successful data input. 0ms null
2015-12-18T17:58:36.887Z INFO com.group.performance.osg.web.PerfStatsImpl postStats qtp322561962-15 [] [e2511b78-4995-453e-8804-8d83b32152fb] [dafaf829-97e5-4828-a863-80cd3f4c6e39] [] [] INCOMING http request POST 200 stats 9.20
Test2:point2 hit
Test2:point3 hit - Status returned: 200
Test2:point4 hit
Process finished with exit code 0
IntelliJ test response Failed to start: 1 passed, 1 not started
Aucun commentaire:
Enregistrer un commentaire