-
Couldn't load subscription status.
- Fork 240
Open
Description
My project is a multi-module project.
I am trying to generate a test coverage report with jmockit within maven-surefire-plugin
When I build my maven project from the base directory : mvn clean package or mvn clean install, I get the following error
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR] RestControllerTest.createA_PositiveWorkflow:61 ExceptionInInitializer
[ERROR] RestControllerTest.getAById_PositiveWorkflow:98 NoClassDefFound Could not initialize class mockit.Expectations
[ERROR] RestValidatorTest.validateA1:96 NoClassDefFound Could not initialize class mockit.Expectations
[ERROR] RestValidatorTest.validateA2:115 NoClassDefFound Could not initialize class mockit.Expectations
[ERROR] RestValidatorTest.validateA3:62 NoClassDefFound Could not initialize class mockit.Expectations
[ERROR] RestValidatorTest.validateA4:79 NoClassDefFound Could not initialize class mockit.Expectations
[INFO]
[ERROR] Tests run: 16, Failures: 0, Errors: 6, Skipped: 0
[INFO]
[ERROR]
Java Version : Eclipse Temurin 17.0.5.8-hotspot
Maven Version : 3.6.3
Test Dependencies : jUnit, jMockit
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jmockit</groupId>
<artifactId>jmockit</artifactId>
<version>${jmockit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jmockit</groupId>
<artifactId>jmockit-coverage</artifactId>
<version>1.23</version>
<scope>test</scope>
</dependency>
<!-- Propeties-->
<java.release>17</java.release>
<spring.boot.version>3.0.2</spring.boot.version>
<spring.version>6.0.4</spring.version>
<junit.version>5.9.2</junit.version>
<jmockit.version>1.49</jmockit.version>
Below is my jMockit Coverage configured in maven-surefire-plugin
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>
-javaagent:"${settings.localRepository}"/org/jmockit/jmockit/${jmockit.version}/jmockit-${jmockit.version}.jar
</argLine>
<systemPropertyVariables>
<coverage-output>html</coverage-output>
<coverage-outputDir>target/coverage-report</coverage-outputDir>
<coverage-classes>com.package.api.*</coverage-classes>
<coverage-excludes>com.package.api.constant.*,com.package.api.dto.*,com.package.api.model.*</coverage-excludes>
</systemPropertyVariables>
<argLine>--illegal-access=permit</argLine>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
Please let me know what else I need to do to generate report in defined Output directory.
Note : Running All tests from Intellij Run generated html report but not during Maven build.
Thanks in Advance
Metadata
Metadata
Assignees
Labels
No labels