Code Coverage

287 views
Skip to first unread message

Lane Feltis

unread,
Feb 25, 2014, 8:05:47 PM2/25/14
to testfx-...@googlegroups.com
Hey Henrick,

I have been trying for a while to get code coverage into my builds and I am having some trouble... I am not sure if it is my tech stack not playing nicely together, but here are the details...

- Gradle 1.11
- JDK 1.8
- Test FX 3.1.2

...I am using this Gradle Java FX plugin (http://speling.shemnon.com/blog/2013/10/29/javafx-gradle-plugin-0-dot-4-0-released/) that simply points to the jfxrt JAR on any machine (platform independent). Ideally I would like to use JaCoCo, the built in Gradle code coverage, but I am also open to Cobertura (either by eriwen https://github.com/eriwen/gradle-cobertura-plugin or by stevesaliman https://github.com/stevesaliman/gradle-cobertura-plugin) or essentially any other framework that actually works with Test FX. 

Start without applying any plugin... the tests all work and pass... but when I add "apply plugin: 'jacoco'" I get the exception...

Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.

Caused by: java.lang.NoSuchFieldException: $jacocoAccess

...whereas if I add "apply plugin: 'cobertura'" (eriwen), the tests run, but the views never actually load (the initial gray rectangle is displayed) and I get the expected exception for each test, NoNodesFound...

...whereas if I add "apply plugin: 'cobertura'" (saliman), the tests run and finish successfully... but if I run the code coverage task "gradle cobertura" I get the exception...

Unable to instrument file (1x for my main stage class, 12x for my main controller class, 1x for a helper class, 1x for a minor controller class)

java.lang.IllegalArgumentException

...have you been able to get code coverage integrated with your Test FX tests?


Thanks!

Lane

Lane Feltis

unread,
Feb 27, 2014, 8:11:51 PM2/27/14
to testfx-...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages