maventestngmaven-surefire-plugintestng.xml

Maven not running tests in parallel if value is set to tests


I have api test, which runs with maven and testng. But while running it on parallel it doesnot run when its set to tests and I have multiple @Test.

 <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.0.0-M5</version>
        <configuration>
          <suiteXmlFiles>
            <suiteXmlFile>src/test/java/suite.xml</suiteXmlFile>
          </suiteXmlFiles>
          <systemProperties>
            <property>
              <name>env</name>
            </property>
          </systemProperties>
          <properties>
            <property>
              <name>parallel</name>
              <value>tests</value>
            </property>
            <property>
              <name>dataproviderthreadcount</name>
              <value>10</value>
            </property>
            <property>
              <name>threadCount</name>
              <value>10</value>
            </property>
          </properties>
        </configuration>
      </plugin>

Solution

  • parallel=tests in testng suite parlance do not translate to @Test methods. You need to set parallel=methods for all @Test annotated methods to run in parallel.