zoukankan      html  css  js  c++  java
  • Allure 生成测试报表

    Allure官方文档参考地址:https://docs.qameta.io/allure/#_testng

    1.在maven中添加依赖并进行相应的配置:

    <!-- 实现版本控制 -->
    <properties>
        <aspectj.version>1.8.10</aspectj.version>
    </properties>
    
    <!-- 导入allure-testng 的依赖 -->
    <dependencies>
        <dependency>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-testng</artifactId>
            <version>2.12.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    
    <!-- 添加 build 元素,指定项目以什么样的方式去构建 -->
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
            <!-- 配置maven-surefire-plugin插件来使用maven命令来调用测试套件 -->
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.20</version>
                <configuration>
                    <!--设置参数命令行-->
                    <argLine>
                        -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
                    </argLine>
                 <suiteXmlFiles>
                   <!--代表的是要执行的测试套件路径/名称-->
                   <suiteXmlFile>testng.xml</suiteXmlFile>
                </suiteXmlFiles>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>aspectjweaver</artifactId>
                        <version>${aspectj.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

     

    2.mvn 使用Maven命令执行,clean 清除target目录残留文件,test执行套件

     (1) 命令行执行

    //前提:已经配置Maven环境
    MAVEN_HOME:D:apache-maven-3.6.0
    PATH:D:apache-maven-3.6.0in
    //在项目根路径下打开cmd窗口,执行mvn clean test命令,项目开始构建
    D:Eclipse_workspaceweb_auto>mvn clean test

    (2) 在Eclipse中选中项目名右键选择:

    点击Run后项目开始构建,直到项目构建完成后执行下一步;

    补充:构建项目后如果出现以下情况:解决办法请参考博文地址:https://www.cnblogs.com/xiaozhaoboke/p/11202835.html

    (3)在当前目录下打开cmd执行 allure serve target/allure-results

    如果出现如下提示,则需要安装allure插件

    D:Eclipse_workspaceweb_auto>allure serve allure-results
    'allure' 不是内部或外部命令,也不是可运行的程序
    或批处理文件。

     (4)安装allure 插件,参考官方文档安装地址:https://docs.qameta.io/allure/#_installing_a_commandline

      Allure.zip 下载地址链接:http://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/

         allure-commandline-2.12.1.zip http://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/2.12.1/allure-commandline-2.12.1.zip

     

          下载=》解压=》进入bin目录=》执行allure.bat =》配置到path环境 D:allureallure-2.12.1in

    //cmd验证
    D:Eclipse_workspaceweb_auto>allure --version
    2.12.1

    (5) 再次执行第(3)步

    D:Eclipse_workspaceweb_auto>allure serve allure-results
    Generating report to temp directory...
    Report successfully generated to C:UsersADMINI~1AppDataLocalTemp2283257593
    12518038allure-report
    Starting web server...
    2019-07-17 17:40:14.105:INFO::main: Logging initialized @8623ms to org.eclipse.j
    etty.util.log.StdErrLog
    Server started at <http://192.168.1.3:58814/>. Press <Ctrl+C> to exitx

    执行完成后默认浏览器自动打开report,或者复制URL重新刷新访问页面

     学习后总结分享,report报告中载入错误截图待续。。。

  • 相关阅读:
    mysql,SQL标准,多表查询中内连接,外连接,自然连接等详解之查询结果集的笛卡尔积的演化
    java:JDBC详解
    卷积在深度学习中的作用(转自http://timdettmers.com/2015/03/26/convolution-deep-learning/)
    卷积(转自wiki百科)
    windows10环境下安装Tensorflow
    3、继承与派生
    2、对象和类
    1、从C语言到C++
    使用Jupyter Notebook编写技术文档
    3、利用GDB进行程序调试
  • 原文地址:https://www.cnblogs.com/xiaozhaoboke/p/11202120.html
Copyright © 2011-2022 走看看