I am trying to run a Test group in TestNG by right clicking on TestNG.xml as a test suite and get below Error.
java.lang.NullPointerException
at execution_Engine.TestCase1_Login.Login(TestCase1_Login.java:54)
Note: When I run the Test on its own(not as a Test suite) it runs fine.
Can anyone be kind enough to point out what the problem is? and solution to this problem.
TestNG.xml
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Smoke tests">
<test name="regressions Test Suite">
<groups>
<run>
<include name="Regression"/>
</run>
</groups>
<classes>
<class name="execution_Engine.TestCase1_Login"/>
<class name="execution_Engine.TestCase2_InvalidLogin"/>
</classes>
<packages>
<package name="execution_Engine" />
</packages>
</test>
</suite>
@SuppressWarnings("unused")
public class TestCase1_Login {
public static WebDriver driver = null;
@BeforeMethod
public static void LaunchIEandNavigate() {
/*** Launch IE **/
System.setProperty "webdriver.ie.driver", "C:\\IE\\IEDriverServer.exe");
driver = new InternetExplorerDriver();
/*** implicit Wait **/
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
/*** Navigate to URL **/
driver.get("http://google.com");
@Test(enabled = true, groups = "Regression")
public void Login() {
/*** Login Action **/
driver.findElement(By.id("UserId")).sendKeys("DummyUser"); Line 54
driver.findElement(By.id("Password")).sendKeys("password");
driver.findElement(By.id("Submit-button")).click();
System.out.println("Testcase1 - ValidLogin executed sucessfully.");
}
@AfterMethod
public void CloseIEandQuit() {
//driver.switchTo().defaultContent();
/** Close and quit browser*/
driver.close();
driver.quit();
}
Just Add (alwaysRun = true) to the @BeforeMethod annotation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With