您的位置:首页 > 其它

测试框架设计学习笔记 - 3

2018-03-21 23:15 274 查看
学习到28节,testng部分结束了,开始学习Maven。主要内容是Maven的介绍,安装,配置,和几个主要Maven命令:

mvn archetype:generate

mvn eclipse:eclipse

mvn test

mvn test -Psanity //sanity 是POM.xml中某个profile的id,命令行执行也是异常方便,在Jenkins上异常好用…

Maven中groupId、artifactId的作用。以下是一个配置了多个testng XML文件的Maven pom.xml文件,还是挺好理解的。

<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>com.pactera.wh</groupId>
<artifactId>webtest</artifactId>
<version>1</version>
<packaging>jar</packaging>

<name>webtest</name>
<url>http://maven.apache.org</url>

<profiles>
<profile>
<id>sanity</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>sanity.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>regression</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>regression.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.11</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>


工作的项目中其实是用gradle,Groovy语言写的配置文件确实比xml清爽多了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  测试框架设计