Issues in running tests parallel

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Issues in running tests parallel

karthik
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.

--
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/-/bkCXGUEYVAAJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Issues in running tests parallel

Manoj Kapuganti
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

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Issues in running tests parallel

karthik
Hi Manoj, It is already declared outside.

On Oct 9, 10:38 pm, Manoj Kapuganti <[hidden email]> wrote:

> 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*

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

Reply | Threaded
Open this post in threaded view
|

Re: Issues in running tests parallel

Ravi Gupta

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
On Wednesday, 10 October 2012 09:48:18 UTC+5:30, Salut wrote:
Hi Manoj, It is already declared outside.

On Oct 9, 10:38 pm, Manoj Kapuganti <[hidden email]> wrote:

> 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*

--
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 [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Issues in running tests parallel

Balendra
In reply to this post by karthik
dsaadxxx,canvasscfcddam,,fccbadxxx

Ravi Gupta <[hidden email]> 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
>On Wednesday, 10 October 2012 09:48:18 UTC+5:30, Salut wrote:
>>
>> Hi Manoj, It is already declared outside.
>>
>> On Oct 9, 10:38 pm, Manoj Kapuganti <[hidden email]> wrote:
>> > 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*
>>
>
>--
>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 [hidden email].
>To unsubscribe from this group, send email to [hidden email].
>For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
>

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.