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

11 篇文章 0 订阅
4 篇文章 0 订阅

学习到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清爽多了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值