I have a Spring, OpenJPA, DBUnit, TestNG, HSQL build with Maven 2.0.8 and
there are 20 DAO tests that now pass. I am trying to now add cobertura to
this. I have used Cobertura extensively in the past, but never with DBUnit.
So, I am getting the report to generate, but everything is zero. So it
appears that nothing was instrumented.
Here is my surefire and cobertura plugins:
<reporting>....
<plugin>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<includes>
<include implementation="java.lang.String
">**/*.java</include>
</includes>
<excludes>
<exclude implementation="java.lang.String
">**/*Point*.java</exclude>
</excludes>
<systemProperties>
<property>
<name>net.sourceforge.cobertura.datafile</name>
<value>${basedir}/target/cobertura/cobertura.ser</value>
</property>
</systemProperties>
<argLine>-Xmx256m</argLine>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
<plugins>...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>dbunit-maven-plugin</artifactId>
<version>1.0-beta-1</version>
<configuration>
<dataTypeFactoryName>${dbunit.dataTypeFactoryName
}</dataTypeFactoryName>
<driver>${jdbc.driverClassName}</driver>
<username>${jdbc.username}</username>
<password>${jdbc.password}</password>
<url>${jdbc.url}</url>
<src>src/test/resources/test-data.xml</src>
<type>${dbunit.operation.type}</type>
<schema>${dbunit.schema}</schema>
<skip>${maven.test.skip}</skip>
</configuration>
<executions>
<execution>
<phase>test-compile</phase>
<goals>
<goal>operation</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>${jdbc.groupId}</groupId>
<artifactId>${jdbc.artifactId}</artifactId>
<version>${jdbc.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<formats>
<format>xml</format>
<format>html</format>
</formats>
<instrumentation>
<ignores>
<ignore>org.apache.commons.logging.*</ignore>
</ignores>
<excludes>
<exclude>com/**/*Test.class</exclude>
<exclude>org/apache/log4j/**/*.class</exclude>
</excludes>
</instrumentation>
</configuration>
<executions>
<execution>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>openjpa-maven-plugin</artifactId>
<executions>
<execution>
<id>JPA Enhance</id>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
<configuration>
<toolProperties>
<property>
<name>addDefaultConstructor</name>
<value>true</value>
</property>
<property>
<name>enforcePropertyRestrictions</name>
<value>true</value>
</property>
</toolProperties>
</configuration>
</plugin>
When I run mvn site:site to a txt file, I started looking through the trace
and noticed:
*[INFO] [cobertura:instrument]
[INFO] Cobertura 1.9 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura: Loaded information on 13 classes.
Instrumenting 13 files to
C:\opt\temp\myproject\core\target\generated-classes\cobertura
Cobertura: Saved information on 13 classes.
Instrument time: 266ms
[INFO] Instrumentation was successful.
*
So am I missing something with DBUnit plugin, or openJPA plugin as to point
to *target\generated-classes\cobertura instead of **target\classes ???
*--
Thanks,
Mick Knutson
http://www.baselogic.com
http://www.blincmagazine.com
http://www.linkedin.com/in/mickknutson
http://www.djmick.com
http://www.myspace.com/mickknutson
http://www.myspace.com/BLiNCMagazine
http://tahoe.baselogic.com
---