How to Skip the failed test cases and to execute the remaining test cases when using Selenium, Java and TestNG.
-
please provide some answer..– SuryaCommented Jan 6, 2016 at 5:35
-
@sameerjoshi - If so then please mark question as duplicate and share reference link so that OP can refer.– Helping HandsCommented Jan 6, 2016 at 5:35
-
could you please share the link– SuryaCommented Jan 6, 2016 at 5:38
-
@Surya - Please refer seleniumeasy.com/testng-tutorials/skip-test-in-testng– Helping HandsCommented Jan 6, 2016 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 ♦Commented Jan 6, 2016 at 5:44
2 Answers
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");
}
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.
- testng-failed.xml
- 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.