Parallel testing on multiple Virtual Machine using selenium webdriver

5,810 views
Skip to first unread message

Payal Gupta

unread,
May 1, 2012, 12:13:55 PM5/1/12
to
Has anyone done parallel testing on a particular browser in multiple machine.
I am using Selenium webdriver and selenium 2.19 jar to distrivbute the execution of tets cases on multiple machine for a particulra browser.

Steps I have performed for parallel execution on IE are:

1. Launched IE browser on different VMs by listing the VMs as nodes to the Hub at different ports. We have verified the different port connection from Grid Console.
2. Pointed my local framework to Hub and started the execution through maven command on the local machine which hits the “hub” through the code.

Following is the exception I get : 

 

 T E S T S
-------------------------------------------------------
Running TestSuite
## running Internet Explorer 8 automation
-Denvironment -->QA
-Dscope -->FULL
org.openqa.selenium.WebDriverException: Error forwarding the new session cannot find : {platform=WINDOWS, ensureCleanSes
orer, version=8}
Command duration or timeout: 1.35 seconds
Build info: version: '2.19.0', revision: '15848', time: '2012-02-08 16:25:03'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_31'
Driver info: driver.version: RemoteWebDriver

        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:170)
        at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:123)

Krishnan Mahadevan

unread,
May 1, 2012, 10:47:53 PM5/1/12
to webd...@googlegroups.com
Payal,
This post that I wrote up should help you answer your question. 

--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.


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

Payal Gupta

unread,
May 2, 2012, 5:04:41 AM5/2/12
to webd...@googlegroups.com
Hi Krishnan,

Thanks for the response . The document was helpful in understanding how Grid works and connect with different ports.

What I have done is, I have started two listeners on two different machines using below mentioned commands :

java -jar selenium-server-standalone-2.19.0.jar -role webdriver -hub http://localhost:4444/grid/register -port 5557 -browser "browserName=internet explorer,maxSession=5,version=8,maxInstances=5,platform=WINDOWS"

java -jar selenium-server-standalone-2.19.0.jar -role webdriver -hub http://localhost:4444/grid/register -port 5558 -browser "browserName=internet explorer,maxSession=5,version=8,maxInstances=5,platform=WINDOWS"

I have a class created where I pass following parameters as arguments to decide on which platform/browser/version I have to execute.

mvn test -Dtest=TestInternetExplorer -Dscope=full -Denvironment=QA

sort of this :

public class TestInternetExplorer {
@Test
public void version8() throws Exception {
Thread.sleep(Long.parseLong("500"));
RunTestScenario scenario = new RunTestScenario();
System.out.println("## running Internet Explorer 8 automation");
scenario.runScenario(Global.INTERNET_EXPLORER,"8","WINDOWS","username");
}
@Test
public void version8new() throws Exception {
Thread.sleep(Long.parseLong("1000"));
RunTestScenario scenario = new RunTestScenario();
System.out.println("## running Internet Explorer 8 automation");
scenario.runScenario(Global.INTERNET_EXPLORER,"8","WINDOWS","username2");
}
}
I expect it to launch and start execution in both the machines and distribute test cases. But it is not working properly.
Am I missing something ?

Krishnan Mahadevan

unread,
May 2, 2012, 6:17:47 AM5/2/12
to webd...@googlegroups.com
You are yet to show me how are you forming your DesiredCapabilities object. That is where the key lies.

Thanks & Regards
Krishnan Mahadevan

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


Payal Gupta

unread,
May 2, 2012, 7:14:33 AM5/2/12
to webd...@googlegroups.com
Hi Krishnan,

     if (strBrowser.contains(Global.INTERNET_EXPLORER)) { 
 capability = DesiredCapabilities.internetExplorer(); capability.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
 }

Along with this I set version and platform.

capability.setVersion(strVersion);
public void setPlatform(String strPlatform) {

this.strPlatform = strPlatform;
    
if (this.strPlatform.compareToIgnoreCase("WINDOWS") == 0){
capability.setCapability(CapabilityType.PLATFORM, Platform.WINDOWS);
    }
    if (this.strPlatform.compareToIgnoreCase("XP") == 0){
capability.setCapability(CapabilityType.PLATFORM, Platform.XP);
    }
    if (this.strPlatform.compareToIgnoreCase("VISTA") == 0){
capability.setCapability(CapabilityType.PLATFORM, Platform.VISTA);
    }
    if (this.strPlatform.compareToIgnoreCase("MAC") == 0){
capability.setCapability(CapabilityType.PLATFORM, Platform.MAC);
    }
}

Krishnan Mahadevan

unread,
May 2, 2012, 7:37:39 AM5/2/12
to webd...@googlegroups.com
Payal,
On first look, everything looks fine.
Have you tried opening up the Grid console, do a mouse move over on the IE icon and cross check if it shows

platform=WINDOWS, version=8, browserName=internet explorer ?

P.S : With IE, you are better off running the max instance as 1 especially if you are NOT WORKING WITH .NET client bindings, because concurrent runs for IE wont work as expected if you are spawning more than 1 instance of IE on the same node, because IE works on shared memory, so your sessions are likely to be shared leading to unpredictable results.

Thanks & Regards
Krishnan Mahadevan

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



Payal Gupta

unread,
May 2, 2012, 8:26:22 AM5/2/12
to webd...@googlegroups.com
Inline image 1

Hi Krishnan,

I have pasted the screenshot for my grid console.
image.png

Jim Evans

unread,
May 2, 2012, 9:41:41 AM5/2/12
to webd...@googlegroups.com
This shows your problem, right there. You've specified that you can have multiple IE sessions on a single node. This is not supported by the Java bindings at present, and if you're using Grid, you're using the Java bindings. You need to set your nodes so that only one session of IE is allowed at one time.


On Wednesday, May 2, 2012 8:26:22 AM UTC-4, payal wrote:
Inline image 1

Hi Krishnan,

I have pasted the screenshot for my grid console.

To unsubscribe from this group, send email to webdriver+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.


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

--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.

--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.

--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.

--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.

--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+unsubscribe@googlegroups.com.

Krishnan Mahadevan

unread,
May 2, 2012, 9:45:48 AM5/2/12
to webd...@googlegroups.com
Jim,
Ah! ok. Am glad I did mention that to Payal, in one of my previous responses, but didnt know the actual reason behind it.
I did know that multiple sessions on IE wont work, but didnt know that Grid would react that way when it was asked to allot a webdriver node :) Was a good learning! 


Thanks & Regards
Krishnan Mahadevan

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



To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/yauXBYj7cCsJ.

To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+...@googlegroups.com.

Mike Riley

unread,
May 2, 2012, 11:47:16 AM5/2/12
to webd...@googlegroups.com
I would also point out that there is no need to use different ports for each VM, because they are on separate systems.  You would only need to use a different port if you ran more than one node on the same system/VM.

I do that on my systems so my tests run on a "stable" version of Selenium, but so I can test with newer (or older) versions of Selenium to see if a different version fixes issues I may have run into within Selenium.

My servers get started from within a batch file that is run by Task Manager, so using the same port makes it much easier to use a single common batch file.

Mike

Payal Gupta

unread,
May 3, 2012, 2:07:58 AM5/3/12
to webd...@googlegroups.com
Hi James/Krishnan/Mike,

Thank you for your responses. As suggested, I have started only one node in the hub in each VM
The changes which I do to point my local to hub is.
Change in system property : 

and I just execute this command from my local 
mvn test -Dtest=TestInternetExplorer -Dscope=FULL -Denvironment=QA

public class TestInternetExplorer {
@Test
public void version8() throws Exception {
Thread.sleep(Long.parseLong("500"));
RunTestScenario scenario = new RunTestScenario();
System.out.println("## running Internet Explorer 8 automation");
scenario.runScenario(Global.INTERNET_EXPLORER,"8","WINDOWS","username");
}
@Test
public void version8new() throws Exception {
Thread.sleep(Long.parseLong("1000"));
RunTestScenario scenario = new RunTestScenario();
System.out.println("## running Internet Explorer 8 automation");
scenario.runScenario(Global.INTERNET_EXPLORER,"8","WINDOWS","username2");
}
@Test
public void version9() throws Exception {
Thread.sleep(Long.parseLong("2000"));
RunTestScenario scenario = new RunTestScenario();
System.out.println("## running Internet Explorer 9 automation");
scenario.runScenario(Global.INTERNET_EXPLORER,"9", "WINDOWS","username3");
}
@Test
public void version7() throws Exception {
Thread.sleep(Long.parseLong("3000"));
RunTestScenario scenario = new RunTestScenario();
System.out.println("## running Internet Explorer 7 automation");
scenario.runScenario(Global.INTERNET_EXPLORER,"7", "XP","username4");
}*/
}
Here in different methods, I explcitly pass versions and platform as parameters. and I expect it to redirect to the respective listener.
Is is that I just need to use only 1 method in this class to distribute the test cases or should I not pass versions and platform as parameters, because I want the execution to happen in all the machine.
Say if I have 100 test cases, I want eqach VM to execute 25 TCs simultaneoulsy.
I am not sure if it the connection issue from my local to the hub.
Please suggest if you have any resolutions. I am very new to Selenium webdriver and dont have much idea on this.

Grid Console snapshot :

Inline image 1

To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/n4KhgQlZVfQJ.

To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+...@googlegroups.com.
image.png

Mike Riley

unread,
May 3, 2012, 11:51:19 AM5/3/12
to webd...@googlegroups.com
Try using the debug URL for viewing the Grid info to get more info:
http://10.0.2.208:4444/grid/console?config=true&configDebug=true

As to running 25 test cases simultaneously in each VM you have to remember one thing: The code being executed to run those TCs is actually running in your system under Maven.  So 25 TCs times 4 VMs works out to be at least 100 threads (probably a bit more) running code on your system under Maven.  So that would be a lot of resources.

However, likely most of those threads would be waiting to get at the remote server through the grid, because you only have 3 IE and 5 FF seesions that can be run at a time.  So they end up stacking up like queued print jobs until the resource they need is available.  You can't using the same Selenium session to run multiple threads through to a remote server at once, because it is not thread safe in that way.

Just keep those caveats in mind when trying to do multi-threaded jobs so you know what can and can't be done with them.

Mike

Payal Gupta

unread,
May 3, 2012, 12:26:53 PM5/3/12
to webd...@googlegroups.com
Thanks Mike..
Snapshot of grid console which I shared here is just for 4 VMs. I can add 2 more VMs..means it will be in all 6 listeners for IE

FF works well with distributed testing on only 1 VM with multiple browsers.

I am facing this issues only for IE. So actually my question is, if the code which I have shared has any loophole which I am not able to find out, because somehow it is not connecting to all the listeners at once.

I have used multithreading in case of parallel browser testing for 1 VM but I am not sure ,is the same multithreading approach will work for multiple VMs as well.

I am really stuck on this issue, so your any help is much appreciated.

To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/L0_Ui0rv2esJ.

To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+...@googlegroups.com.

Mike Riley

unread,
May 3, 2012, 12:40:28 PM5/3/12
to webd...@googlegroups.com
At the moment I have been using single-threaded TestNG execution, so I really can't speak to this as my knowledge is mostly on theory side from what I have read here.

Assuming you have a test suite of three test cases, just as an example.  You can have it run multiple simultaneous versions of that suite against the various IE remote nodes, but the test cases within the suite must run one at a time.

If you want to allow for more suites running at the same time you can do that by having multiple remote server nodes on each VM to increase how many can run in parallel.  Say you wanted to create 5 node per VM, you could have each node use a different port so that the grid can control each one using the separate ports.

One issue you can run into with this, assuming you are doing performance or load  testing, is that the grid server may be a bottleneck to getting full performance with so many jobs running at the same time.  So you may need to consider having 5 remote nodes with 5 grid servers to get maximum speed.  I am not sure at what point it would be a bottleneck, but it is something to consider and experiment with to see how it works for your situation.

I would be interested in hearing other people real world experience using Selenium for such performance/load testing to see what they have found, because it the future I will be running multiple test suites through a grid server in parallel and I would like to know what to expect.

Mike

Krishnan Mahadevan

