• java+selenium+testng+allure生成测试报告


    1.下载allure-commandline压缩包,解压缩配置环境变量

    下载地址:https://github.com/allure-framework/allure2/releases/tag/2.13.1

     验证allure是否成功,cmd输入allure

     2.maven pom.xml中设置,只需要allure-testng的版本号替换为实际的版本号

    <properties>
        <aspectj.version>1.8.10</aspectj.version>
    </properties>
    
    <dependencies>
        <dependency>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-testng</artifactId>
            <version>LAST_VERSION</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.20</version>
                <configuration>
                    <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>
        </plugins>
    </build>

    3.如果想要自定义allure-results的生成位置,可以根据以下2种方式进行修改

    3.1新建一个allure.properties放在resources目录下

    allure.results.directory=target/allure-results    实际想要生成的目录

    3.2通过pom文件设置

    在maven-surefire-plugin中configuration下设置systemPropertyVariables

    <systemPropertyVariables>
       <allure.results.directory>./test-output/allure-results</allure.results.directory>
    </systemPropertyVariables>

    4.右键 run as maven test

    运行Maven项目build时出现No compiler is provided in this environment解决方法:

     

    5.在allure-results同级目录下cmd执行allure serve allure-results

  • 相关阅读:
    Charles的基本功能使用
    模拟器的代理功能
    LoadRunner参数包含逗号
    MySQL 与 [charlist]% 通配符
    MySQL 删除重复项并保留其中一个
    Selenium grid 分布式测试搭建(二)
    Selenium grid 分布式测试搭建(一)
    chromedriver与chrome版本映射表 与chromedriver 下载地址
    Selenium 打开 Chrome 链接框只有 Data;
    Xpath 小结
  • 原文地址:https://www.cnblogs.com/heyuling/p/13647198.html
Copyright © 2020-2023  润新知