Multi-Test TestNG.xml file results in java.lang.NullPointerException
Hello Quality Team,
I need help getting TestNG to run multiple tests from one XML file. So far my efforts to do this result in a java.lang.NullPointerException OR the test(s) fake_execute="says it ran...but how can it have run if it didn't start selenium?"
One final note: All of the tests run SUCCESSFULLY when run using a stand-alone XML file
Below is my XML file
<test name="Simple example">
<groups>
<run>
<include name="groupA" />
<include name="groupB" />
</run>
</groups>
<classes>
<class name="test.LoginPageTest"/>
<class name="test.PurchaseItemTest"/>
</classes>
</test>
</suite>
When TestNG/Selenium throws the Null Pointer Error it is always failing on a selenium.open(URL)
, selenium.windowMaximize()
, selenium.windowFocus()
.
I use a SeleneseTestNGHelper file that starts Selenium and handles some base-level selenium functionality.
Here is the command from the Test that my test is failing on
@Test (dataProvider = "Login_Test", groups = {"groupA"})
public void testLoginPage(String string1, String string2) throws Exception {
// Super-size & Focus on Selenium Test Window
//selenium.windowMaximize();
//selenium.windowFocus();
// Start your motors and get to testing
try { selenium.open("http://www.google.com"); }
catch(Throwable e)
{e.printStackTrace(); }
}
Here is the method called
public void open(String string) {
selenium.open(string);
selenium.windowMaximize();
selenium.windowFocus();
}