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?

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

1 Answer

by (171 points)
0 votes

Currently I have my own plugin to do the same.

You can add below plugin to your Maven 


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.
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.