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

  • What's your selection rule?
    – Alexey R.
    Jan 11, 2019 at 14:39

2 Answers 2


You can add a tag before the test cases you want to execute, first add this tag to your java classes


and then go to your XML file and add the following lines of code just below your suite test.

<test name=”Regression”>
        <include name=”Smoke"/>
        <class name="test.seleniumpractice"/>

This way only test cases with the tag "Smoke" will be executed.


The ISuiteListern allows you to inspect your suite before and after its execution.

This way, you can intercept the suite before the execution and "edit" the test list as you wish.

See here how to implement listeners and here how to implement a ISuiteListern.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.