I have tried the following, please correct me if I am wrong:

1. export 
JAVA_OPTS=-javaagent:<path_to>/jacocoagent.jar=destfile=<path_to>/jacoco-it.exec
2. Start JBoss server.
3. Run the Integration test using maven.
4. Stop the JBoss server.
5. Run the command:
java -jar <path_to>/jacococli.jar report <path_to>/jacoco-it.exec 
--classfiles=<path_to_production_code_jar_file> 
--csv=coverage-reports/report_in_csv
Above step will update the jacoco-it.exec with all the instrumented classes.
6. Coverage report will be present in report_in_csv given in Step 5.  

Thanks
Abhay


On Wednesday, December 2, 2020 at 11:36:04 AM UTC+5:30 Abhay Hegde wrote:

> I have an *MyApp.ear* containing production code and a *test.war* containing 
> end-to-end test code deployed in the *same JBoss server* on the *same 
> host machine*.
>
> MyApp.ear accepts MQ messages and returns the output.
>
> test.war sends the MQ messages and asserts the output.
>
> Both production and test application is built using maven. I am using 
> jacoco 0.8.5 for code coverage. 
>
> An end-to-end test is invoked as below in the command line: 
>
> $mvn clean verify -DJBOSS_HOME=<path_to_jboss_dir> 
> -f=integration-test/pom.xml jacoco:prepare-agent jacoco:report sonar:sonar 
> -Dsonar.skip=false -Dit.test=com.mypackage.name.EndToEndTest 
>
>
> Test execution flow is as below:
>
>    1. A test class sends the MQ messages to the MQs that are configured 
>    in the host.
>    2. Production class (MyApp.ear)   listens to the queue and accepts the 
>    MQ messages for processing.
>    3. Processed output is asserted by the test class using Junit.
>
>  Questions:
>
>    - Is it possible to obtain the code coverage of my production classes 
>    when i run the End to end test ?
>    - If yes, would appreciate if you could point out few key things to be 
>    done.
>
> Thanks
> Abhay
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/a6311112-d720-41c7-b159-f132e3312e5cn%40googlegroups.com.

Reply via email to