pitest 找不到测试

2024-03-01

我在 SonarQube 项目中遇到问题。我想计算一些有关测试质量的统计数据,我正在使用pitest。不幸的是,它没有找到任何变异的测试。

这是pom.xml我正在分析的模块:

<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.sonarsource.sonarqube</groupId>
    <artifactId>sonarqube</artifactId>
    <version>6.2-SNAPSHOT</version>
  </parent>

  <artifactId>sonar-core</artifactId>

  <name>SonarQube :: Core</name>
  <description>Library shared by analyzer and server</description>

  <properties>
    <sonar.exclusions>target/generated-sources/**/*,target/generated-test-sources/**/*</sonar.exclusions>
  </properties>

  <dependencies>
    <dependency>
      <groupId>com.google.code.findbugs</groupId>
      <artifactId>jsr305</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>commons-codec</groupId>
      <artifactId>commons-codec</artifactId>
    </dependency>
    <dependency>
      <groupId>org.picocontainer</groupId>
      <artifactId>picocontainer</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.protobuf</groupId>
      <artifactId>protobuf-java</artifactId>
    </dependency>
    <dependency>
      <groupId>org.codehaus.sonar</groupId>
      <artifactId>sonar-classloader</artifactId>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>sonar-plugin-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.sonarsource.update-center</groupId>
      <artifactId>sonar-update-center-common</artifactId>
    </dependency>

    <!-- logging -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jcl-over-slf4j</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>log4j-over-slf4j</artifactId>
    </dependency>

    <dependency>
      <!-- sonar-api-deps.jar is copied into target JAR file -->
      <groupId>${project.groupId}</groupId>
      <artifactId>sonar-plugin-api-deps</artifactId>
      <version>${project.version}</version>
      <optional>true</optional>
      <scope>runtime</scope>
    </dependency>


    <!-- tests -->
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>sonar-testing-harness</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.google.code.bean-matchers</groupId>
      <artifactId>bean-matchers</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.simpleframework</groupId>
      <artifactId>simple</artifactId>
      <version>4.1.21</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.basepom.maven</groupId>
          <artifactId>duplicate-finder-maven-plugin</artifactId>
          <configuration>
            <ignoredDependencies>
              <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>sonar-plugin-api-deps</artifactId>
              </dependency>
            </ignoredDependencies>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
          <groupId>org.pitest</groupId>
          <artifactId>pitest-maven</artifactId>
          <version>1.1.10</version>
          <configuration>
            <verbose>true</verbose>
              <targetClasses>
                  <param>org.sonar.core.*</param>
              </targetClasses>
              <targetTests>
                  <param>org.sonar.core.*</param>
              </targetTests>
          </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-deprecated-api-deps</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>copy</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>${project.groupId}</groupId>
                  <artifactId>sonar-plugin-api-deps</artifactId>
                  <destFileName>sonar-plugin-api-deps.jar</destFileName>
                </artifactItem>
              </artifactItems>
              <outputDirectory>${project.build.outputDirectory}</outputDirectory>
              <overWriteReleases>false</overWriteReleases>
              <overWriteSnapshots>true</overWriteSnapshots>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

但是当我跑步时:

mvn clean install org.pitest:pitest-maven:mutationCoverage

它找不到测试,即:

4:16:26 PM PIT >> INFO : Sending 0 test classes to minion
4:16:26 PM PIT >> INFO : Sent tests to minion
4:16:27 PM PIT >> INFO : MINION : 4:16:27 PM PIT >> INFO : Checking environment

4:16:27 PM PIT >> INFO : MINION : 4:16:27 PM PIT >> INFO : Found  0 tests

4:16:27 PM PIT >> INFO : MINION : 4:16:27 PM PIT >> INFO : Dependency analysis reduced number of potential tests by 0

4:16:27 PM PIT >> INFO : MINION : 4:16:27 PM PIT >> INFO : 0 tests received

PS:maven中的测试执行正确:

Results :

Tests run: 402, Failures: 0, Errors: 0, Skipped: 0

我有什么错吗?


您指定了pitest插件

<targetClasses>
  <param>org.sonar.core.*</param>
</targetClasses>
<targetTests>
  <param>org.sonar.core.*</param>
</targetTests>

您是否检查过,这些包中有测试类?

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

pitest 找不到测试 的相关文章

