Code Coverage on Test Automation that exists in separate code base

36 views
Skip to first unread message

Mohammad Esmaeilirad (m2rads)

unread,
Jan 12, 2024, 9:24:29 PMJan 12
to JaCoCo and EclEmma Users
Hello fellow devs, 

Is it possible to use JaCoCo to determine the amount of test coverage that a integration test suite provides? 

Imagine this scenario: You have a code base for you api. You have written a sufficient amount of unit test for your Spring boot application. 

In order to test the application to analyze the functionality when all the components come together and when the api is up an running, you write integration test to validate the status codes and response headers, api exceptions, response body and etc. 

Since this automation test suit exists in a seperate code base has no direct knowledge or access to the api code base, it would be hard to determine the code coverage based on statistics. 

My question is, is it possible to use JaCoCo to find out the amount of test coverage that the test automation suit provides given the scenario? 

Any helps would be appreciated. Thanks.

Marc Hoffmann

unread,
Jan 15, 2024, 2:50:39 AMJan 15
to JaCoCo and EclEmma Users
Hi.

JaCoCo can collect code coverage for any Java application. There is always two steps involved:

1) Configure the JaCoCo agent for the JVM that executes the code
2) Create a report based in the exec file written by the agent in the first step and all Java class files (optionally source files). For this steps we have a commnd line tool, an Ant task and a Maven goal (plus many third party integrations)

Just note that the “out of the box” integrations like with Maven primarily support unit tests. Therefore in case of complex integration tests you have to create the setup above yourself.

Regards,
-marc


 

--
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 jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/d2a80978-c5c5-4007-a749-c2dc9a010f95n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages