You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With a little bit of ad-hoc testing, it seems that if a superclass has a @BeforeMethod annotation, the sub-test-class only run it first (or even at all?) if it has protected visibility
importjava.util.*;
importstaticorg.testng.Assert.*;
importorg.testng.annotations.*;
classSuperSampleTest {
List<String> order = newArrayList<>(2);
@BeforeMethodpublicvoidsuperSetup() {
System.out.println("running super");
order.add("super");
}
}
publicclassSampleTestextendsSuperSampleTest {
@BeforeMethodpublicvoidchildSetup() {
System.out.println("running child");
order.add("child");
}
@TestpublicvoidverifyOrder() {
if (order.get(0).equals("child"))
fail("child before method ran before super!");
}
}
The text was updated successfully, but these errors were encountered:
See post on the user's group: https://groups.google.com/forum/#!topic/testng-users/fJd90c1RPWM
With a little bit of ad-hoc testing, it seems that if a superclass has a @BeforeMethod annotation, the sub-test-class only run it first (or even at all?) if it has protected visibility
The text was updated successfully, but these errors were encountered: