I have this example code:
public class A {
@BeforeTest(groups = "group1")
public void beforeTest() {
System.out.println("Before test");
}
@BeforeMethod(groups = "group1")
public void beforeMethod() {
System.out.println("Before method");
}
@Test(groups = { "group1" })
public void test1() {
System.out.println("Test1");
}
@Test(groups = {"group2"})
public void test2() {
System.out.println("Test2");
}
@AfterMethod(groups = { "group2" }, alwaysRun = false)
public void afterMethod() {
System.out.println("After method");
}
@AfterTest(groups = "grupa1")
public void afterTest() {
System.out.println("AfterTest");
}
}
And the output is:
Before test
Before method
Test1
After method
Before method
Test2
After method
AfterTest
But I would like to recieve something like this:
Before test
Before method
Test1
Before method
Test2
After method
AfterTest
Is there any option to call afterMethod method only after second test method? I can't use afterGroup annotation.
Aucun commentaire:
Enregistrer un commentaire