Java: TestNG:Jenkins Implementation

 

pom.xml

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>${surefire.version}</version>
    <configuration>
        <suiteXmlFiles>
            <suiteXmlFile>Testing_Fuzzy_Logic.xml</suiteXmlFile>
            <suiteXmlFile>Testing_ACL.xml</suiteXmlFile>
        </suiteXmlFiles>
    </configuration>
</plugin>

Jenkins variable:

TEST_NG_XML: Testing_Fuzzy_Logic.xml Testing_ACL.xml

<suiteXMLFiles>

<suiteXMLFile>${TEST_NG_XML}</suiteXMLFile>

</suiteXMLFiles>

 

On jenkins, you can pass top level maven goals in following format

test -DargLine="-DTest_NG_XML=src/test/resources/testng.xml"

In this way , you are passing the value of your Test_NG_XML variable while running the maven test phase.In general execute following maven goal on jenkins.

-DargLine="-Dparameter=value"

On jenkins, you can pass top level maven goals in following format

test -DargLine="-DTest_NG_XML=src/test/resources/testng.xml"

In this way , you are passing the value of your Test_NG_XML variable while running the maven test phase.In general execute following maven goal on jenkins.

-DargLine="-Dparameter=value"

 test -DsuiteXmlFile=src/test/resources/testng1.xml,src/test/resources/testng2.xml

How can one be sure the precedence of execution of test suites passed this way?

I was facing the same issue, I have split it into separate Jenkins builds with each passing separate suite, to be absolutely sure certain suite runs before the other. I would like to simplify it, possibly passing this way as indicated above... but did you try the order of execution? Thanks