Issues in running tests parallel

64 views
Skip to first unread message

Salut

unread,
Oct 9, 2012, 6:07:27 AM10/9/12
to testng...@googlegroups.com
Hi All, Below is my code snippet of the suite. I am trying to execute my suite in parallel in 2 different browsers. The instances of those two browsers starts but the test case doesnt succeed.


<suite name="BATest" verbose="2" parallel="tests" thread-count="2">
<test name="BATests chrome"  preserve-order="true"  >
      <parameter name="browser" value="chrome"></parameter>
      <groups>      <dependencies>      ........................      </dependencies>     </groups>
         
                <classes>                  .........................                  </class>     </classes>
           
      </test>
<test name="BATests chrome"  preserve-order="true"  >
      <parameter name="browser" value="chrome"></parameter>
      <groups>      <dependencies>      ........................      </dependencies>     </groups>
         
                <classes>                  .........................               </class>                                </classes>
           
      </test>
</suite>


ERROR:
============
WARNING: WebDriverException thrown by findElement(By.id: sender_name)
org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died.

I am passing the browser parameter to @BeforeClass method which initializes my driver.

@BeforeClass
    @Parameters(value = { "browser" })
    public void signInUser(@Optional String browser)
{ initWebDriver(browser); }


private void initWebDriver(String browser) {
 if (browser.equalsIgnoreCase("ff") this.driver = new FirefoxDriver(capabilities);
else if (browser.equalsIgnoreCase("chrome"))  driver = new RemoteWebDriver(service.getUrl(), capabilities);
}

Please let me know where i am going wrong.

Manoj Kapuganti

unread,
Oct 9, 2012, 1:38:15 PM10/9/12
to testng...@googlegroups.com
Try to declare driver outside @BeforeTest

WebDriver driver;

@BeforeClass 
    @Parameters(value = { "browser" })
    public void signInUser(@Optional String browser)
{ initWebDriver(browser); }


private void initWebDriver(String browser) { 
 if (browser.equalsIgnoreCase("ff") driver = new FirefoxDriver(capabilities);

else if (browser.equalsIgnoreCase("chrome"))  driver = new RemoteWebDriver(service.getUrl(), capabilities);
}

Best Regards,
Manoj Kapuganti

Salut

unread,
Oct 10, 2012, 12:18:13 AM10/10/12
to testng-users
Hi Manoj, It is already declared outside.
> *Best Regards,*
> *Manoj Kapuganti*

Balendra

unread,
Oct 17, 2012, 11:20:48 PM10/17/12
to testng...@googlegroups.com
dsaadxxx,canvasscfcddam,,fccbadxxx

Ravi Gupta <canceri...@gmail.com> wrote:

>
>Hi Salut,
>
>This things happens when you are trying to forcefully/manually closing the
>browser and again starting the test. In this generally this issue comes.
>
>Probably what needs to be done also if when you are trying to close the
>browser after executing .. donot quit the browser manually but close the
>driver session.
>
>Here s the algo for it ..
>
>If (testcase complete)
>{
>
>close the driver session as driver.close();
>
>instead closing the User Interface page (like UI.close(): )
>
>}
>
>Hope you understood..
>
>ravi

>--
>You received this message because you are subscribed to the Google Groups "testng-users" group.
>To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/dvbmHXIom30J.
>To post to this group, send email to testng...@googlegroups.com.
>To unsubscribe from this group, send email to testng-users...@googlegroups.com.
>For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
>

Reply all
Reply to author
Forward
0 new messages