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

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

2 Answers 2

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