简体   繁体   中英

How to run maven tests sequentially

I have different class with each class have one or more tests.

I want to run the maven tests with each class in a sequential order using testing.xml

testing.xml

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >

<suite name="Suite1" verbose="1">
    <test name="Regression1">
        <classes>
            <class name="test.settings.SettingsTest"/>
            <class name="test.weather.WeatherTest"/>
        </classes>
    </test>
</suite>

When i ran below command , its runs all the test. But i want to run the test specified in testing.xml one by one on sequential order.

mvn -Dtests=testing.xml test

我不确定你的意思,但你有没有试过:

<test name="Regression1" parallel="false" preserve-order="true">

I have missed the configuration in maven-surefire-plugin

Here is what i tried

<plugins>
    [...]
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.18.1</version>
        <configuration>
          <suiteXmlFiles>
            <suiteXmlFile>testing.xml</suiteXmlFile>
          </suiteXmlFiles>
        </configuration>
      </plugin>
    [...]
</plugins>

In testing.xml

<test name="Regression1" parallel="false" preserve-order="true">

its works now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM