当前位置: 首页 > 知识库问答 >
问题:

Maven测试不创建诱惑力结果

祖翰音
2023-03-14

我有一个使用TestNG和Allure报告的设置,当我从IntelliJ运行测试时,它工作得很好。我看了一下运行配置,它所做的只是在执行测试之前进行一个构建。然后,该过程在allure-results文件夹中创建诱惑结果。

我看过这个问题(在Maven build上不会生成诱惑力结果),但这并没有解决我的问题。

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

    <groupId>org.example</groupId>
    <artifactId>Groovy_Practice</artifactId>
    <version>1.0-SNAPSHOT</version>
    <properties>
        <groovy.version>2.5.8</groovy.version>
        <aspectj.version>1.8.10</aspectj.version>
    </properties>
    <build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.20</version>
            <configuration>
                <testFailureIgnore>false</testFailureIgnore>
                <argLine>
                    -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
                </argLine>
                <properties>
                    <property>
                        <name>listener</name>
                        <value>ru.yandex.qatools.allure.testng.AllureTestListener</value>
                    </property>
                </properties>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.aspectj</groupId>
                    <artifactId>aspectjweaver</artifactId>
                    <version>${aspectj.version}</version>
                </dependency>
            </dependencies>
        </plugin>
        <plugin>
            <groupId>org.codehaus.gmavenplus</groupId>
            <artifactId>gmavenplus-plugin</artifactId>
            <version>1.7.1</version>
            <dependencies>
                <dependency>
                    <groupId>org.codehaus.groovy</groupId>
                    <artifactId>groovy</artifactId>
                    <version>${groovy.version}</version>
                </dependency>
            </dependencies>
            <executions>
                <execution>
                    <goals>
                        <!-- This goal adds Groovy test sources to the project's test sources. -->
                        <goal>addTestSources</goal>
                        <goal>compileTests</goal> <!-- Compiles tests -->
                        <!-- generates stubs in target/generated-sources/groovy-stubs/test, only needed when
                             compiling Java code that depends on Groovy code -->
                        <goal>generateTestStubs</goal>
                        <goal>removeTestStubs</goal> <!-- remove generated stubs from sources list -->
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
    </build>
    <dependencies>
        <!-- https://mvnrepository.com/artifact/ru.yandex.qatools.allure/allure-testng-adaptor -->
        <dependency>
            <groupId>ru.yandex.qatools.allure</groupId>
            <artifactId>allure-testng-adaptor</artifactId>
            <version>1.5.4</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>4.1.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>4.1.1</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy</artifactId>
            <version>${groovy.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest</artifactId>
            <version>2.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.14.3</version>
            <scope>test</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/io.qameta.allure/allure-testng -->
        <dependency>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-testng</artifactId>
            <version>2.13.5</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>json-path</artifactId>
            <version>4.2.0</version>
        </dependency>
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>xml-path</artifactId>
            <version>4.2.0</version>
        </dependency>
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>json-schema-validator</artifactId>
            <version>4.2.0</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured -->
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <version>4.2.0</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-all</artifactId>
            <version>2.4.2</version>
        </dependency>
    </dependencies>
</project>

共有1个答案

沈旻
2023-03-14

我的问题出在POM的gmaven-plugin部分。我对此进行了更新,并将我的项目改为只有groovy类(没有Java类)。我的工作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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>org.example</groupId>
  <artifactId>Groovy_Practice</artifactId>
  <version>1.0-SNAPSHOT</version>
  <properties>
    <groovy.version>2.5.8</groovy.version>
    <aspectj.version>1.8.10</aspectj.version>
  </properties>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.20</version>
        <configuration>
          <testFailureIgnore>false</testFailureIgnore>
          <argLine>
            -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
          </argLine>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>${aspectj.version}</version>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <groupId>io.qameta.allure</groupId>
        <artifactId>allure-maven</artifactId>
        <version>2.9</version>
        <configuration>
          <resultsDirectory>allure-results</resultsDirectory>
          <inputDirectories>allure-results</inputDirectories>
          <outputDirectory>allure-report</outputDirectory>
          <reportVersion>2.3.1</reportVersion>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.gmavenplus</groupId>
        <artifactId>gmavenplus-plugin</artifactId>
        <version>1.7.1</version>
        <executions>
          <execution>
            <goals>
              <goal>addSources</goal>
              <goal>addTestSources</goal>
              <goal>compile</goal>
              <goal>compileTests</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
      <groupId>ru.yandex.qatools.allure</groupId>
      <artifactId>allure-testng-adaptor</artifactId>
      <version>1.5.4</version>
    </dependency>
    <dependency>
      <groupId>org.apache.poi</groupId>
      <artifactId>poi</artifactId>
      <version>4.1.1</version>
    </dependency>
    <dependency>
      <groupId>org.apache.poi</groupId>
      <artifactId>poi-ooxml</artifactId>
      <version>4.1.1</version>
    </dependency>
    <dependency>
      <groupId>org.codehaus.groovy</groupId>
      <artifactId>groovy</artifactId>
      <version>${groovy.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest</artifactId>
      <version>2.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.testng</groupId>
      <artifactId>testng</artifactId>
      <version>6.14.3</version>
      <scope>test</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/io.qameta.allure/allure-testng -->
    <dependency>
      <groupId>io.qameta.allure</groupId>
      <artifactId>allure-testng</artifactId>
      <version>2.13.5</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>json-path</artifactId>
      <version>4.2.0</version>
    </dependency>
    <dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>xml-path</artifactId>
      <version>4.2.0</version>
    </dependency>
    <dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>json-schema-validator</artifactId>
      <version>4.2.0</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured -->
    <dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>rest-assured</artifactId>
      <version>4.2.0</version>
    </dependency>
    <dependency>
      <groupId>org.codehaus.groovy</groupId>
      <artifactId>groovy-all</artifactId>
      <version>2.4.2</version>
    </dependency>
    <dependency>
      <groupId>org.yaml</groupId>
      <artifactId>snakeyaml</artifactId>
      <version>1.27</version>
    </dependency>

  </dependencies>
</project>
 类似资料:
  • 我目前正在使用cucumber json report进行来自jenkins的报告。该报告将测试的每个屏幕截图保存在内存中,这通常会导致java堆内存错误。我想尝试一下“诱惑”,但是在创建报告时没有找到任何关于它的行为的信息。所以我有几个问题:1。诱惑报告是在测试执行过程中创建的,还是在执行完成后才将所有结果汇总并写入报告?2.报表在其他地方存储时,是否将截图嵌入到报表中或作为链接添加?3.截图是

  • 我正试着把诱惑力报告整合到一个Gradle构建中。似乎没有对Gradle的直接支持(全部是Maven),只有对TestNG的一些最近的支持。进一步挖掘,我发现Gradle不支持JUnit侦听器的一些问题,但是他们支持TestNG侦听器(因为TestNG支持)。我尝试了一个gradle集成,遵循Maven pom作为JUnit插件的指导原则,但它显然不会产生任何输出。所以我想我的问题是:是否会有任何

  • 通过在allure-results目录外运行Allure serve可以生成(xmls)并查看诱惑结果,但当在Jenkins中使用具有来自Jenkins工作区的相对路径的诱惑结果目录进行配置时,将找不到诱惑结果。想必这条路有问题吧 [allure_test]$/users/me/.jenkins/tools/ru.yandex.qatools.Allure.jenkins.tools.allure

  • 我正在运行来生成诱惑报告,但当没有测试运行时,构建失败(因为还没有与给定测试组匹配的测试): [ERROR]无法执行目标org.apache.Maven.plugins:maven-site-plugin:3.3:项目登录时的site(default-site)-tests:页面生成过程中出错:呈现Maven报告时出错:无法生成报告:InvocationTargetException:无法找到任何

  • 我开始使用Allure和Python Behave对中等规模的C++服务生态系统进行高级BDD测试。 我得到的是Jenkins内部的一个网页,上面有漂亮清晰的报告,这要感谢Allure-Jenkins插件。

  • 我面临着一个奇怪的问题,我的诱惑测试报告没有显示测试身体部分。这是我的maven命令 这是我的pom文件:我也附上了报告截图,问题是它不包括测试部分。 http://maven.apache.org/xsd/maven-4.0.0.xsd" 这是cucumber赛跑者文件