unread,
May 3, 2012, 9:17:40 PM5/3/12
to webd...@googlegroups.com
Payal,
Grid picks up a node for execution based on:
1.  Browser name
2.  Platform
3.  Version

So if your tests are combining all of these three then you will hit the intended node only. 

For e.g.,
Lets say you have

IE 8 on Windows 7
IE 6 on Windows 7
IE 9 on Windows 7

And you have 2 tests which request only for IE then they can be executed in any of the nodes. 

Grid really doesnt care if you are running sequentially or in parallel. 

As long as it has free nodes to which it can fwd ur rqst it would do so and when there are no free nodes you rqst sits in a wait queue. 

So the only way for you to achieve speediness in execution w.r.t IE is bump up the number of VMs (or) instead of asking specifically for IE 8 on Windows 7 i.e., instead of combining browser name + platform + version stick to using just browser name (assuming all that u care abt is IE executions and not version specific)

With IE there is only so much you can go. 
To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/cP1ouAZ1P3IJ.

To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.

Payal Gupta

unread,
May 4, 2012, 1:30:22 AM5/4/12
to webd...@googlegroups.com
Okay..so I have bow modified my code to just pass parameters for Browser name,platform and username. I am not specifically passing any versions.

public class TestInternetExplorerVM {
 //VMRunTestScenario scenario = new VMRunTestScenario();

@Test
public void version8() throws Exception {
//Thread.sleep(Long.parseLong("1000"));
VMRunTestScenario scenario = new VMRunTestScenario();
System.out.println("## running Internet Explorer 8 automation");
scenario.runScenarioVM(Global.INTERNET_EXPLORER, "WINDOWS" , " username ");
}
@Test
public void version82() throws Exception {
Thread.sleep(Long.parseLong("1000"));
VMRunTestScenario scenario = new VMRunTestScenario();
System.out.println("## running Internet Explorer 8 automation");
scenario.runScenarioVM(Global.INTERNET_EXPLORER, "WINDOWS" ," username1");
}



@Test
public void version9() throws Exception {
Thread.sleep(Long.parseLong("1500"));
VMRunTestScenario scenario = new VMRunTestScenario();
System.out.println("## running Internet Explorer 9 automation");
scenario.runScenarioVM(Global.INTERNET_EXPLORER, "WINDOWS" ," username2");
}
@Test
public void version7() throws Exception {
Thread.sleep(Long.parseLong("2000"));
VMRunTestScenario scenario = new VMRunTestScenario();
System.out.println("## running Internet Explorer 7 automation");
scenario.runScenarioVM(Global.INTERNET_EXPLORER, "XP" , " username3");
}

}

Inline image 1

Question:

Will this distribute my test suite(100 TCs) among all the active listeners ?
I am using selenium 2.15 jar to start the nodes , but my hub is using selenium 2.19. Can this be a jar issue ? should I be using the updated one(2.21) ?
Are there any limitations on how many VMs can be supported at a time ?

My main purpose is to achieve the distribution of test suite across VMs for IE (3 or more).

thanks in advance..

--
You received this message because you are subscribed to the Google Groups "webdriver" group.
image.png

Krishnan Mahadevan

unread,
May 4, 2012, 1:33:59 AM5/4/12
to webd...@googlegroups.com
Payal,
Comments in line to your queries.

Thanks & Regards
Krishnan Mahadevan

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



Yes it should.
 
I am using selenium 2.15 jar to start the nodes , but my hub is using selenium 2.19. Can this be a jar issue ? should I be using the updated one(2.21) ?
Not sure if there are any real implications but you are better off having both the hub and the nodes running on the same version. I rely on 2.21 for that.
 
Are there any limitations on how many VMs can be supported at a time ?

None that I am aware of. 
image.png

Mike Riley

unread,
May 4, 2012, 1:44:29 AM5/4/12
to webd...@googlegroups.com
I have had the need to try that a week back and using a 2.21.0 hub with a 2.14.0 node seemed to work fine with my tests.  For the most part I doubt that the communication from hub to node really changed, it is likely just forwarding on what you send from the Java Client library using the RemoteWebDriver or RC classes.

YMMV

