1

How to Skip the failed test cases and to execute the remaining test cases when using Selenium, Java and TestNG.

  • please provide some answer.. – Surya Jan 6 '16 at 5:35
  • @sameerjoshi - If so then please mark question as duplicate and share reference link so that OP can refer. – Helping Hands Jan 6 '16 at 5:35
  • could you please share the link – Surya Jan 6 '16 at 5:38
  • @Surya - Please refer seleniumeasy.com/testng-tutorials/skip-test-in-testng – Helping Hands Jan 6 '16 at 5:41
  • @sameerjoshi I have to agree with Helping Hands - if there's value in having this question here (regardless of it exists elsewhere), then let's make a canonical question and answer for it. If it exists elsewhere on this site let's mark it as a duplicate. Thanks! – corsiKa Jan 6 '16 at 5:44
1

if you know what all test cases have failed in execution then add testng annotation @Test(Enabled=False)

@Test(enabled=false)
public void testCaseEnabling(){
    throw new RuntimeException("I'm Not Ready, please don't execute me");
}
1

First of all, only when you run your suite once you can have failed test cases. When we execute the suite with testng, some reports(HTML, XML and etc) are generated which can be further utilized.

  1. testng-failed.xml
  2. testng-results.xml, etc

Solution

The testng-failed.xml contains all the failed test cases (a.k.a your test methods). You can go to your test methods and disable the test methods by using the enabled parameter with Test annotation.

OR

You can make a copy of testng-results.xml and modify it. It contains all the test cases that have skipped, failed or passed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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