For skip failed test case


#1

Hello there ,
I am getting a problem in the testing of multiple test case of different module in mobile application. I want to run 10 test cases and in each test case having many steps written in each page. I wrote my test case by the help of TestNg. So my problem is that when I run my test case and if any one test case get failed then due to this the other test cases also get failed. I am using Selenium webdriver, and java for Automating my test cases.

So my question is what I have to do if I want to skip the failed test case and switch to the next module(it means on pages).Even I don’t have home button in the all page.
Please guyz help me


#2

I’m not exactly sure what you are trying to do or how your tests are setup, but if you want a test method to be skipped in case another test method fails, you may want to use TestNG’s dependsOnMethods. If you aren’t familiar with this annotation, this page explains it pretty well:
https://www.mkyong.com/unittest/testng-tutorial-7-dependency-test/


#3

Hi ajit0005,

I was in the same situation and I know what you mean, in this case i suggest you to use TestNg’s TestListener .
The interface ITestListener have a method onTestFailure that will be called every time your test fail.