通过命令行使用Maven运行特定的TestNG套件

时间:2018-02-25 20:41:43

标签: maven selenium testng

我正在尝试使用命令行在Maven中运行特定的TestNG套件。

我有两套不同的套房 regression.xml pom.xml

我的<groupId>com.FNB</groupId> <artifactId>FNB_Testing</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>FNB_Testing</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>3.4.0</version> </dependency> <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>6.11</version> <scope>test</scope> </dependency> 文件看起来像这样

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

mvn test -DsuiteXmlFile=*suite name*

我正在使用命令<?xml version='1.0' encoding='UTF-8'?> <Data> <Worker> <Worker_ID>12</Worker_ID> <Time_Off> <Type>Compassionate Leave</Type> <Date>2018-02-09-08:00</Date> <Units>1</Units> </Time_Off> <Time_Off> <Type>Compassionate Leave</Type> <Date>2018-02-08-08:00</Date> <Units>1</Units> </Time_Off> <Time_Off> <Type>Compassionate Leave</Type> <Date>2018-02-08-08:00</Date> <Units>-1</Units> </Time_Off> <Time_Off> <Type>Compassionate Leave</Type> <Date>2018-02-01-08:00</Date> <Units>1</Units> </Time_Off> <Time_Off> <Type>Statutory Holiday</Type> <Date>2018-02-07-08:00</Date> <Units>1</Units> </Time_Off> <Time_Off> <Type>Statutory Holiday</Type> <Date>2018-02-06-08:00</Date> <Units>1</Units> </Time_Off> </Worker> </Data>

然而,即使使用了somke.xml,它也只会运行回归套件

0 个答案:

没有答案