Surefire报告显示使用testng的测试计数加倍

Surefire报告显示使用testng的测试计数加倍,testng,maven-surefire-plugin,Testng,Maven Surefire Plugin,构建运行时,将显示41个测试: 但在Aws的surefire报告中,测试计数为82(每个测试出现两次): 我使用的是testng 7.3.0,surefire版本3.0.0-M5(maven repository上目前的最新版本) 编辑: 在target->surefire reports->junitreports文件夹中,我看到每个类两次, 就像这样:“TEST LoginTests.xml” 曾经是这样:“testsanity.LoginTests.xml”。 理智是一个包裹 pom:

构建运行时,将显示41个测试:

但在Aws的surefire报告中,测试计数为82(每个测试出现两次):

我使用的是testng 7.3.0,surefire版本3.0.0-M5(maven repository上目前的最新版本)

编辑:

在target->surefire reports->junitreports文件夹中,我看到每个类两次, 就像这样:
“TEST LoginTests.xml”
曾经是这样:
“testsanity.LoginTests.xml”。
理智是一个包裹

pom:


有什么想法吗?

请查看插件和TestNG库的多个版本。此外,请检查位于target/surefire-reports中的XML文件的数量。每个版本的TestNG库都会出现这种情况。关于目标文件夹,请参阅我的编辑文件夹“junitreports”不是由Surefire创建的。我猜它是由TestNG创建的。Surefire的XML文件应该直接出现在“目标/Surefire报告”中。“TEST LoginTests.XML”是一个典型的Surefire XML文件,但它也应该包含包名。第二个“TEST Sanity.LoginTests”不以“.XML”结尾。请在GitHub中创建一个可复制的项目。是的。可能这就是为什么它是两次的原因。由于“surefire report:report”运行测试并生成报告,请尝试仅运行测试“mvn test”。TestNG会在测试执行过程中生成报告。因此,这样做应该是值得的。
<?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>

<groupId>org.example</groupId>
<version>1.0-SNAPSHOT</version>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.0.0-M5</version>
            <configuration>
                <suiteXmlFiles>
                    <suiteXmlFile>testng.xml</suiteXmlFile>
                </suiteXmlFiles>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>14</source>
                <target>14</target>
            </configuration>
        </plugin>
    </plugins>
</build>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-bom</artifactId>
            <version>1.11.327</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>
<dependencies>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.141.59</version>
    </dependency>
    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>25.0-jre</version>
    </dependency>
    <dependency>
        <groupId>ru.yandex.qatools.ashot</groupId>
        <artifactId>ashot</artifactId>
        <version>1.5.4</version>
    </dependency>
    <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-java-sdk-s3</artifactId>
    </dependency>
    <dependency>
        <groupId>io.github.bonigarcia</groupId>
        <artifactId>webdrivermanager</artifactId>
        <version>4.2.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.4</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.retry</groupId>
        <artifactId>spring-retry</artifactId>
        <version>1.3.0</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aspects</artifactId>
        <version>5.2.9.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>javax.mail</groupId>
        <artifactId>mail</artifactId>
        <version>1.4</version>
    </dependency>
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>7.3.0</version>
        <scope>test</scope>
    </dependency>
</dependencies>
    version: 0.2

phases:
  install:
    runtime-versions:
      java: corretto11
    commands:
      - apt update
      - curl -O https://download.java.net/java/GA/jdk14/076bab302c7b4508975440c56f6cc26a/36/GPL/openjdk-14_linux-x64_bin.tar.gz
      - tar xvf openjdk-14_linux-x64_bin.tar.gz
      - mv jdk-14 /opt/
      - /opt/jdk-14/bin/java --version
  build:
    commands:
      - env JAVA_HOME=/opt/jdk-14 PATH=/opt/jdk-14/bin:$PATH mvn --version
      - env JAVA_HOME=/opt/jdk-14 PATH=/opt/jdk-14/bin:$PATH mvn -Dtestng.dtd.http=true surefire-report:report
reports: #New
  SurefireReports: # CodeBuild will create a report group called "SurefireReports".
    files: #Store all of the files
      - '**/*'
    base-directory: 'target/surefire-reports' # Location of the reports