DesirePRG
DesirePRG

Reputation: 6388

How to execute a test just after another test has been executed?

I need to execute a testNG test method (testA) just after another test method(testB) has been executed. Also I want to annotate testA with @Test because I want to tell testNG that it is a test method not a configuration method.

I was able to do with @AfterMethod but testNG was treating testA as a configuration method which I don't want it to.

Also I need to execute testA just after testB has been executed. I don't want another test to run in between. How do I do this?

Upvotes: 1

Views: 752

Answers (1)

tom
tom

Reputation: 1503

Use

@Test (dependsOnMethods={"methodB"})
public void methodA () {

 }

See also http://testng.org/doc/documentation-main.html#dependent-methods

Upvotes: 2

Related Questions