慕課網web自動化測試實戰之購買商品(十)

慕課網web自動化測試實戰

訂單支付

需求:
  1. 使用testng.xml運行項目
  2. 使用maven的pom.xml來運行項目
testng.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="All Test Suite">
    <test verbose="2" preserve-order="true" name="E:/IDEAProject/test_mooc">
        <classes>
            <class name="testCase.LoginCase">
                <methods>
                    <include name="testLogin"/>
                    <include name="getLoginHome"/>
                    <include name="addCart"/>
                    <include name="buyNow"/>
                    <include name="sureOrder"/>
                    <include name="orderGoPay"/>
                </methods>
            </class>
        </classes>
    </test>
</suite>
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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>org.example</groupId>
    <artifactId>test_mooc</artifactId>
    <packaging>pom</packaging>
    <version>1.0-SNAPSHOT</version>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <!--jdk版本-->
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.12.4</version>
                <inherited>true</inherited>
                <configuration>
                    <!--運行testng.xml-->
                    <suiteXmlFiles>testng.xml</suiteXmlFiles>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
運行pom.xml方式:

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章