Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

1 like 0 dislike
1.0k views
by
retagged by

I am using Jenkins as my CI tool. We are using framework based on testNG. We are planning to create parameterized Jenkins. So far I could read Jenkins parameters from my program via System.getenv. Is there any maven plugin or any library which can help me generate testng.xml file on the fly from Jenkins parameters?

1 Answer

0 like 0 dislike
by The go-to Tester (181 points)

Currently I have my own plugin to do the same.

You can add below plugin to your Maven 

 

<plugin>
<groupId>in.mayurshah</groupId>
<artifactId>testng-xml-maker-maven-plugin</artifactId>
<version>1.0.1</version>
</plugin>
 
you can use below code to generate testng.xml file. Above plugin read environment variables, it can be from Jenkins and convert those to testng.xml file. You can further use that file as TestNG test suite. This file is generated on the fly. So integration with Jenkins is very easy.
 
Command:
mvn clean testng-xml-maker:make test
 
 
As you can see on above command, we first clean the code. We generate testng.xml file on the fly using command testng-xml-maker:make and one ready, we do test. Test will invoke maven-surefire-plugin and use testng.xml as a suite.
 
Hope that answer your questoin.


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

1.4k questions

1.6k answers

866 comments

1.9k users

...