maven+testng+eclipse
1.安装maven
2.安装testng
3.配置maven的dependency,和build
<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>testnggroup</groupId>
<artifactId>testngartifact</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>testngartifact</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<compilerArgs>
<arg>-Xlint:unchecked</arg>
<arg>-Xlint:deprecation </arg>
<!--<arg>endorseddirs=${endorsed.dir}</arg>-->
</compilerArgs>
</configuration>
</plugin>
<!--添加插件 关联testNg.xml -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<suiteXmlFiles>
<file>res/testNG.xml</file>
</suiteXmlFiles>
<!--<workingDirectory>target/</workingDirectory>-->
</configuration>
</plugin>
</plugins>
</build>
</project>4.创建res文件夹,创建testNG.xml
<?xml version="1.0" encoding="utf-8" ?>
<suite name="testproj" parallel="false">
<test name="testDemo1">
<classes>
<class name="SimpleTest.java"></class>
</classes>
</test>
</suite>5.在eclipse中打开命令行,输入:mvn -f pom.xml clean test -DxmlFileName=testNG.xml
相关推荐
ITstudied 2020-05-06
cintmain 2020-04-20
wndong 2020-03-01
86427019 2019-12-21
SolitudeSky 2019-12-09
wugang0 2019-12-09
lucialee 2019-11-08
mohanzb 2019-10-22
mrjianghaijun 2015-07-30
chengzhezhijian 2015-06-24
pengzhanxuan 2012-11-14
不忘初心才能始终 2019-07-01
80487608 2015-07-29
石羊 2019-06-30
aduocd 2019-06-30
mrsuddenflash 2013-11-18