Play test coverage & sonar

1,324 views
Skip to first unread message

Aurélien Allienne

unread,
Feb 11, 2013, 4:42:25 AM2/11/13
to play-fr...@googlegroups.com
Hi,

Is it possible to see code coverage with sonar?

Regards

Marcos Pereira

unread,
Feb 12, 2013, 5:42:33 PM2/12/13
to play-framework
Yes.

Using Jacoco4sbt[1] you can measure code coverage in a format compatible with Emma and then integrate it with Sonar.

[1] https://bitbucket.org/jmhofer/jacoco4sbt/wiki/Home

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Niklas Nylund

unread,
Feb 13, 2013, 7:20:24 AM2/13/13
to play-fr...@googlegroups.com
Wow, I would be very interesting in getting test coverage reports also in Play 2.x. Is this plugin supposed to work with 2.0.1 (yes, we are stuck on an old version for now) ?

I get this error when I tried following the instructions,

[info] Loading project definition from /Users/niklas/dev/cms-api/cmsapi/project
[warn] module not found: de.johoop#jacoco4sbt;1.2.4
[warn] ==== typesafe-ivy-releases: tried
[warn] ==== local: tried
[warn]   /Users/niklas/dev/cms-api/cmsapi/../dev/play-2.0.1/framework/../repository/local/de.johoop/jacoco4sbt/scala_2.9.1/sbt_0.11.2/1.2.4/ivys/ivy.xml
[warn] ==== Typesafe repository: tried
[warn] ==== public: tried
[warn] ==== Scala-Tools Maven2 Repository: tried
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] ::          UNRESOLVED DEPENDENCIES         ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: de.johoop#jacoco4sbt;1.2.4: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] 
[warn] Note: Some unresolved dependencies have extra attributes.  Check that these dependencies exist with the requested attributes.
[warn] de.johoop:jacoco4sbt:1.2.4 (sbtVersion=0.11.2, scalaVersion=2.9.1)
[warn] 

Marcos Pereira

unread,
Feb 13, 2013, 10:25:00 AM2/13/13
to play-framework
Hi, try to use an older version of jacoco4sbt. I think that 1.2.2 is compatible with sbt 0.11.2 and scala 2.9.1

HTH

Martin Pallmann

unread,
Feb 22, 2013, 5:48:25 AM2/22/13
to play-fr...@googlegroups.com
Hi,

I have the same problem.
I was able to run some test coverage with the jacoco-plugin. It seems pretty straightforward.

But I had the problem that the sonar runner didn't pick up the coverage.

I also created a small mixed scala/java sbt project. The java files get picked up. But if I switch the sonar runner to scala, there is nothing to see.

I may put an example on github if anyone is interested.

Greetings,

Martin

Roch Delsalle

unread,
Jun 13, 2013, 6:23:14 AM6/13/13
to play-fr...@googlegroups.com, sayh...@martinpallmann.de
Hi Martin,

I am interested, I have the same issue with Sonar not picking up the coverage.

Best,

Roch

Peter Önneby

unread,
Jul 26, 2013, 9:02:21 AM7/26/13
to play-fr...@googlegroups.com, sayh...@martinpallmann.de
I also have issues with Sonar and would love to see a working example.

I've posted this issue here already:

Aurélien Allienne

unread,
Jul 3, 2014, 4:03:23 AM7/3/14
to play-fr...@googlegroups.com

After some time, I start to test jacoco4sbt.

I use http://ics-software-engineering.github.io/play-example-quality-assurance/ as reference. But now, I have this error

 $ jacoco:test
[error] (jacoco:full-classpath) java.lang.IncompatibleClassChangeError: class org.jacoco.core.internal.flow.ClassProbesVisitor has interface org.objectweb.asm.ClassVisitor as super class

The link above mentionned this.
Note: Due to ASM library incompatibilities (?), you cannot install both Jacoco and PMD.  If you do, then Jacoco
will report the following error
:

But I don't add pmd module.

Do you have any idea of the problem ?

Regards
Reply all
Reply to author
Forward
0 new messages