When in doubt, use a hub of the same revision to be safest.

Mike
To unsubscribe from this group, send email to webdriver+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.

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

--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.

--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+unsubscribe@googlegroups.com.

Payal Gupta

unread,
May 4, 2012, 5:37:22 AM5/4/12
to webd...@googlegroups.com
I used same jar to launch hub and nodes(2.19 in my case)
But still with the above mentioned code, I am able to launch IE browser only in the first VM.

To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/S3fNAd75UacJ.

To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+...@googlegroups.com.

Krishnan Mahadevan

unread,
May 4, 2012, 5:40:54 AM5/4/12
to webd...@googlegroups.com
Can you get rid of " maxSession=5 " from your node startup command ?

If your Node is only going to service 1 instance of IE, then I think you are better off stating that by using maxSession=1 


Thanks & Regards
Krishnan Mahadevan

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



Payal Gupta

unread,
May 4, 2012, 5:44:27 AM5/4/12
to webd...@googlegroups.com
yeah got rid of that long back after your initial responses..
Now I am using following command :

java -jar selenium-server-standalone-2.19.0.jar -role node -hub http:/#############:4444/grid/register -port 5600 -browser "browserName=internet explorer,maxSession=1,maxInstances=1,platform=WINDOWS"

Krishnan Mahadevan

unread,
May 4, 2012, 5:45:43 AM5/4/12
to webd...@googlegroups.com
Just to get some clarity, so what issue are you facing now Payal ? Pardon me, but I kinda got lost

Is it that you cant launch the IE browser at all, or something else ? 


Thanks & Regards
Krishnan Mahadevan

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



Payal Gupta

unread,
May 4, 2012, 6:07:43 AM5/4/12
to webd...@googlegroups.com
I have 4 VMs :
Win 7 - IE9
Win 7 - IE8
Win 7 - IE8
Win XP - IE7

I have a test suite of 100 test cases..

To distribute the load across all the virtual machines for IE, i want to distribute the test suite to all the virtual machines(in ths case , it will be 25 each)

I want simultaneous execution in all the Virtual Machines.

Commands I am using in all the 4 VMs are as : I have tried with and without property "version=9" in the command

Windows7 :
java -jar selenium-server-standalone-2.19.0.jar -role node -hub http://###########:4444/grid/register -port 5600 -browser "browserName=internet explorer,maxSession=1,maxInstances=1,platform=WINDOWS"

java -jar selenium-server-standalone-2.19.0.jar -role node -hub http://###########:4444/grid/register -port 5600 -browser "browserName=internet explorer,maxSession=1,maxInstances=1,platform=WINDOWS"

java -jar selenium-server-standalone-2.19.0.jar -role node -hub http://###########:4444/grid/register -port 5600 -browser "browserName=internet explorer,maxSession=1,maxInstances=1,platform=WINDOWS"

WindowsXP
java -jar selenium-server-standalone-2.19.0.jar -role webdriver -hub http://###########:4444/grid/register -port 5600 -browser "browserName=internet explorer,maxSession=1,maxInstances=1,platform=XP"

Maven command execute locally for execution :

mvn test -Dtest=TestInternetExplorerVM  -Dscope=full -Denvironment=QA

Code : I am here using 4 methods, where I explicitly pass browser and username. I expect this class to launch four IE browsers in 4 VMs simultaneously and execute 25 TCs each. In this class only I expect the distribution to take place via multithreading.

public class TestInternetExplorerVM {
@Test
public void version8() throws Exception {
//Thread.sleep(Long.parseLong("1000"));
VMRunTestScenario scenario = new VMRunTestScenario();
System.out.println("## running Internet Explorer 8 automation");
scenario.runScenarioVM(Global.INTERNET_EXPLORER, "username");
}
@Test
public void version82() throws Exception {
Thread.sleep(Long.parseLong("2000"));
VMRunTestScenario scenario = new VMRunTestScenario();
System.out.println("## running Internet Explorer 8 automation");
scenario.runScenarioVM(Global.INTERNET_EXPLORER,"username1");
}



@Test
public void version9() throws Exception {
Thread.sleep(Long.parseLong("3000"));
VMRunTestScenario scenario = new VMRunTestScenario();
System.out.println("## running Internet Explorer 9 automation");
scenario.runScenarioVM(Global.INTERNET_EXPLORER,"username2");
}
@Test
public void version7() throws Exception {
Thread.sleep(Long.parseLong("4000"));
VMRunTestScenario scenario = new VMRunTestScenario();
System.out.println("## running Internet Explorer 7 automation");
scenario.runScenarioVM(Global.INTERNET_EXPLORER , "username3");
}

}

