提问人:kyleryan1291 提问时间:6/29/2023 最后编辑:suhel mustoorkyleryan1291 更新时间:6/29/2023 访问量:348
Pitest 失败且未产生突变覆盖率
Pitest is failing and not generating mutation coverage
问:
我正在尝试在我的项目中运行 Pitest,但一直收到此错误:
Failed to execute goal org.pitest:pitest-maven:1.14.2:mutationCoverage (default-cli) on project image-finder: Execution default-cli of goal org.pitest:pitest-maven:1.14.2:mutationCoverage failed: No mutations found. This probably means there is an issue with either the supplied classpath or filters.
我正在尝试使用以下命令从命令行运行 Pitest:mvn clean org.pitest:pitest-maven:mutationCoverage
幸运的是,我正在使用 IntelliJ,并且有一个可用的 IntelliJ Pitest 插件,当我运行它时,它确实可以工作。但是,我希望它也能从命令行工作。
我试过:
- 设置 targetClasses 和 targetTests
- 使用 、 指定目标类和测试类
<param>
<targetTest>
<targetClass>
- 指定的类如下:用于非测试类
com.package.examples.*
- 将测试类指定为: 和
com.package.examples.*Test
com.package.examples.*
- 使用 、 指定目标类和测试类
- 未设置 targetClasses 和 targetTests
- 将 Maven surefire 插件更新到最新版本
- 没有在我的 Pitest 中设置任何配置
pom.xml
我正在使用 JUnit 5,并在 Pitest 插件中包含必要的依赖项。我不确定为什么我总是收到这个错误。
我的 pom 文件目前:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.kyleryxn</groupId>
<artifactId>image-finder</artifactId>
<version>1.0.0</version>
<name>image-finder</name>
<packaging>war</packaging>
<properties>
<jdk.version>17</jdk.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.target>${jdk.version}</maven.compiler.target>
<maven.compiler.source>${jdk.version}</maven.compiler.source>
<spring.version>6.0.10</spring.version>
<thymeleaf.version>3.1.1.RELEASE</thymeleaf.version>
<mockito.version>5.4.0</mockito.version>
</properties>
<dependencies>
<!-- Core libraries -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.30</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.9</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.9</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.15.3</version>
</dependency>
<!-- Database libraries -->
<!-- Servlet libraries -->
<dependency>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.websocket</groupId>
<artifactId>jakarta.websocket-api</artifactId>
<version>2.1.0</version>
<scope>provided</scope>
</dependency>
<!-- Web framework libraries -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
<version>${thymeleaf.version}</version>
</dependency>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf-spring6</artifactId>
<version>${thymeleaf.version}</version>
</dependency>
<!-- Test libraries -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.9.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>pl.pragmatists</groupId>
<artifactId>JUnitParams</artifactId>
<version>1.1.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>image-finder</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*</include>
</includes>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<includes>
<include>**/*.json</include>
</includes>
</testResource>
</testResources>
<!-- Update default Maven plugin versions -->
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
<version>1.14.2</version>
<dependencies>
<dependency>
<groupId>org.pitest</groupId>
<artifactId>pitest-junit5-plugin</artifactId>
<version>1.2.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
任何帮助将不胜感激
答: 暂无答案
评论
pl.pragmatists
junit-jupiter-engine
mvn clean test
mvn clean org.pitest:pitest-maven:mutationCoverage
mvn clean test org.pitest:pitest-maven:mutationCoverage