Getting Session ID is null

1,472 views
Skip to first unread message

venkata raghuram

unread,
Jan 29, 2013, 12:11:29 AM1/29/13
to webd...@googlegroups.com
Hi,

From last few days i am facing a problem when running my test cases in CI (jenkins)

Tried with this combinations
Grid2: Hub and grid on same machine (Ubunutu 12.0.4)
Driver: Selenium-server-2.29.0.jar
Browser: Firefox V18.0.1
TestNG: 5

Grid2: Hub on Linux and Node on Windows machine
Driver: Selenium-server-2.28.0.jar
Browser: Firefox V18.0.1
TestNG: 6

Test work perfectly well for some time and all of sudden i get this error 
Error: Session ID is null and all the testcases get skipped. when i try to reproduce it next time i wont get. 

My Observation is when some test method continuously fails due to assertion or Click not working then rest of the methods get skipped, and it is not getting session ID. 

Can some help in solving this issue

Thanks
Raghuram

Richard Lavoie

unread,
Jan 29, 2013, 6:17:24 AM1/29/13
to webd...@googlegroups.com
In your tests, after it fails do you close the browser to free this session ?

You might be running out of free slots for new sessions to be started, they will eventually be free after some time when grid will decides the inactivity timeout has occured, but it is not immediate.
--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webdriver+...@googlegroups.com.
To post to this group, send email to webd...@googlegroups.com.
Visit this group at http://groups.google.com/group/webdriver?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

venkata raghuram

unread,
Jan 29, 2013, 7:29:10 AM1/29/13
to webd...@googlegroups.com
I am calling tearDown method after every test method is run. In tearDown am closing the browser.

venkata raghuram

unread,
Jan 29, 2013, 7:30:26 AM1/29/13
to webd...@googlegroups.com
Example of my implementation

I have 4 test classes which internally have on average 5 test methods. I have 1 super class which the configuration related stuff.
All the 4 test classes are extended from this super class.

In Super class i have @ Before Methods (creating browser session) and @ After Methods(closing session)

In my XML
<suite name="Testsuite Name" thread-count="10" parallel="tests">
<parameter name="seleniumHost" value="xxx.xxx.xxx.xxx" />
<parameter name="seleniumPort" value="44444" />
<listeners>
<listener class-name="testnghelpers.CustomTestListener" />
<listener class-name="testnghelpers.MyReporter" />
</listeners>

<test verbose="2" name="firefox on WINDOWS" annotations="JDK">
<parameter name="browser" value="firefox" />
<parameter name="platform" value="WINDOWS" />
<classes>
   <class name="Testclass1" /> 
<class name="Testclass2" />
  <class name="Testclass3"/> 
<class name="Testclass4" /> 
</classes>
</test>

When one test method in one testclass got failed it takes screenshot and rest of the methods in that class and all other class executing after it are getting skipped.

Error Stack:
Session ID is null Build info: version: '2.29.0', revision: '58258c3', time: '2013-01-17 22:46:35' System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.6.0_35' Driver info: driver.version: RemoteWebDriver

org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:289) 
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:506) 
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548) 
at org.openqa.selenium.remote.RemoteExecuteMethod.execute(RemoteExecuteMethod.java:32) 
at org.openqa.selenium.remote.AddTakesScreenshot$1.invoke(AddTakesScreenshot.java:36) 
at org.openqa.selenium.remote.Augmenter$CompoundHandler.intercept(Augmenter.java:286) 
at org.openqa.selenium.remote.RemoteWebDriver$$EnhancerByCGLIB$$18c4290e.getScreenshotAs(<generated>) 
at com.xxxx.screenShot(TafSelenium.java:998) 
at com.xxxx.testnghelpers.CustomTestListener.afterInvocation(CustomTestListener.java:36) 
at org.testng.internal.invokers.InvokedMethodListenerInvoker$InvokeAfterInvocationWithoutContextStrategy.callMethod(InvokedMethodListenerInvoker.java:100) 
at org.testng.internal.invokers.InvokedMethodListenerInvoker.invokeListener(InvokedMethodListenerInvoker.java:62) 
at org.testng.internal.Invoker.runInvokedMethodListeners(Invoker.java:619) 
at org.testng.internal.Invoker.invokeMethod(Invoker.java:777) 
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901) 
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231) 
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127) 
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111) 
at org.testng.TestRunner.privateRun(TestRunner.java:767) 
at org.testng.TestRunner.run(TestRunner.java:617) 
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334) 
at org.testng.SuiteRunner.access$000(SuiteRunner.java:37) 
at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:368) 
at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64) 
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) 
at java.util.concurrent.FutureTask.run(FutureTask.java:138) 
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 
at java.lang.Thread.run(Thread.java:662) 

My requirement :
So if one testmethod fails it should run rest of the testmethods in current class and rest of the classes

Richard Lavoie

unread,
Jan 29, 2013, 7:44:39 AM1/29/13
to webd...@googlegroups.com
The problem might also be the fact that the browser is closed when you take the screenshot ? Have you traced the execution to see what happens ?

R.
--

Richard Lavoie

unread,
Jan 29, 2013, 7:43:10 AM1/29/13
to webd...@googlegroups.com
I have no idea what happens with testng if a runtime exception is thrown in a test listener.  Would you mind trying to put a try catch when you take a screenshot ?

And I think you can get the screenshot from the selenium exception directly instead of taking one yourself (to be validated, but te selenium project tests does that afaik)

R.

On 2013-01-29, at 07:30, venkata raghuram <raghu...@gmail.com> wrote:

--
Reply all
Reply to author
Forward
0 new messages