maven testng.xml测试构建成功,但它不能使用cmd或jenkins运行

时间:2017-07-25 08:27:30

标签: xml maven jenkins testng maven-surefire-plugin

我使用以下命令运行testng套件。但它不会打开任何Web浏览器。它简单地给出了“构建成功”的消息。所以我想知道如何正确运行测试套件。

命令:

mvn clean test -Dsurefire.suiteXmlFiles=mytestng.xml

截图:

enter image description here

TestNg.xml文件

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >

<suite name="Test121 v1.1">

    <test name="Purchase Order Form">

        <parameter name="venRefNo" value="VnRef0001"/>
        <parameter name="venBillingAddress" value="No420.Vendor Road, Vendor City"/>
        <classes>
            <class name="Procurement._01_PurchaseOrder.TestCases.TestCase_13_Procurement_PurchaseOrder" />
        </classes>
    </test>

    <test name="Inbound Shipment Form">
        <classes>
            <class name="Procurement._01_PurchaseOrder.TestCases.TestCase_13_Procurement_InboundShipment" />
        </classes>
    </test>

    <test name="Purchase Invoice">
        <classes>
            <class name="Procurement._01_PurchaseOrder.TestCases.TestCase_13_Procurement_PurchaseInvoice" />
        </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>test11</groupId>
    <artifactId>test11</artifactId>
    <packaging>pom</packaging>
    <version>1.0-SNAPSHOT</version>

    <dependencies>

        <dependency>
            <artifactId>test11</artifactId>
            <groupId>test11</groupId>
            <version>2.0.5-SNAPSHOT</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.4.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.testng/testng -->
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.11</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>commons-configuration</groupId>
            <artifactId>commons-configuration</artifactId>
            <version>1.6</version>
        </dependency>

        <dependency>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.6.1</version>
        </dependency>

        <dependency>
            <groupId>org.apache.maven.surefire</groupId>
            <artifactId>surefire</artifactId>
            <version>2.20</version>
            <type>pom</type>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.20</version>
                <configuration>
                    <suiteXmlFiles>
                        <suiteXmlFile>TestNgSuite.xml</suiteXmlFile>
                    </suiteXmlFiles>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <!-- https://mvnrepository.com/artifact/org.jenkins-ci.main/jenkins-core -->

</project>

1 个答案:

答案 0 :(得分:0)

在命令行中,只有清理过程成功。您是否注意到目标文件夹中生成的任何文件???