While I'm trying to run TestNG from ant as a 'testng' task, i'm getting strange behaviour. TestNG does not create class instance in @BeforeSuite method and in child classes in @Test method i'm getting NullPointerException. E.g.
public class TestBase {
Page mainPage;
@BeforeSuite
public void login() {
...
mainPage = new MainPage();
...
}
}
public class Test_1 extends TestBase {
@Test
public void test1() {
AlbumPage albumPage = mainPage.openAP(); //<-- here i get NullPointerException!
...
}
}
That behaviour i get only if running TestNG using ant - stacktrace of the error shows origins somewhere deep in ant classes when it tries to create a task using 'taskdef' from TestNG lib. So, what is the problem here? Is this a bug or am i doing something wrong?