jeudi 10 novembre 2016

TestNG how to skip test when beforetest fails in inheritance

I have a little problem with testNG. Below my example code:

abstract class parent {

 abstract void beforeTest();

 @Test
 void test() {
         // some testing
 }
}

class child extends parent {

 @BeforeTest
 void beforeTest() {
      \\some before things
 }
}

And the question is how to do this code work properly? So I want to perform beforeTest() method and if it fails the test method shoud skip. How can I achieve this thing?

Aucun commentaire:

Enregistrer un commentaire