views:

427

answers:

1

Hello,

I am using selenium RC with Junit framework and Eclipse. In whole test script, I am just opening one form and update some values in grid table. Some ending lines of code..

selenium.type(prop.gridtxtboxACTL, "test123");
selenium.click("link=Update");
selenium.waitForPageToLoad("30000");

}

public void teardown() throws Exception
{
 selenium.stop();
}

Once the execution is completed I am getting this NullPointerException error:

java.lang.NullPointerException at com.thoughtworks.selenium.SeleneseTestCase.tearDown(SeleneseTestCase.java:395) at junit.framework.TestCase.runBare(TestCase.java:140) at com.thoughtworks.selenium.SeleneseTestCase.runBare(SeleneseTestCase.java:71) at junit.framework.TestResult$1.protect(TestResult.java:110) at junit.framework.TestResult.runProtected(TestResult.java:128) at junit.framework.TestResult.run(TestResult.java:113) at junit.framework.TestCase.run(TestCase.java:124) at junit.framework.TestSuite.runTest(TestSuite.java:232) at junit.framework.TestSuite.run(TestSuite.java:227) at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

Even when I debug the same code, after teardown I am getting "NativeMethodAccessorImpl.invoke(Object, Object[]) line: not available" error.

Please let me know for more details.

A: 

This

java.lang.NullPointerException at 
com.thoughtworks.selenium.SeleneseTestCase.tearDown(SeleneseTestCase.java:395)

implies to me that your variable selenium is null. Is that not the case ? Is that set during your setup method ?

Brian Agnew
no I don't think so. Below is the code which i have written in setup method: public void setUp() throws Exception { selenium = new DefaultSelenium("localhost", 4444, "*iehta", prop.appURL); selenium.start(); }
Saara