There are 500 test cases in my suite. I want to select only 50 test cases and execute them. Is there a way to do it using testNG
2 Answers
You can add a tag before the test cases you want to execute, first add this tag to your java classes
@Test(groups={“Smoke”})
and then go to your XML file and add the following lines of code just below your suite test.
<test name=”Regression”>
<groups>
<run>
<include name=”Smoke"/>
</run>
</groups>
<classes>
<class name="test.seleniumpractice"/>
</classes>
</test>
This way only test cases with the tag "Smoke" will be executed.