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:
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-clover2-plugin</artifactId>
<configuration>
<flushPolicy>interval</flushPolicy>
<flushInterval>5000</flushInterval>
<!-- <targetPercentage>75%</targetPercentage> -->
</configuration>
<version>4.0.2</version>
</plugin>
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.
You wrote that you have called the following commands:
mvn clean package -DskipTests
mvn clover2:setup compile
I suspect that what happens here is:
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
...run 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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 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 http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. SLF4J: Failed to load class "org.slf4j.impl.StaticMDCBinder". SLF4J: Defaulting to no-operation MDCAdapter implementation. SLF4J: See http://www.slf4j.org/codes.html#no_static_mdc_binder for further details. This happens even if I have my java_home set to /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Actually, nevermind the latter, it looks like there is something else at issue here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
> Exception in thread "main" java.lang.NoClassDefFoundError This is related with missing clover.jar on the class path (KB article about it: https://confluence.atlassian.com/x/lwjoEg), 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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.