2

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 at 14:39
1

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.

0

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 acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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