HiveBrain v1.2.0
Get Started
← Back to all entries
patternjavaMinor

Is it possible to run every testing.xml file with different jenkins job?

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
filewithjenkinseveryxmldifferentpossibletestingjobrun

Problem

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.

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)

Solution

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.


    org.apache.maven.plugins
    maven-surefire-plugin
    2.19.1
        
            
                ${SuiteXmlFile}
            
        


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.

Code Snippets

<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>
test -DSuiteXmlFile=mytestng1.xml
test -DSuiteXmlFile=mytestng1.xml

Context

StackExchange DevOps Q#2911, answer score: 2

Revisions (0)

No revisions yet.