We use maven & junit for unittest & integration test & Jacoco & sonar to get codecoverage reports.
This is setup according to this guide:http://johndobie.blogspot.com/2011/06/seperating-test-code-coverage-with.html
and it works fine!
However we have now started to use a new integrationtest framework: rest-assured http://code.google.com/p/rest-assured/
We write junit tests with rest-assured, which makes rest calls to our endpoints (Spring controllers) which we want to be part of the integration test coverage report produced by Jacoco, but when I look in the sonar reports it don't include any coverage for theese tests. Is there a limitation i Jacoco regarding integration with rest-assured? or du we have to do something special in the setup to get it to work?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
We're not aware of specific issues with this test framework. JaCoCo should work with any application deployed to a Java VM.
- Make sure the JVM that runs your tested code (might be a different one from the one that runs the test code in integration test scenarios) has the JaCoCo agent attached
- Make sure this JVM also properly terminates at the end of the test run (or use JaCoCo's Ant tasks for remote dumps if this is not possible).
- You can open the generated *.exec file with the EclEmma Eclipse plug-in and check whether data for the classes you expect executed are contained.
Best regards,
-marc
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I installed the EclEmma Eclipse plugin and there I am able to see the coverage reports on the tests using the rest-assured framework when run inside the ide.
When I run it via maven (-Pit clean install) I get 2 *.exec files. When I open the jacoco-it.exec in the ide, it only list the test classes & and NOT the related implementation classes, as it does for the unit test.
This migth be the problem, but how do I solve it?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
We use maven & junit for unittest & integration test & Jacoco & sonar to get codecoverage reports.
This is setup according to this guide:http://johndobie.blogspot.com/2011/06/seperating-test-code-coverage-with.html
and it works fine!
However we have now started to use a new integrationtest framework: rest-assured
http://code.google.com/p/rest-assured/
We write junit tests with rest-assured, which makes rest calls to our endpoints (Spring controllers) which we want to be part of the integration test coverage report produced by Jacoco, but when I look in the sonar reports it don't include any coverage for theese tests. Is there a limitation i Jacoco regarding integration with rest-assured? or du we have to do something special in the setup to get it to work?
We're not aware of specific issues with this test framework. JaCoCo should work with any application deployed to a Java VM.
- Make sure the JVM that runs your tested code (might be a different one from the one that runs the test code in integration test scenarios) has the JaCoCo agent attached
- Make sure this JVM also properly terminates at the end of the test run (or use JaCoCo's Ant tasks for remote dumps if this is not possible).
- You can open the generated *.exec file with the EclEmma Eclipse plug-in and check whether data for the classes you expect executed are contained.
Best regards,
-marc
Thanks for the feedback
I installed the EclEmma Eclipse plugin and there I am able to see the coverage reports on the tests using the rest-assured framework when run inside the ide.
When I run it via maven (-Pit clean install) I get 2 *.exec files. When I open the jacoco-it.exec in the ide, it only list the test classes & and NOT the related implementation classes, as it does for the unit test.
This migth be the problem, but how do I solve it?
There are two possible reasons:
1) You configured some filter that filters out the implementation classes
2) The implementation classes are executed in a different JVM