3

I've around 100 test method in my testing.xml file. and that testing.xml configured in pom.xml file so I'm able to run my all those testcase as maven test and I'm getting the proper reports and all.

I have created one Jenkins job and configured maven project in that and mentioned pom.xml file path of local. I'm able to run successfully.

enter image description here

I'm planning to separate some testcase category wise and manage then in another testing.xml file. lets say 2 xml file having 50 50 test methods.

I'm stuck here. Is it possible to configure every testing.xml file in separate Jenkins job ? if yes then how do i configure ? (Note: I have to run maven test for getting the reports)

1

I got the answer on StackOverflow :

You can pass the xml file name as parameter to the maven test command. First need to change the pom file as follows.

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

Then, you pass the different file name for each execution in goals and options like :

test -DSuiteXmlFile=mytestng1.xml

For second xml file :

test -DSuiteXmlFile=mytestng1.xml

You can configure each Jenkins job with different parameter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.