I have been using TestNG+Maven+Java+Eclipse for my projects.
This time I have got better chance to put up testing framework from scratch and getting to learn about Maven and TestNG.
Doing this from eclipse is easy. Right click on the testng file and Run As TestNG.
This as to be executed using command line when the tests are integrated to hudson and you need to create different jobs and execute different testng file for differrent cases. Example you need to execute smoketestng.xml for smoke testing and regressiontestng.xml for regression testing.
example:
1. Use maven-surefire-plugin in your pom.xml to run JUnit and testNG files. When "mvn test" is executed surefire plugin will be invoked in build lifecycle.
2.There is option to specify which testng file to run in surefire-plugin by using parameter.
3. In the above case "mvn test" wil execute testng file smoketestng.xml.
How to specify the testng file name from the command line.
< suitexmlfile > ${basedir}/src/test/resources/${tests}.xml < /suitexmlfile >
"mvn -Dtests=smoketestng test" command will supply value to varaiable ${tests}. This way you can execute any testng file you want by providing value from command line.
This time I have got better chance to put up testing framework from scratch and getting to learn about Maven and TestNG.
Doing this from eclipse is easy. Right click on the testng file and Run As TestNG.
This as to be executed using command line when the tests are integrated to hudson and you need to create different jobs and execute different testng file for differrent cases. Example you need to execute smoketestng.xml for smoke testing and regressiontestng.xml for regression testing.
example:
< plugin& gt
< groupid > org.apache.maven.plugins < /groupid >
< artifactid > maven-surefire-plugin < /artifactid >
< version > 2.4.2 < /version >
< configuration >
< suitexmlfiles >
< suitexmlfile > ${basedir}/src/test/resources/smoketestng.xml < /suitexmlfile >
< /suitexmlfiles >
< /configuration >
< /plugin >
1. Use maven-surefire-plugin in your pom.xml to run JUnit and testNG files. When "mvn test" is executed surefire plugin will be invoked in build lifecycle.
2.There is option to specify which testng file to run in surefire-plugin by using
3. In the above case "mvn test" wil execute testng file smoketestng.xml.
How to specify the testng file name from the command line.
< suitexmlfile > ${basedir}/src/test/resources/${tests}.xml < /suitexmlfile >
"mvn -Dtests=smoketestng test" command will supply value to varaiable ${tests}. This way you can execute any testng file you want by providing value from command line.