-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quarkus code coverage with failsafe #7536
Comments
Do you mean the native image integration tests? I don't think it will ever be possible to get code coverage for native image tests. |
Hello,
No I mean Java integration tests.
Jacoco and Quarkus byte instrumentation looks not compatible + I'm not sure
if failsafe is using the final jar or `target/classes` to run.
Try to run the reproducer it'll clearer ;-)
Le jeu. 12 mars 2020 à 02:13, Stuart Douglas <notifications@github.com> a
écrit :
… Do you mean the native image integration tests? I don't think it will ever
be possible to get code coverage for native image tests.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#7536 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEQ5HCBG7FRXFTZB5DG76TRHAZNHANCNFSM4LANINWQ>
.
|
I think the solution here is to use the agent instead of the instrument task. https://github.com/quarkusio/quarkus/blob/master/build-parent/pom.xml#L677 gives an example for surefire, but I assume it is similar for failsafe. |
@danielpetisme Do you have an error message for "not compatible" ? |
Hello sorry for this delayed answer....
I have to do a reproducer, I'll share it ASAP
Le lun. 22 juin 2020 à 15:51, Heiko W. Rupp <notifications@github.com> a
écrit :
… @danielpetisme <https://github.com/danielpetisme> Do you have an error
message for "not compatible" ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7536 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEQ5HE6JNRRVPRUOCOXZODRX5OU5ANCNFSM4LANINWQ>
.
|
Bump on this issue: I've been trying to get Jacoco to report coverage from failsafe tests, and I cannot get it to do it. Looking into the JarLauncher, you can see the following, which corresponds to my logging output from the failsafe plugin:
As you can see, there is no way to inject an argline argument. |
* Fix quarkusio#7536 by adding the ability to specify an argLine property when running tests. For Example, in a project I'm building: ``` <plugin> <artifactId>maven-failsafe-plugin</artifactId> <version>${surefire-plugin.version}</version> <executions> <execution> <goals> <goal>integration-test</goal> <goal>verify</goal> </goals> <configuration> <systemPropertyVariables> <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager> <maven.home>${maven.home}</maven.home> <quarkus.test.native-image-profile>it</quarkus.test.native-image-profile> <argLine>${argLine}</argLine> </systemPropertyVariables> </configuration> </execution> </executions> </plugin> ```
… documentation, and testing documentation on how to configure. * Fix quarkusio#7536 by adding the ability to specify an argLine property when running tests. For Example, in a project I'm building: ``` <plugin> <artifactId>maven-failsafe-plugin</artifactId> <version>${surefire-plugin.version}</version> <executions> <execution> <goals> <goal>integration-test</goal> <goal>verify</goal> </goals> <configuration> <systemPropertyVariables> <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager> <maven.home>${maven.home}</maven.home> <quarkus.test.native-image-profile>it</quarkus.test.native-image-profile> <argLine>${argLine}</argLine> </systemPropertyVariables> </configuration> </execution> </executions> </plugin> ```
… documentation, and testing documentation on how to configure. * Fix quarkusio#7536 by adding the ability to specify an argLine property when running tests. For Example, in a project I'm building: ``` <plugin> <artifactId>maven-failsafe-plugin</artifactId> <version>${surefire-plugin.version}</version> <executions> <execution> <goals> <goal>integration-test</goal> <goal>verify</goal> </goals> <configuration> <systemPropertyVariables> <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager> <maven.home>${maven.home}</maven.home> <quarkus.test.native-image-profile>it</quarkus.test.native-image-profile> <argLine>${argLine}</argLine> </systemPropertyVariables> </configuration> </execution> </executions> </plugin> ```
… documentation, and testing documentation on how to configure. * Fix quarkusio#7536 by adding the ability to specify an argLine property when running tests. For Example, in a project I'm building: ``` <plugin> <artifactId>maven-failsafe-plugin</artifactId> <version>${surefire-plugin.version}</version> <executions> <execution> <goals> <goal>integration-test</goal> <goal>verify</goal> </goals> <configuration> <systemPropertyVariables> <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager> <maven.home>${maven.home}</maven.home> <quarkus.test.native-image-profile>it</quarkus.test.native-image-profile> <argLine>${argLine}</argLine> </systemPropertyVariables> </configuration> </execution> </executions> </plugin> ``` (cherry picked from commit e6cd85e)
Not sure if it's a bug or a question so feel free to route me.
I followd the guide explaining how to compute a code coverage with Quarkus
https://quarkus.io/guides/tests-with-coverage
Normally, surefire is used for unit test only where failsafe is the proper plugin for integration testing. So I tried to update the test with failsafe and... it does not work
Here you have a reproducer
https://github.com/danielpetisme/test-jacoco-failsafe
SImply run
./mvnw clean verify
and you'll the jacoco file produced for the unit tests but skipped for the integration tests.I discuss this point with @cescoffier.
While surefire only relies on
target/classes
to run the tests the jacoco agent can rely on the coverage instrumentation where failsafe use only the jar which 1- is not using the instrumented class 2- you don't want to pollute your final jar with jacoco instrumentation.Finally I fallback to surefire to run Integration tests but I think it worth a mention in a documentation somewhere.
WDYT?
The text was updated successfully, but these errors were encountered: