-
Notifications
You must be signed in to change notification settings - Fork 23
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
Make jacoco work with integration tests #459
Comments
Good first issue if someone interested by Maven config and jacoco coverage |
Dis some quick test without maven
Now we need to integration with failsafe, maven exec and jacoco plugin. And merge all together with previous unit tests |
Hi, as I was working on this. I wanted to know if I will have to also change pom.xml and pom-it.xml to integrate jacoco. |
Most likely yes. |
@jonesbusy I'm currently working in this issue, What I've done is: but what happened is that some tests failed in commandLineITCase, so should I update those tests or update the buildRequest function itself? |
Test are working. Double check your environment and check logs. You might have invalid JAVA_HOME and or MAVEN_HOME. If you search carefully it will most likely indicate what is the issue |
I've removed the good-first issue. Even if its mostly configuration, it need good understanding on Maven and Jacoco and understanding how plugin modernizer jar is invoked during tests. I don't exclude the fact we might need an other module only to aggregate tests results. Feel free to continue on it if you are interested by the topic. |
thanks for reply, I'm going to continue a little bit more. What I'm currently doing is configuring pom.xml and pom-it.xml files such that I get :
|
@jonesbusy I've typed the bash script that gather it, that is what it does, is it the solution we want? When clicking on
|
This is incorrect to have coverage on test class. We want coverage on application code |
What are those screenshot? Final result? If yes this looks very incorrect. I expect the total coverage to be much higher than the current one of 60% only for unit test |
No, it is not the final result. |
I don't get it. You are not supposed to see any test class on jacoco report. We are interested by the total coverage for both unit and integration tests. |
This show the 'build-metadata- command. This is typically one test on CommandLineIT (which the only class for now with failsafe test) So the total suite would be much higher than that. Specially if after we combinate with surefire execution |
got it, sorry for my misunderstanding |
Ok, I'll work based on that. Should I be working with same plugin mentioned, or it is general to any plugin e.g. git-plugin? |
Check CommandLineIT. They are using plugin from resources. Not real plugin |
@jonesbusy is the current coverage correct this way? I made to run only on application code |
I've typed a small bashscript specifing as a prototype, if the above correct, I'll configure in pom.xml and pom-it.xml files #!/bin/bash
java "-javaagent:org.jacoco.agent-0.8.12-runtime.jar=port=6300,address=0.0.0.0,destfile=target/jacoco.exec,includes=io.jenkins.tools.pluginmodernizer.*,append=true,output=tcpserver" -jar plugin-modernizer-cli/target/jenkins-plugin-modernizer-999999-SNAPSHOT.jar build-metadata --plugins git --debug
java '-javaagent:org.jacoco.agent-0.8.12-runtime.jar=port=6300,address=0.0.0.0,destfile=target/jacoco-it.exec,includes=io.jenkins.tools.pluginmodernizer.*,append=true,output=tcpserver' -jar plugin-modernizer-cli/target/jenkins-plugin-modernizer-999999-SNAPSHOT.jar build-metadata --plugins git --debug to dump datajava -jar org.jacoco.cli-0.8.12-nodeps.jar dump \
--address localhost \
--port 6300 \
--destfile target/jacoco.exec \
--reset \
;
java -jar org.jacoco.cli-0.8.12-nodeps.jar dump \
--address localhost \
--port 6300 \
--destfile target/jacoco-it.exec \
--reset
to generate report#!/bin/bash
java -jar org.jacoco.cli-0.8.12-nodeps.jar report target/jacoco.exec target/jacoco-it.exec \
--classfiles plugin-modernizer-core/target/classes \
--sourcefiles plugin-modernizer-core/src/main/java \
--classfiles plugin-modernizer-cli/target/classes \
--sourcefiles plugin-modernizer-cli/src/main/java \
--html coverage_report |
No so different from #459 (comment)? Using some combinaison of The whole point here is to make the maven configuration to pass the existing |
It includes all coverage for application code, I wanted to know If paths I've specified in the script are correct to move to the next step.
Thanks for that, I've been trying to figure out how to make dump work after agent preparation
I'll do that, thanks for your quick replies |
What feature do you want to see added?
Right now coverage is only computed on unit tests
When we run integration tests with failsafe and 'java -jar..' we should add the argLine to the execution and make sure the execution is merged with previous jacoco execution.
Possible code change on
CommandLineIT
if we need to pass the jacoco argLine ?The text was updated successfully, but these errors were encountered: