zoukankan      html  css  js  c++  java
  • [个人笔记] Appium+IDEA+MAVEN+reportNG

    之前写了篇selenium webdriver的maven、reportNG生成报告的配置笔记。

    现在这篇是针对appium的自动化测试笔记。

    testNG-->reportNG配置参考:http://blog.csdn.net/sunfellow2009/article/details/78226246

    (jdk、IDEA、maven工具的安装可参考:http://www.cnblogs.com/iceb/p/7111878.html)

    1.经过尝试,reportNG还是用了 [Run]-->[Edit Configurations...]的方法来配置,在pom.xml中配置未成功,始终报找不到JUnitXmlreport类。。。

    2.在用selenium webdriver的时候(http://www.cnblogs.com/aikachin/p/7765846.html)是在IDEA的终端窗口敲 【mvn -f pom.xml clean test -DxmlFileName=testNG.xml】的方式来跑testng,生成reportNG报告的。

    但是这次发现不行,总是在工程根目录下生成target/surefire-reports,可是在这个目录下找到的都是testNG的报告,不是reportNG格式的。

    ☆但是暂时还没找到解决办法,用了另一个方法代替

    通过上述步骤1,给testNG添加listener之后,就可以直接运行testNG.xml,来调用整个测试并生成reportNG报告了,应该是类似于eclipse的build.xml(ant)吧。

    可以直接选中工程目录下的testNG.xml右击、选择run...

    或者用下面这个方式:

    跑完之后,在根目录的test-out目录下点进去就可以看到reportNG的报告了。

     

    打开index.html

    -----------------------------------------------------------------------------------------------------

    关于报告中文乱码问题可以查看:http://www.cnblogs.com/aikachin/p/7908262.html

    -----------------------------------------------------------------------------------------------------

    补充:

    pom.xml

      1 <?xml version="1.0" encoding="UTF-8"?>
      2 <project xmlns="http://maven.apache.org/POM/4.0.0"
      3          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      4          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      5     <modelVersion>4.0.0</modelVersion>
      6 
      7     <groupId>com.appium</groupId>
      8     <artifactId>automator</artifactId>
      9     <version>1.0-SNAPSHOT</version>
     10 
     11     <name>automator</name>
     12     <url>http://maven.apache.org</url>
     13 
     14     <properties>
     15         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     16     </properties>
     17 
     18     <dependencies>
     19         <dependency>
     20             <groupId>junit</groupId>
     21             <artifactId>junit</artifactId>
     22             <version>3.8.1</version>
     23             <scope>test</scope>
     24         </dependency>
     25 
     26         <dependency>
     27             <groupId>io.appium</groupId>
     28             <artifactId>java-client</artifactId>
     29             <version>3.2.0</version>
     30         </dependency>
     31         <dependency>
     32             <groupId>org.testng</groupId>
     33             <artifactId>testng</artifactId>
     34             <version>6.8.5</version>
     35         </dependency>
     36 
     37         <dependency>
     38             <groupId>org.uncommons</groupId>
     39             <artifactId>reportng</artifactId>
     40             <version>1.1.4</version>
     41             <scope>test</scope>
     42             <exclusions>
     43                 <exclusion>
     44                     <groupId>org.testng</groupId>
     45                     <artifactId>testng</artifactId>
     46                 </exclusion>
     47             </exclusions>
     48         </dependency>
     49         <dependency>
     50             <groupId>com.google.inject</groupId>
     51             <artifactId>guice</artifactId>
     52             <version>4.0</version>
     53             <scope>test</scope>
     54         </dependency>
     55         <!-- https://mvnrepository.com/artifact/velocity/velocity-dep -->
     56         <dependency>
     57             <groupId>velocity</groupId>
     58             <artifactId>velocity-dep</artifactId>
     59             <version>1.4</version>
     60         </dependency>
     61 
     62         <!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
     63         <dependency>
     64             <groupId>commons-codec</groupId>
     65             <artifactId>commons-codec</artifactId>
     66             <version>1.10</version>
     67         </dependency>
     68 
     69     </dependencies>
     70 
     71     <build>
     72         <plugins>
     73             <plugin>
     74 
     75                 <groupId>org.apache.maven.plugins</groupId>
     76 
     77                 <artifactId>maven-surefire-plugin</artifactId>
     78 
     79                 <version>2.14.1</version>
     80 
     81                 <configuration>
     82                     <testFailureIgnore>true</testFailureIgnore>
     83                     <suiteXmlFiles>
     84                         <suiteXmlFilefile>res/testNG.xml</suiteXmlFilefile>
     85                     </suiteXmlFiles>
     86                     <!--                                         <properties>
     87 
     88                                                                 <property>
     89 
     90                                                                     <name>usedefaultlisteners</name>
     91 
     92                                                                     <value>false</value>
     93 
     94                                                                 </property>
     95 
     96                                                                 <property>
     97 
     98                                                                     <name>listener</name>
     99 
    100                                                                     <value>org.uncommons.reportng.HTMLReporter,
    101 
    102                                                                         org.uncommons.reportng.JUnitXMLReporter</value>
    103 
    104                                                                 </property>
    105 
    106                                                             </properties>-->
    107 
    108                     <!--<workingDirectory>target/</workingDirectory>-->
    109                     <!--       <forkMode>always</forkMode>-->
    110                 </configuration>
    111 
    112             </plugin>
    113 
    114             <plugin>
    115 
    116                 <groupId>org.apache.maven.plugins</groupId>
    117 
    118                 <artifactId>maven-compiler-plugin</artifactId>
    119                 <version>3.1</version>
    120                 <configuration>
    121                     <source>1.8</source>
    122                     <target>1.8</target>
    123                     <compilerArgs>
    124                         <arg>-Xlint:unchecked</arg>
    125                         <arg>-Xlint:deprecation</arg>
    126                         <!--<arg>endorseddirs=${endorsed.dir}</arg>-->
    127                     </compilerArgs>
    128                 </configuration>
    129 
    130             </plugin>
    131         </plugins>
    132     </build>
    133 </project>
    View Code

    testNG.xml

     1 <?xml version="1.0" encoding="utf-8" ?>
     2 <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
     3 <suite name="testHgo" parallel="false">
     4     <test name="testLogin">
     5         <packages>
     6             <package name="com.example.cases"/>
     7         </packages>
     8         <classes>
     9         <class name="com.example.cases.testLogin"></class>
    10         </classes>
    11     </test>
    12 
    13 <!--    <listeners>
    14     <listener class-name="org.uncommons.reportng.HTMLReporter" />
    15     <listener class-name="org.uncommons.reportng.JUnitXMLReporter" />
    16     </listeners>-->
    17 <!--<parameter name="usedefaultlisteners" value="false"></parameter>-->
    18 
    19 </suite>
    View Code
  • 相关阅读:
    prufer 序列 学习笔记
    题解 [SDOI2009]E&D/染色游戏/Moving Pebbles
    题解 Christmas Game
    题解 [HNOI/AHOI2018]毒瘤
    题解 UVA1500 Alice and Bob
    Mac端影片压制流程
    react:Text nodes cannot appear as a child
    阿里云docker镜像地址
    Vscode 智能插件
    vue-vant实现IndexBar索引栏
  • 原文地址:https://www.cnblogs.com/aikachin/p/7908302.html
Copyright © 2011-2022 走看看