I an not sure , it the above code will distribute the test cases across VM, because right now, it just starts execution on only 1 VM.

Krishnan Mahadevan

unread,
May 4, 2012, 6:15:44 AM5/4/12
to webd...@googlegroups.com
Umm.. and how are you ensuring that tests are being executed in parallel ? It would help if you shared that info as well (Just to rule out the possibility of your tests being spawned serially in the first place)


Thanks & Regards
Krishnan Mahadevan

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


Payal Gupta

unread,
May 4, 2012, 6:18:54 AM5/4/12
to webd...@googlegroups.com
I am actually stuck in this part itself. That is what my question is how to run test cases in parallel(across VMs).

As per me, the code I have shared,  should do that task. but unfortunately, it is just able to launch the execute on only 1 VM and starts executing complete test suite on that VM only.

Other VMs are not getting any TCs to execute,,

Krishnan Mahadevan

unread,
May 4, 2012, 6:26:38 AM5/4/12
to webd...@googlegroups.com
Ah! So you would basically first need to take care of introducing parallelism to begin with.

Am assuming you are using TestNG.

Here's how you do it using TestNG.

You choose all of your classes that you want(multiple selection can be acheived using shift + click or alt + click), right click them and then select convert to TestNG. That should help you get a suite file created.

Once you have the suite file, then you can choose how you want to drive your parallel execution by choosing methods/classes/tests/instances.

For confirmation sake, you can also try and print the Thread ID for each method/class and ensure that you see different values.


Thanks & Regards
Krishnan Mahadevan

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



Payal Gupta

unread,
May 4, 2012, 6:35:43 AM5/4/12
to webd...@googlegroups.com
we run just a single class and we have different methods in that...we fetch our test suite from rally..

I am looking for an approach without any changes to testNG file, because we want to execute the same from Server end/Jenkins.

Isn't there any alternative way to distribute test suite ?

SANTHOSH BABY

unread,
May 4, 2012, 7:31:53 AM5/4/12
to webd...@googlegroups.com
Hi Payal Gupta, 

Rule is simple  for grid functionalty 
If You feed the Grid with Parallel Work , It does parallel job for you 
If you feed Sequential Job it does one job at a time 

Here you are only creating parallel environment at the grid side
But you are feeding only one job at a time ..
 

Enjoy Coding 

Thank you
Cheers.

Santhosh Baby

Santhosh Software Automation  Engineer
 



Think GREEN. Please consider the environment before printing this email

"When The Winds of Change Blow..... Some people Build Walls & Others Windmills.... Attitude Matters...."
image001.gif

SANTHOSH BABY

unread,
May 4, 2012, 7:36:11 AM5/4/12
to webd...@googlegroups.com
Parallel grid execution topic has been answered  in this forum  and solution is also given  by the person who had this doubt after a long a chain of discussion . Kindly have a check of it 

refer this link 



Thank you
Cheers.

Santhosh Baby

Santhosh Software Automation  Engineer
 



Think GREEN. Please consider the environment before printing this email

"When The Winds of Change Blow..... Some people Build Walls & Others Windmills.... Attitude Matters...."



image001.gif
image001.gif

Krishnan Mahadevan

unread,
May 4, 2012, 9:46:06 PM5/4/12
to webd...@googlegroups.com
Payal,
We need to see your suite xml file. If all of your suites contain just one class but has multiple test methods then you would basically set parallel="methods". 

Without modifying your suite file I dont think you can go anywhere unless and until you are spawning TestNG tests via your own TestRunner. 
--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.


--

Payal Gupta

unread,
May 5, 2012, 12:59:21 AM5/5/12
to webd...@googlegroups.com

