We are expanding our TestNG suite to run multiple tests. Doing so we've encountered a strange occurrence.
In one suite I have two tests. Both tests have one class each. Tests in IntegrationTest.java has a @BeforeClass annotation.
This is my testng.xml:
<suite name="Suite">
<test name="Test">
<classes>
<class name="testng.Jenkins"/>
</classes>
</test>
<test name="Test2">
<classes>
<class name="testng.integrationTest.IntegrationTest"/>
</classes>
</test>
</suite>
Two tests, one class each.
Below is my TestNG output console:
There is no mention of the method under @BeforeClass annotation in IntegrationTest.java.
The method got executed (it has sysout in the console) but it is not shown in this TestNG results console.
Shouldn't @BeforeClass execute before @Test?
This the class:
public class IntegrationTest {
//@BeforeSuite
//public void beforeSuite() {
//
// System.out.println("Before suite");
//
//
//
//}
@BeforeClass
public void beforeClass() {
System.out.println("Before class");open("http://www.google.com");
}
@Test
public void IDEEACamsEndtoEndTest() {
System.out.println("Actual test");
}
}
So, @BeforeCLass method doesn't get displayed in TestNG output window (picture above) until I uncomment @BeforeSuite. Then both get displayed (picture below):