RE: failsafe report displays no results
Still stumped on this. Any failsafe gurus out there? :) -Original Message- Sent: Monday, July 30, 2012 1:27 PM Any words of wisdom from the community? :) -Original Message- Sent: Thursday, July 26, 2012 9:00 PM I just started using maven-failsafe-plugin and maven-surefire-report-plugin so my apologies in advance... For starters, I've configured maven-failsafe-plugin and maven-surefire-report-plugin as such (respectively): build plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-failsafe-plugin/artifactId version2.12/version executions execution goals goalintegration-test/goal goalverify/goal /goals /execution /executions /plugin ... reporting plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-surefire-report-plugin/artifactId version2.12/version reportSets reportSet idintegration-tests/id reports reportfailsafe-report-only/report /reports /reportSet /reportSets /plugin /plugins /reporting ... I have two test cases defined in /src/test/java/.../GameResourceIT.java like so: public class GameResourceIT extends TestCase { public static final String LOCAL_SERVER_URL_ROOT = http://localhost:8080/gameservice;; public static final String GAMES_RESOURCE_URI = /games; public void testGetGamesForDate_20120603_status200Expected() throws Exception { String date = 06-03-2012; Client client = Client.create(); WebResource webResource = client.resource(LOCAL_SERVER_URL_ROOT + GAMES_RESOURCE_URI + / + date); ClientResponse response = webResource.accept(application/json).get(ClientResponse.class); assertEquals(Failed : status = + response.getStatus() + , body = + response.getEntity(String.class), response.getStatus(), Status.OK.getStatusCode()); } public void testGetGamesForDate_20120608_status404Expected() throws Exception { String date = 06-08-2012; Client client = Client.create(); WebResource webResource = client.resource(LOCAL_SERVER_URL_ROOT + GAMES_RESOURCE_URI + / + date); ClientResponse response = webResource.accept(application/json).get(ClientResponse.class); assertEquals(Failed : status = + response.getStatus() + , body = + response.getEntity(String.class), response.getStatus(), Status.NOT_FOUND.getStatusCode()); } } ... When I run mvn verify, I get the following: [INFO] --- maven-failsafe-plugin:2.12:integration-test (default) @ gameservice --- [INFO] Failsafe report directory: ...\gameservice\target\failsafe-reports --- T E S T S --- Running GameResourceIT Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.938 sec FAILURE! Results : Failed tests: testGetGamesForDate_20120608_status404Expected(...GameResourceIT): Failed : status = 200, body = null expected:200 but was:404 Tests run: 2, Failures: 1, Errors: 0, Skipped: 0 [INFO] --- maven-failsafe-plugin:2.12:verify (default) @ gameservice --- [INFO] Failsafe report directory:...\gameservice\target\failsafe-reports [INFO] [INFO] BUILD FAILURE [INFO] [INFO] Total time: 13.753s [INFO] Finished at: Thu Jul 26 20:39:44 EDT 2012 2012-07-26 20:39:44.644::INFO: Shutdown hook complete [INFO] Final Memory: 21M/52M [INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.12:verify (default) on project gameservice: There are test failures. Fine. As expected, 1 of the 2 tests failed. But as NOT expected, the verify goal failed as well (I thought integration test failures would not halt execution, but simply be recorded). Now, if I look at /target/failsafe-reports/GameResourceIT.txt and /target/failsafe-reports/TEST-GameResourceIT.xml, I see as expected that 1 of 2 tests failed. When I look at /target/failsafe-reports/failsafe-summary.xml, I see: failsafe-summary result=255 / Finally, if I run mvn:site surefire-report:report, I get an html page in /target/site/surefire-report.html that shows all 0s for the report summary (tests, errors, failures, skipped, etc.) Why would this be the case? I expected maven-surefire-report-plugin to transform the file(s)
RE: failsafe report displays no results
Martin, Thanks for your reply on this. Since my original post, I’ve actually corrected the line you point out to, as follows: assertEquals(Failed : status= + response.getStatus() + , body= + response.getEntity(String.class), response.getClientResponseStatus(), ClientResponse.Status.OK); However, my question is about failsafe and its behavior, not about the JUnit test itself. Namely, why is my report showing all 0s? As expected, 1 of the 2 tests failed. But as NOT expected, the verify goal failed as well (I thought integration test failures would not halt execution, but simply be recorded). Now, if I look at /target/failsafe-reports/GameResourceIT.txt and /target/failsafe-reports/TEST-GameResourceIT.xml, I see as expected that 1 of 2 tests failed. When I look at /target/failsafe-reports/failsafe-summary.xml, I see: failsafe-summary result=255 / Finally, if I run mvn:site surefire-report:report, I get an html page in /target/site/surefire-report.html that shows all 0s for the report summary (tests, errors, failures, skipped, etc.) Why would this be the case? I expected maven-surefire-report-plugin to transform the file(s) located in /target/failsafe-reports into an equivalent HTML report (indicating that 1 of 2 tests failed) located in /target/site. Is my configuration off? Any thoughts? -JR From: Martin Gainty [mailto:mgai...@hotmail.com] Sent: Thursday, August 09, 2012 10:12 AM To: Rodriguez, John Subject: RE: failsafe report displays no results 4.7 version of junit.framework.Assert /** Asserts that two objects are equal. If they are not an AssertionFailedError is thrown with the given message. */ static public void assertEquals(String message, Object expected, Object actual) { if (expected == null actual == null) return; if (expected != null expected.equals(actual)) return; failNotEquals(message, expected, actual); } your code assertEquals(Failed : status = + response.getStatus() + , body = + response.getEntity(String.class), //This should be a String response.getStatus(), //This *should* be an object Status.NOT_FOUND.getStatusCode()); //This *should* be an object Jersey implementation of getStatus() returns an int NOT an object http://jersey.java.net/nonav/apidocs/1.4/jersey/com/sun/jersey/api/client/ClientResponse.html http://docs.oracle.com/javaee/6/api/javax/ws/rs/core/Response.Status.html where getStatus() returns an int not an Object to make ints into objects why not wrap in a simple Integer constructors new Integer(response.getStatus()), new Integer(Status.NOT_FOUND.getStatusCode()); Martin Gainty __ Jewelry check by Jeter..he is definitely up to something..Curt Gowdy From: john.rodrig...@mlb.commailto:john.rodrig...@mlb.com To: users@maven.apache.orgmailto:users@maven.apache.org Date: Thu, 9 Aug 2012 09:44:56 -0400 Subject: RE: failsafe report displays no results Still stumped on this. Any failsafe gurus out there? :) -Original Message- Sent: Monday, July 30, 2012 1:27 PM Any words of wisdom from the community? :) -Original Message- Sent: Thursday, July 26, 2012 9:00 PM I just started using maven-failsafe-plugin and maven-surefire-report-plugin so my apologies in advance... For starters, I've configured maven-failsafe-plugin and maven-surefire-report-plugin as such (respectively): build plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-failsafe-plugin/artifactId version2.12/version executions execution goals goalintegration-test/goal goalverify/goal /goals /execution /executions /plugin ... reporting plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-surefire-report-plugin/artifactId version2.12/version reportSets reportSet idintegration-tests/id reports reportfailsafe-report-only/report /reports /reportSet /reportSets /plugin /plugins /reporting ... I have two test cases defined in /src/test/java/.../GameResourceIT.java like so: public class GameResourceIT extends TestCase { public static final String LOCAL_SERVER_URL_ROOT = http://localhost:8080/gameservice;; public static final String GAMES_RESOURCE_URI = /games; public void testGetGamesForDate_20120603_status200Expected() throws Exception { String date = 06-03-2012; Client client = Client.create(); WebResource webResource = client.resource(LOCAL_SERVER_URL_ROOT + GAMES_RESOURCE_URI + / + date); ClientResponse response = webResource.accept(application/json).get(ClientResponse.class); assertEquals(Failed : status = + response.getStatus() + , body = + response.getEntity(String.class), response.getStatus(), Status.OK.getStatusCode()); } public void testGetGamesForDate_20120608_status404Expected() throws Exception { String date = 06-08-2012; Client client
Re: failsafe report displays no results
On 27 July 2012 01:59, John Rodriguez john.rodrig...@gmail.com wrote: I just started using maven-failsafe-plugin and maven-surefire-report-plugin so my apologies in advance... For starters, I've configured maven-failsafe-plugin and maven-surefire-report-plugin as such (respectively): build plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-failsafe-plugin/artifactId version2.12/version executions execution goals goalintegration-test/goal goalverify/goal /goals /execution /executions /plugin ... reporting plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-surefire-report-plugin/artifactId version2.12/version reportSets reportSet idintegration-tests/id reports reportfailsafe-report-only/report /reports /reportSet /reportSets /plugin /plugins /reporting ... I have two test cases defined in /src/test/java/.../GameResourceIT.java like so: public class GameResourceIT extends TestCase { public static final String LOCAL_SERVER_URL_ROOT = http://localhost:8080/gameservice;; public static final String GAMES_RESOURCE_URI = /games; public void testGetGamesForDate_20120603_status200Expected() throws Exception { String date = 06-03-2012; Client client = Client.create(); WebResource webResource = client.resource(LOCAL_SERVER_URL_ROOT + GAMES_RESOURCE_URI + / + date); ClientResponse response = webResource.accept(application/json).get(ClientResponse.class); assertEquals(Failed : status = + response.getStatus() + , body = + response.getEntity(String.class), response.getStatus(), Status.OK.getStatusCode()); } public void testGetGamesForDate_20120608_status404Expected() throws Exception { String date = 06-08-2012; Client client = Client.create(); WebResource webResource = client.resource(LOCAL_SERVER_URL_ROOT + GAMES_RESOURCE_URI + / + date); ClientResponse response = webResource.accept(application/json).get(ClientResponse.class); assertEquals(Failed : status = + response.getStatus() + , body = + response.getEntity(String.class), response.getStatus(), Status.NOT_FOUND.getStatusCode()); } } ... When I run mvn verify, I get the following: [INFO] --- maven-failsafe-plugin:2.12:integration-test (default) @ gameservice --- [INFO] Failsafe report directory: ...\gameservice\target\failsafe-reports --- T E S T S --- Running GameResourceIT Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.938 sec FAILURE! Results : Failed tests: testGetGamesForDate_20120608_status404Expected(...GameResourceIT): Failed : status = 200, body = null expected:200 but was:404 Tests run: 2, Failures: 1, Errors: 0, Skipped: 0 [INFO] --- maven-failsafe-plugin:2.12:verify (default) @ gameservice --- [INFO] Failsafe report directory:...\gameservice\target\failsafe-reports [INFO] [INFO] BUILD FAILURE [INFO] [INFO] Total time: 13.753s [INFO] Finished at: Thu Jul 26 20:39:44 EDT 2012 2012-07-26 20:39:44.644::INFO: Shutdown hook complete [INFO] Final Memory: 21M/52M [INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.12:verify (default) on project gameservice: There are test failures. Fine. As expected, 1 of the 2 tests failed. But as NOT expected, the verify goal failed as well (I thought integration test failures would not halt execution, but simply be recorded). the failsafe:integration-test goal will never fail the build failing the build is the job of the failsafe:verify goal. thus when bound to the lifecycle at the appropriate phases the plugins bound to the post-integration-test phase will execute. Could you please suggest how we could clarify the documentation for the plugin to make this clearer since it obviously was misinterpreted by you. Now, if I look at /target/failsafe-reports/GameResourceIT.txt and /target/failsafe-reports/TEST-GameResourceIT.xml, I see as expected that 1 of 2 tests failed. When I look at
RE: failsafe report displays no results
Any words of wisdom from the community? :) -Original Message- From: John Rodriguez [mailto:john.rodrig...@gmail.com] Sent: Thursday, July 26, 2012 9:00 PM To: users@maven.apache.org Subject: failsafe report displays no results I just started using maven-failsafe-plugin and maven-surefire-report-plugin so my apologies in advance... For starters, I've configured maven-failsafe-plugin and maven-surefire-report-plugin as such (respectively): build plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-failsafe-plugin/artifactId version2.12/version executions execution goals goalintegration-test/goal goalverify/goal /goals /execution /executions /plugin ... reporting plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-surefire-report-plugin/artifactId version2.12/version reportSets reportSet idintegration-tests/id reports reportfailsafe-report-only/report /reports /reportSet /reportSets /plugin /plugins /reporting ... I have two test cases defined in /src/test/java/.../GameResourceIT.java like so: public class GameResourceIT extends TestCase { public static final String LOCAL_SERVER_URL_ROOT = http://localhost:8080/gameservice;; public static final String GAMES_RESOURCE_URI = /games; public void testGetGamesForDate_20120603_status200Expected() throws Exception { String date = 06-03-2012; Client client = Client.create(); WebResource webResource = client.resource(LOCAL_SERVER_URL_ROOT + GAMES_RESOURCE_URI + / + date); ClientResponse response = webResource.accept(application/json).get(ClientResponse.class); assertEquals(Failed : status = + response.getStatus() + , body = + response.getEntity(String.class), response.getStatus(), Status.OK.getStatusCode()); } public void testGetGamesForDate_20120608_status404Expected() throws Exception { String date = 06-08-2012; Client client = Client.create(); WebResource webResource = client.resource(LOCAL_SERVER_URL_ROOT + GAMES_RESOURCE_URI + / + date); ClientResponse response = webResource.accept(application/json).get(ClientResponse.class); assertEquals(Failed : status = + response.getStatus() + , body = + response.getEntity(String.class), response.getStatus(), Status.NOT_FOUND.getStatusCode()); } } ... When I run mvn verify, I get the following: [INFO] --- maven-failsafe-plugin:2.12:integration-test (default) @ gameservice --- [INFO] Failsafe report directory: ...\gameservice\target\failsafe-reports --- T E S T S --- Running GameResourceIT Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.938 sec FAILURE! Results : Failed tests: testGetGamesForDate_20120608_status404Expected(...GameResourceIT): Failed : status = 200, body = null expected:200 but was:404 Tests run: 2, Failures: 1, Errors: 0, Skipped: 0 [INFO] --- maven-failsafe-plugin:2.12:verify (default) @ gameservice --- [INFO] Failsafe report directory:...\gameservice\target\failsafe-reports [INFO] [INFO] BUILD FAILURE [INFO] [INFO] Total time: 13.753s [INFO] Finished at: Thu Jul 26 20:39:44 EDT 2012 2012-07-26 20:39:44.644::INFO: Shutdown hook complete [INFO] Final Memory: 21M/52M [INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.12:verify (default) on project gameservice: There are test failures. Fine. As expected, 1 of the 2 tests failed. But as NOT expected, the verify goal failed as well (I thought integration test failures would not halt execution, but simply be recorded). Now, if I look at /target/failsafe-reports/GameResourceIT.txt and /target/failsafe-reports/TEST-GameResourceIT.xml, I see as expected that 1 of 2 tests failed. When I look at /target/failsafe-reports/failsafe-summary.xml, I see: failsafe-summary result=255 / Finally, if I run mvn:site surefire-report:report, I get an html page in /target/site/surefire-report.html that shows all 0s for the report summary (tests, errors, failures, skipped, etc.) Why would this be the case? I expected maven-surefire-report-plugin to transform the