随机推荐

  • VBA - 从 Access 生成 Excel 文件(查询表)

    我有一个项目 基本上目标是使用 VBA 在 Access 中单击按钮来生成 Excel 报告 该报告的内容是 SQL Server 数据库存储过程的结果 错误行 With MeuExcel Worksheets 4 QueryTables
  • 如何从父组件修改组件的样式?

    我需要从其父组件修改 Vue 组件的一些 CSS 属性 它将覆盖组件内定义的 CSS 我首先期望对于一个组件
  • 我可以使用 Firestore 获取使用 batch().set 创建的文档的生成 ID 吗?

    有没有一种方法可以获取使用 Firestore 批量创建的文档的自动生成 ID 使用时 add 我可以轻松获得 ID db collection posts add title Hello World then function docRe
  • 部署在 Web 服务器上时 Crystal Report 图标/工具栏不起作用

    我构建了一个网页 其中包含使用 Visual Studio 2008 中包含的 Crystal 库构建的 Crystal Report It 在我的机器上工作 http jcooney net archive 2007 02 01 4299
  • JSF 读取托管 bean 中的动态输入元素

    我有一个非常复杂的 JSF 页面 我们使用带有 Facelet 的 JSF2 我必须在其中 插入 一个纯 html 表单部分 它代表稍后将创建为 Pdf 的文档的所见即所得模板 页面看起来非常简化
  • 从字符中获取 KeyCode?

    我需要能够读取字符并获取与其语言和键盘布局相关的键 我知道如何看待文化背景和语言 但是我怎样才能知道像英语中的 S 这样的字母并且知道它在键盘上是什么键呢 或者对于更难的问题 我如何取出字母 并知道它在键盘上的键是什么 用一个示例程序可能比
  • 无法使用 iOS6.1 sdk 构建 Google Maps SDK for IOS 版本 1.7.0

    我刚刚更新到 GMS 版本 1 7 0 无法成功构建基础SDK iOS6 1 我可以使用 Base SDK iOS7 0 成功构建 GMS 版本 1 7 0 我还可以使用 Base SDK iOS6 0 或 7 0 成功构建旧的 GMS 版
  • MongoDb 区域副本集 - 每个区域的主节点?

    给定一个具有区域用户 区域为北美 欧洲 亚洲 的应用程序 如何创建允许 HK 用户写入最近节点的副本集 目标是香港的用户读取和写入其本地节点 而不会遭受写入美国的延迟 我的假设是 我可以在每个区域设置一个应用程序堆栈 通过副本集在所有区域之
  • 两种颜色的背景 - React Native

    有没有办法让背景有两种颜色 如下所示 两种颜色 https i stack imgur com 0DPHC png我尝试过使用线性渐变 但那只是渐变 我不知道如何在主视图标签中放置两种颜色作为背景 有什么建议么 如果视图的尺寸无法帮助您 请
  • go中如何将[][]byte转换为**char

    我想从 go byte 转换为 C char 换句话说 我在 go 中有一个字节矩阵 我想将其转换为 C 中的 char 双指针 请假设我必须有一个 byte 作为输入和一个 char 作为输出 我知道可以通过执行以下操作从 byte 转换
  • Lambda 的结果角色定义中的可信实体是什么?

    下面是 SAM 模板 Resources HelloWorldFunction Type AWS Serverless Function Properties CodeUri hello world Handler app LambdaHa
  • 在 Visual Studio 中哪里可以修改详细的 C# 编译器优化设置?

    在Visual Studio C C 项目中 可以很容易地在 属性页 C C 优化 中修改编译器的优化设置 例如 我们可能会给出不同的优化级别 例如 O2和 O3 以及高级优化 例如 省略帧指针 但是 我无法简单地在 Visual Stud
  • 减去具有不同时间戳的两个文档之间的数字字段

    假设我有这些数据样本 date 2019 06 16 rank 150 name doc 1 date 2019 07 16 rank 100 name doc 1 date 2019 06 16 rank 50 name doc 2 da
  • 为什么我的 KeyPressEvent 不能与右/左/上/下一起使用?

    在 C 中 我试图查看用户是否按下了正确的键 以便玩家向右移动 但是当我尝试时 它没有注册按键 private void KeyPressed object sender KeyPressEventArgs e if e KeyChar C
  • 与其活动相关的片段生命周期

    情况我的活动等待异步操作 在收到异步操作的回复后 它需要将信息传递给其中的 2 个片段 要求1 两个片段都需要它们的onCreateView为加载布局而进行的调用 2 他们需要全身心地投入到自己的活动中 以便getActivity work
  • 如何将 JUnit 测试用例导出到可执行的 .jar 中?

    我正在使用 Selenium 和 JUnit 来自动化一些测试 我希望能够将其导出到可运行的 jar 文件中 我无法做到这一点 我假设这是因为没有 main 方法 JVM 不知道要运行什么 我看到了这个帖子如何将 JUnit 测试套件导出为
  • 在 main() 之前、之后或内部声明函数有什么优点?

    我正在尝试学习嵌入式系统的C语言 目前我正在学习基础知识 但无法找到一个基本问题的答案 当我编写一个简单的 C 程序时 我用三种方式声明了一个名为 Maximum 的函数 我将通过以下示例进行解释 1 在下面的程序中 函数在 main 外部
  • 用于自动化的 User32 API 自定义 PostMessage

    我想用 C 自动化一个名为 Spotify 的程序 我认为 最好的方法是触发假按键 我想编程来暂停播放 但我对这个东西了解不够 无法找到按键以外的其他方法 因此 我使用 Visual Studio 的 Spy 来查看按下键盘上的播放按钮时
  • 当单词超过2亿时,如何使用Java去除重复单词?

    我有一个文件 大小 1 9 GB 其中包含 220 000 000 2 2 亿 个单词 字符串 它们有重复 几乎每 100 个单词就有 1 个重复单词 在我的第二个程序中 我想读取该文件 我成功使用 BufferedReader 逐行读取文
  • pitest 找不到测试

    我在 SonarQube 项目中遇到问题 我想计算一些有关测试质量的统计数据 我正在使用pitest 不幸的是 它没有找到任何变异的测试 这是pom xml我正在分析的模块