I have a pre-requisite test that needs to be run before the Regression suite in jenkins. Please advice ? The pre-requisite tests does some configuration task before the regression could start. The environment that we are using is eclipse with TestNG, maven. The coding language used is java.
Asked
Active
Viewed 249 times
0
-
With what command did you run the tests? – Zhivko.Kostadinov May 03 '18 at 05:53
1 Answers
1
Use the pre-integration-test
phase for running the configuration setups. Set it up with the Maven Failsafe plugin
in the pom.xml. Refer to this - http://maven.apache.org/surefire/maven-failsafe-plugin/ and Maven Failsafe Plugin: how to use the pre- and post-integration-test phases
Update with pom.xml sample build section.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
<executions>
<execution>
<id>pre-test</id>
<phase>pre-integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<includes>
<include>**/PreTest.class</include>
</includes>
</configuration>
</execution>
<execution>
<id>int-test</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<includes>
<include>**/IntTest.class</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Use this in the pre-integration-test configuration instead
<configuration>
<suiteXmlFiles>
<suiteXmlFile>
src/test/resources/testng.xml(Path to testng xml)
</suiteXmlFile>
</suiteXmlFiles>
</configuration>

Grasshopper
- 8,908
- 2
- 17
- 32
-
Thank you for your feedback. How would the pom.xml know which test is run as pre-requisite. – Bob Jones May 03 '18 at 06:21
-
-
the name of my test is "CreateUsers.xml". Where do I put my test name in the above pom.xml to run it before the regression suite. Thanks – Bob Jones May 07 '18 at 04:18
-
-
-
Maybe this works, though this is not the ideal way of running tests. Better to let Maven use default configuration setups.. – Grasshopper May 07 '18 at 09:44