Invalid use of SingleClientConnManager: connection still allocated when running test parallely

32 views
Skip to first unread message

Rajesh

unread,
Dec 13, 2011, 10:56:19 AM12/13/11
to webdriver
Hi All,

I am trying to run simple login test into our website.
Im using testng 6.3 and Selenium 2.11.0. If i run test in single
browser, it runs fine but when run in chrome and firefox together , it
failed sometimes in firefox and sometimes in both. Sometime it leads
to failure of other tests with same message.
Stack trace:
java.lang.IllegalStateException: Invalid use of
SingleClientConnManager: connection still allocated.
Make sure to release the connection before allocating another one.
at
org.apache.http.impl.conn.SingleClientConnManager.getConnection(SingleClientConnManager.java:
216)
at org.apache.http.impl.conn.SingleClientConnManager
$1.getConnection(SingleClientConnManager.java:190)
at
org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:
401)
at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:
820)
at
org.openqa.selenium.remote.HttpCommandExecutor.fallBackExecute(HttpCommandExecutor.java:
272)
at
org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:
252)
at
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:
385)
at
org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:
193)

code snip shot:
public class Login_FunctionalTest extends BaseTest {

@Test
public void test_homepage_login() throws Exception {
System.out.println("Login Test - Login and Logout from
Homepage");
home.homePage();
login.signIn(UserName,UserPwd);
login.signOut();
}
}

My BaseTest class contains some initialization stuff.
e.g. UserName,UserPwd defined there

testng.xml
###############
<suite name="Browser Compatibility Test" verbose="2" parallel="tests"
thread-count="5">
<test name="Run tests inside class on firefox">
<parameter name="browser" value="firefox" />
<classes>
<class name="functional.webtests.Login_FunctionalTest"/
>
<methods>
<include name="test_homepage_login"/>
</methods>
</classes>
</test>
<test name="Run tests inside class on Chrome">
<parameter name="browser" value="chrome" />
<classes>
<class name="functional.webtests.Login_FunctionalTest"/>
<methods>
<include name="test_homepage_login"/>
</methods>
</classes>
</test>
</suite>

Reply all
Reply to author
Forward
0 new messages