python functional tests do not generate clover coverage

Hi folks, hopefully this is a noob issue that I haven't been able to find the answer to...

I'm trying to generate code coverage numbers from our python functional tests.  Whenever, I generate the reports, it gives me 0 tests run, 0% test coverage.  I am able to generate unittest coverage numbers though.

Here are the steps that I'm taking when trying to get the python functional test numbers:

mvn clean package -DskipTests

mvn clover2:setup compile

<cd to python tests, export PYTHONPATH, run tests>

<cd back to where the main pom.xml is>

mvn clover2:aggregate clover2:clover


As mentioned earlier, when I take a look at the report it says I have executed 0 tests, and have 0% test coverage.  I do not see any errors when generating the report, or executing the python tests.

I thought that things could possibly be because we kill off processes at the end of each functional test, so I added the following to the main pom.xml as suggested by the doc:

        <!-- <targetPercentage>75%</targetPercentage> -->

and I inserted a 1 second sleep statement prior to killing of the processes in the python scripts.  I do see the print statements indicating it is sleeping before the kill.

Still, I do not see any tests run or any test coverage %. 

What am I missing?

Thanks in advance.

1 answer

1 vote

You wrote that you have called the following commands:

mvn clean package -DskipTests

mvn clover2:setup compile


I suspect that what happens here is:

  • first 'mvn' call compiles code without Clover and creates JAR files, so your application is not instrumented
  • second mvn call runs
    • 'clover2:setup' - Clover instruments files and creates a clover.db file (so later you can see these classes in a report), but
    • 'compile' command does not compile anything because classes have been already compiled and packaged in a first step (could you check your build logs to confirm this, please?)

As a consequence, your python tests are running with a non-instrumented application and no coverage is recorded. Next, 'mvn clover2:clover' is called which generates a report using 'clover.db' (as it was prepared during 'clover2:setup'), but with 0% coverage.


I guess that you should call it like this:

mvn clean clover2:setup package -DskipTests python tests...

mvn clover2:aggregate clover2:clover

One more thing. I've noticed that you have flushInterval=5 seconds and at the same time you have 1-second sleep before killing the JVM.

Marek thanks for the response! You seem to be right--since I was doing a mvn clean package, the jars would not be instrumented. However, after I run mvn clean clover2:setup package -DskipTests when trying to start the processes I get the following: objc[29788]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined. Exception in thread "main" java.lang.NoClassDefFoundError: com_atlassian_clover/TestNameSniffer ... Caused by: java.lang.ClassNotFoundException: com_atlassian_clover.TestNameSniffer at$ at$ at Method) at at java.lang.ClassLoader.loadClass( at sun.misc.Launcher$AppClassLoader.loadClass( at java.lang.ClassLoader.loadClass( ... 1 more I haven't been able to figure out which plugin is causing things to croak, so I include the path to the clover.jar file in the command and that results in the following: objc[30396]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined. SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See for further details. SLF4J: Failed to load class "org.slf4j.impl.StaticMDCBinder". SLF4J: Defaulting to no-operation MDCAdapter implementation. SLF4J: See for further details. This happens even if I have my java_home set to /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home

Actually, nevermind the latter, it looks like there is something else at issue here.

> Exception in thread "main" java.lang.NoClassDefFoundError This is related with missing clover.jar on the class path (KB article about it:, so your decision to add clover.jar was correct. > SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". Clover does not use SLF4J, so it must be something wrong in your application.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Dec 10, 2018 in Confluence

Organizing your space just got easier - Page Tree Drag & Drop is here

Hi Community! I’m Elaine, Confluence Product Manager. You may have read my earlier post about page tree in space navigation sidebar. I'm excited to share another improvement that helps you organize ...

202 views 6 7
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you