java - TestNG how to skip test when beforetest fails in inheritance -
i have little problem testng. below example code:
abstract class parent { abstract void beforetest(); @test void test() { // testing } } class child extends parent { @beforetest void beforetest() { \\some before things } }
and question how code work properly? want perform beforetest() method , if fails test method shoud skip. how can achieve thing?
usually, configuration methods go parrent , test classes should extend parrent. so, try using example tests:
abstract class testbase { @beforetest public void beforetest() { // config here // run each of <test> tag in testng.xml suite } @beforemethod public void beforemethod() { // config here // run each method annotated @test } } class sometestclass extends testbase { @test public void some_test() { // testing } }
Comments
Post a Comment