|
Hi,
I'm trying to get code coverage using Jacoco. following this example:
Till now I haven't been able to make it works. My project is multi-module Maven. every module has src/main and src/test (with both UT and IT)
Just to try I modified just one module (api) pom the destination file, like described in the example:
|
|
Hi,
I'm trying to get code coverage using Jacoco. following this example:
Till now I haven't been able to make it works. My project is multi-module Maven. every module has src/main and src/test (with both UT and IT)
Just to try I modified just one module (api) pom the destination file, like described in the example:
|
|
I changed in the module's pom the jacoco goal, like this:
<executions> <execution> <goals> <goal>prepare-agent</goal>
</goals> </execution> </executions> Now it generates the jacoco.exec When run sonar from parent dir, I can see:
[INFO] [14:08:56.663] Sensor JaCoCoSensor... [INFO] [14:08:56.663] Analysing /home/solaria/workspace/platform/api/target/jacoco.exec [INFO] [14:08:57.815] Sensor JaCoCoSensor done: 1152 ms
[INFO] [14:08:57.815] Sensor SurefireSensor.. But when I browse in sonar web, I get 0% integration test coverage and 0 test unit. suggestion?
thanks, Ale 2012/7/23 Alessia Prete <[hidden email]>
|
|
In reply to this post by Alessia Prete
Hi Ale,
Could you highlight what you've changed because I cannot spot those changes? If you run the sample project out of the box, does everything works fine? Thank you
Regards,
David RACODON | SonarSource
Senior Consultant On 23 July 2012 13:19, Alessia Prete <[hidden email]> wrote: Hi, |
|
Hi David,
yes basically in module's pom instead of this :
<sonar.jacoco.itReportPath>${project.basedir}/../target/jacoco-it.exec</sonar.jacoco.itReportPath>
whit: <sonar.jacoco.reportPath>${project.basedir}/target/jacoco-it.exec</sonar.jacoco.reportPath>
I haven't try to run the sample project, I'll do it right now.
Thanks!
2012/7/23 David Racodon <[hidden email]> Hi Ale, |
|
Yes the sample project works perfectly.
2012/7/23 Alessia Prete <[hidden email]> Hi David, |
|
The difference with the sample project is that I don't have this:
parent ---> app -->pom --> app-it -->pom pom
but something like this: platform -->api -->src -->test(unit and integration) -->pom
pom So basically I'm copying what is in app-it 's pom in api's pom. Don't know if it's ok,.. Thanks
Ale 2012/7/23 Alessia Prete <[hidden email]> Yes the sample project works perfectly. |
|
Hi,
From https://github.com/SonarSource/sonar-examples/blob/master/projects/code-coverage/ut/ut-maven-multimodule-jacoco-runTests/README.md : "This example demonstrates how to collect code coverage by integration tests, which located in a separate module." I suppose that this is not your case.
On Mon, Jul 23, 2012 at 8:41 PM, Alessia Prete <[hidden email]> wrote: The difference with the sample project is that I don't have this: Best regards, Evgeny Mandrikov aka Godin <http://godin.net.ru> http://twitter.com/_godin_ |
|
In reply to this post by Alessia Prete
Hi Ale, To help me understand your use case, when you say: "every module has src/main and src/test (with both UT and IT)", you mean:
or
Thank you Regards, David RACODON | SonarSource
Senior Consultant On 23 July 2012 16:41, Alessia Prete <[hidden email]> wrote: The difference with the sample project is that I don't have this: |
|
the first:
Anyway Evgeny is right..it's not my case.Sorry.
Looking better, seems there isn't an example for my case, right? Thanks 2012/7/23 David Racodon <[hidden email]>
|
|
OK, so it cannot be achieved with your current project structure.
You need to externalize your ITs into specific modules, what seems to be a more logical structure from my point of view. Then for :
David RACODON | SonarSource
Senior Consultant On 23 July 2012 16:56, Alessia Prete <[hidden email]> wrote: the first: |
|
yes..I guess so.
I'll try. Thanks!
2012/7/23 David Racodon <[hidden email]> OK, so it cannot be achieved with your current project structure. |
| Powered by Nabble | Edit this page |