I am using Junits to execute the test..
is it possible with junits to do the parallel executiin on multiple VMs?

Krishnan Mahadevan

unread,
May 5, 2012, 1:08:53 AM5/5/12
to webd...@googlegroups.com
I presume you can do it in JUnit as well but unfortunately I know only TestNG. 

Perhaps someone else well versed in JUnit can help you. 

Danny Guerrier

unread,
May 5, 2012, 9:08:48 AM5/5/12
to webd...@googlegroups.com

That should give you some ways to parameterize your junit tests. 

Payal Gupta

unread,
May 10, 2012, 8:21:59 AM5/10/12
to webd...@googlegroups.com
Hi Krishnan,

I have modified a sample class in my framework to testng. It looks like :

import org.testng.annotations.Test;

public class TestInternetExplorer {

  
    RunTestScenario scenario = new RunTestScenario();
   
    @Test
    public void version7() throws Exception{
        System.out.println("## running Internet Explorer 7 automation");
        scenario.runScenario(Global.INTERNET_EXPLORER,"username");
    }
    @Test
    public void version8()throws Exception {

        System.out.println("## running Internet Explorer 8 automation");
        scenario.runScenario(Global.INTERNET_EXPLORER,"username");
    }
@Test
    public void version9() throws Exception{

        System.out.println("## running Internet Explorer 9 automation");
        scenario.runScenario(Global.INTERNET_EXPLORER,"username");
    }
}

testng.xml :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite thread-count="3" name="Suite" parallel="methods">
  <test name="Test" preserve-order="true">
    <classes>
      <class name="##################.TestInternetExplorer"/>
    </classes>
  </test> <!-- Test -->
</suite> <!-- Suite -->

It is not distributing the test cases.I am assuming the distribution happens at run time.
One other question is, as now I have modified this class for testng...can I also use maven command to run the execution and what changes will be required in pom.xml to read testng.xml ?

Also please share any good reference material which I can refer for distribution.

Krishnan Mahadevan

unread,
May 10, 2012, 8:27:18 AM5/10/12
to webd...@googlegroups.com
preserve-order=true and parallel tags AFAIK dont go well together.

If you do need parallelism to be enabled for your tests, you should get rid of preserve-order=true and set it to false.

In order for you to be able to run your tests via maven on the command line, you would need your pom file to be enhanced and refer to surefire-plugin.

Here's where you can get more information on this : http://maven.apache.org/plugins/maven-surefire-plugin/


Thanks & Regards
Krishnan Mahadevan

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


Pavithra

unread,
May 23, 2012, 10:29:32 AM5/23/12
to webd...@googlegroups.com
Payal, did you got the way out now to distribute your tests in different platforms or browsers ?
We are distributing our tests in different platform-browser combination.
If you still not got the way, I can explain the things.

Thanks
Pavithra

>> To unsubscribe from this group, send email to webdriver+unsubscribe@googlegroups.com.


>> For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.
>
>
>
> --
> 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/
>
> --
> You received this message because you are subscribed to the Google Groups "webdriver" group.
> To post to this group, send email to webd...@googlegroups.com.

> To unsubscribe from this group, send email to webdriver+unsubscribe@googlegroups.com.


> For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.

--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.

--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.

--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+unsubscribe@googlegroups.com.

unni

unread,
May 25, 2012, 4:59:02 AM5/25/12
to webd...@googlegroups.com
Hey Pavithra,

   If you can post the way you do it works for others. Please post here.

Payal Gupta

unread,
May 25, 2012, 5:04:56 AM5/25/12
to webd...@googlegroups.com
Hi Pavithra,

It will be great if you can explain , how you are achieving distribution at your end. 
Thank you !!

To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/UE60TeuQe8oJ.

To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+...@googlegroups.com.

Pawan Garia

unread,
May 25, 2012, 5:11:34 AM5/25/12
to webd...@googlegroups.com
Hi Pavithra, 

I am also trying to distribute my test's, so please explain the things ...

Thanks, 
Pawan 
--
Regards-

PAWAN GARIA

Reply all
Reply to author
Forward
0 new messages