[个人笔记] eclipse+appium+maven+testNG(reportNG)环境搭建

本次使用的是eclipse

刚开始用了IDEA+selenium+maven+reportNG的方式修改了pom.xml和testNG.xml

但是有问题,然后网上查了各种pom.xml和reportNG的listener配置方法,然而途中出现各种错误,

比如 maven-compiler-plugin:3.1 的问题、maven-surefire-plugin相关的问题,还有could not find listener class、找不到testng的class等等。。。

最终还是在pom.xml说写死了所用的Java:

--------------------------被人遗忘的分割线-------------------------

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.14.1</version>
                <configuration>

<!--忽略运行test时错误-->
                    <testFailureIgnore>true</testFailureIgnore>

<!--testNG.xml在项目根目录的res文件夹下-->
                    <suiteXmlFiles>
                        <suiteXmlFile>res/testNG.xml</suiteXmlFile>
                    </suiteXmlFiles>

<!--生成报告所在目录-->

                    <workingDirectory>target/</workingDirectory>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <verbose>true</verbose>
                    <fork>true</fork>
                    <executable>C:Javajdk1.8.0_121injavac</executable>
                </configuration>
            </plugin>

        </plugins>
    </build>
--------------------------被人遗忘的分割线-------------------------

listener写在了testNG.xml里面:

--------------------------被人遗忘的分割线-------------------------

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite
    name="Suite"
    parallel="false" >
    <test name="Test" >
        <classes>
            <class name="com.appium.testDemo.NewAPPTest" />
        </classes>
    </test>
 <!-- Test -->
<listeners>
<!-- 这是你需要加的东西 -->
<listener class-name="org.uncommons.reportng.HTMLReporter" />
<listener class-name="org.uncommons.reportng.JUnitXMLReporter" />
</listeners>
<usedefaultlisteners name="false" />
</suite>

--------------------------被人遗忘的分割线-------------------------

后面想到再补充。

原文地址:https://www.cnblogs.com/aikachin/p/7804921.html