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

诱惑报告TestNG Maven故障保护插件集成

端木安国
2023-03-14

我将使用诱惑报告来监控硒测试结果。我正在使用TestNG和Maven failsafe插件来运行测试。我找到了非常清晰的例子来修改pom。xml,以便在您使用Maven surefire插件时包含case的诱惑,但对Maven failsafe插件则没有。我假设配置应该非常相似,但它不适合我。这是我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>
    <groupId>vital.com</groupId>
    <artifactId>vital_framework</artifactId>
    <version>0.0.1</version>
    <name>Vital framework</name>
    <description>My first own framework</description>
    <dependencies>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.0.1</version>
        </dependency>
        <dependency>
            <groupId>com.mailosaur</groupId>
            <artifactId>mailosaur-java</artifactId>
            <version>3.0.2</version>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.8</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
        <dependency>
            <groupId>ru.yandex.qatools.allure</groupId>
            <artifactId>allure-testng-adaptor</artifactId>
            <version>${allure.version}</version>
        </dependency>
        <!-- <dependency> <groupId>com.codeborne</groupId> <artifactId>phantomjsdriver</artifactId> 
            <version>1.2.1</version> </dependency> -->
    </dependencies>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <!-- Dependency versions -->
        <selenium.version>LATEST</selenium.version>
        <!-- Configurable variables -->
        <threads>2</threads>
        <browser>firefox</browser>
        <overwrite.binaries>false</overwrite.binaries>
        <!-- Acceptable values: dev, test, uat, prod -->
        <environment>test</environment>
        <aspectj.version>1.7.4</aspectj.version>
        <allure.version>{latest-allure-version}</allure.version>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.19.1</version>
                <configuration>
                    <suiteXmlFiles>
                        <suiteXmlFile>testng.xml</suiteXmlFile>
                    </suiteXmlFiles>
                    <argLine>
                        -javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar
                    </argLine>
                    <parallel>methods</parallel>
                    <parallel>true</parallel>
                    <threadCount>${threads}</threadCount>
                    <systemPropertyVariables>
                        <browser>${browser}</browser>
                        <environment>${environment}</environment>
                        <screenshotDirectory>${project.build.directory}/screenshots</screenshotDirectory>
                        <!--Set properties passed in by the driver binary downloader -->
                        <phantomjs.binary.path>${phantomjs.binary.path}</phantomjs.binary.path>
                        <webdriver.chrome.driver>${webdriver.chrome.driver}</webdriver.chrome.driver>
                        <webdriver.ie.driver>${webdriver.ie.driver}</webdriver.ie.driver>
                        <webdriver.opera.driver>${webdriver.opera.driver}</webdriver.opera.driver>
                        <webdriver.gecko.driver>${webdriver.gecko.driver}</webdriver.gecko.driver>
                    </systemPropertyVariables>
                    <includes>
                        <!-- <include>**/*WD.java</include> -->
                        <include>**/*WD.java</include>
                    </includes>
                    <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>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.lazerycode.selenium</groupId>
                <artifactId>driver-binary-downloader-maven-plugin</artifactId>
                <version>1.0.11</version>
                <configuration>
                    <rootStandaloneServerDirectory>${project.basedir}/src/test/resources/selenium_standalone_binaries</rootStandaloneServerDirectory>
                    <downloadedZipFileDirectory>${project.basedir}/src/test/resources/selenium_standalone_zips</downloadedZipFileDirectory>
                    <customRepositoryMap>${project.basedir}/src/test/resources/RepositoryMap.xml</customRepositoryMap>
                    <overwriteFilesThatExist>${overwrite.binaries}</overwriteFilesThatExist>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>selenium</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

这是我看到的错误:

[ERROR] Failed to execute goal on project vital_framework: Could not resolve dependencies for project vital.com:vital_framework:jar:0.0.1: Failure to find ru.yandex.qatools.allure:allure-testng-adaptor:jar:{latest-allure-version} in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

任何建议都将不胜感激。我假设配置Maven故障保护插件有问题pom.xml.我遵循了这个设置https://github.com/allure-framework/allure1/wiki/TestNG

共有1个答案

姬心思
2023-03-14

本文档使用了以下内容

<properties>
    <allure.version>{latest-allure-version}</allure.version>
</properties>

这基本上意味着您仍然在引用某个未被解析的变量。我建议您用实际最新发布的版本号替换{latest allure version},然后重试。

哦,顺便说一句,你提到的文档和项目已经过时了。你应该是指这里。

 类似资料:
  • 你能帮我做以下几件事吗? 进行量角器测试。

  • 上面的代码用于生成allure报告并运行测试,它运行并生成reports-allure-results中的一个文件夹,其中包含JSON文件。见下方截图

  • 我无法使用allure-maven插件生成AllureTestHTML报告。我使用的是相同版本的testNG-adapter和allure maven插件(1.4.0.rc8)。但是我能够使用allure CLI生成allure html报告。排除依赖项的pom.xml是

  • 在我的项目中,我创建了以下目录结构 在我的pom.xml我做了以下记录 如果我复制src中的资源- 如何使联调也将资源中的文件复制到目标中?

  • 我有一个项目,其中我使用mavenplugin来运行集成测试。我使用的是框架组合。出于项目目的,我在前面修改了TestNG的默认XML报告,以自定义项目需求。 我在CustomReporter类中实现了上述要求,该类扩展了TestNG的接口。早些时候,我使用了插件来运行这些测试方法,并在surefire插件中添加了

  • 我正在运行spring boot,KafkaListener是我的客户。问题是我们如何从失败的kafka配置中恢复,并避免应用程序在退出代码为0的过程结束时停止。例如,不正确的配置可能是不正确的endpointurl。如果无法访问Kafka服务器,也会出现同样的情况。因此,在任何情况下,KafkaListner进程都不应该杀死服务器。 ontext.java:895应用程序上下文异常:未能启动be