Parallel run with same session id and sharing itestContext between multiple test

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

Parallel run with same session id and sharing itestContext between multiple test

garvitagirotraev
Hi,

I am having following doubts :

1. Running test in parallel with same session id :

Currently my driver is instantiated in Base class constructor and login parameters are given runtime in @BeforeTest method.  

 public  static WebDriver driver = null;

  public Base() throws IllegalArgumentException, IOException {
       if (driver == null) {
                                       driver = new ChromeDriver(capabilities);
                                   }

@Parameter({ "url", "username", "password" })  // run time parameters
@BeforeTest
       private void init(String url, String Username, String Password)
          {
            // login to site
          }

Requirement : i want to run test in parallel. As driver = new ChromeDriver() will open a new session, is there a way that every instance of browser opens with same session that is logged in. So that i dont have to hit url and login again and again. Browser opens with home page and i can continue my user story.

2. Sharing iTestContext between multiple <test> tags :
As scope of iTestContext is within same <test> tag, is there a way i can extend this to multiple <test> tags.


Thanks !!

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Parallel run with same session id and sharing itestContext between multiple test

Krishnan Mahadevan

Work with ISuite. That is the same object that is shared by two or more ITestContext objects.

 

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

Reply-To: <[hidden email]>
Date: Wednesday, April 18, 2018 at 9:46 AM
To: testng-users <[hidden email]>
Subject: [testng-users] Parallel run with same session id and sharing itestContext between multiple test

 

Hi,

 

I am having following doubts :

 

1. Running test in parallel with same session id :

 

Currently my driver is instantiated in Base class constructor and login parameters are given runtime in @BeforeTest method.  

 

 public  static WebDriver driver = null;

 

  public Base() throws IllegalArgumentException, IOException {

       if (driver == null) {

                                       driver = new ChromeDriver(capabilities);

                                   }

 

@Parameter({ "url", "username", "password" })  // run time parameters

@BeforeTest

       private void init(String url, String Username, String Password)

          {

            // login to site

          }

 

Requirement : i want to run test in parallel. As driver = new ChromeDriver() will open a new session, is there a way that every instance of browser opens with same session that is logged in. So that i dont have to hit url and login again and again. Browser opens with home page and i can continue my user story.

 

2. Sharing iTestContext between multiple <test> tags :

As scope of iTestContext is within same <test> tag, is there a way i can extend this to multiple <test> tags.

 

 

Thanks !!

 

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
[hidden email].
To post to this group, send email to
[hidden email].
Visit this group at
https://groups.google.com/group/testng-users.
For more options, visit
https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Parallel run with same session id and sharing itestContext between multiple test

garvita girotra
Thanks !!

On Wednesday, April 18, 2018 at 9:48:11 AM UTC+5:30, Krishnan Mahadevan wrote:

Work with ISuite. That is the same object that is shared by two or more ITestContext objects.

 

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;">http://wakened-cognition.blogspot.com/

My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;">http://rationaleemotions.wordpress.com/

Reply-To: <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="GsaFGk_FBgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng...@...>
Date: Wednesday, April 18, 2018 at 9:46 AM
To: testng-users <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="GsaFGk_FBgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng...@...>
Subject: [testng-users] Parallel run with same session id and sharing itestContext between multiple test

 

Hi,

 

I am having following doubts :

 

1. Running test in parallel with same session id :

 

Currently my driver is instantiated in Base class constructor and login parameters are given runtime in @BeforeTest method.  

 

 public  static WebDriver driver = null;

 

  public Base() throws IllegalArgumentException, IOException {

       if (driver == null) {

                                       driver = new ChromeDriver(capabilities);

                                   }

 

@Parameter({ "url", "username", "password" })  // run time parameters

@BeforeTest

       private void init(String url, String Username, String Password)

          {

            // login to site

          }

 

Requirement : i want to run test in parallel. As driver = new ChromeDriver() will open a new session, is there a way that every instance of browser opens with same session that is logged in. So that i dont have to hit url and login again and again. Browser opens with home page and i can continue my user story.

 

2. Sharing iTestContext between multiple <test> tags :

As scope of iTestContext is within same <test> tag, is there a way i can extend this to multiple <test> tags.

 

 

Thanks !!

 

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
<a href="javascript:" target="_blank" gdf-obfuscated-mailto="GsaFGk_FBgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng-users+unsubscribe@googlegroups.com.
To post to this group, send email to
<a href="javascript:" target="_blank" gdf-obfuscated-mailto="GsaFGk_FBgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng-users@....
Visit this group at
<a href="https://groups.google.com/group/testng-users" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;">https://groups.google.com/group/testng-users.
For more options, visit
<a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.