0

I have set up Selenium Grid 2 with one hub (on a high spec Dell 7910 Server , Windows) and 8 nodes (on VM's all are on Windows) and my test framework is on cucumber-jvm using Junit. I use Jenkins to kick of tests and build the project using maven..

Here is the example:

I have a 20 independent Maven Project jobs (Maven+Project+Plugin) in Jenkins and first 10 jobs are added to multiproject job A (Multijob+Plugin) and another 10 jobs to multiproject job B.

When I run the Job A the build is compiled successfully and the tests are routed to Hub and then in my observation I see that the tests are executed serially (if I'm correct ?)

When I see the Hub console the hub is detecting all 8 nodes as available but it only creates 2 session where the first Test is passed to Node 1 and second Test passed to Node 2 and the rest of the nodes (3-8) remain idle until the first two tests are completed or if any test is failed then the hub creates the new session to third node and the 3 test executes on Node3 and so on... this process continues until it executes the 8th Test on Node 8 after this is process is done hub executes the 9 test on node which is available which is obvious Node1 most of the cases.

According to my requirement, I want the hub to create 8 sessions and pass the requests to all 8 nodes at once so that my first 8 tests should execute on 8 different machines once they are completed then the next available node to execute the 9th test and so on.... And all my tests are browser specific they should be executed in IE only.

Hub and Nodes Configurations :

Hub:

cd c:\selenium-server java -jar selenium-server-standalone-2.45.0.jar -role hub -timeout 600 -browserTimeout 600 http://xx:xx:xx:xx/grid/register -port 4444

Node 1:

cd c:\selenium-server

java -jar selenium-server-standalone-2.45.0.jar -trustAllSSLCertificates -browser browserName="internet explorer",version=11,platform=WINDOWS,maxInstances=1 -Dwebdriver.ie.driver=c:\IEDriver\InternetExplorerDriver.exe -role node -hub http://pc-582v762:4444/grid/register -port 5555 -maxSession 1

Node 2,Node 3, Node 4 ...............Node 8 and the same node commands to the rest of the nodes

Note: I have replaced - role with 'webDriver' still the result is same and all the Virtual environment are Win7 and Win8 combinations

Hope I'm very clear with my question. Sorry for the mass info and I just want to be detail.

Mike Laren
  • 8,028
  • 17
  • 51
  • 70
Vamshi
  • 41
  • 1
  • 6
  • Assuming hub & node infrastructure is set up correctly, you are probably facing limitation of test runner itself. What do you use to run the tests? Is this JUnit? TestNG? Is this Java at all? Even if you configure grid correctly, you must configure test runner to run tests in parallel. – automatictester Jul 22 '15 at 07:52
  • @automatictester Yes, as mentioned in my above question I'm using junit and the framework is written in java. Here is TestRunner.java code ` import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; import org.junit.runner.RunWith; @RunWith(Cucumber.class) @CucumberOptions public class TestRunner { } ` – Vamshi Jul 23 '15 at 20:14
  • @automatictester Thanks for the Reply, Actually I have found the problem is with Jenkins build executor currently the executor by default is 2 so I have to increase the executors to no of nodes available in Grid setup in this case it worked in creating browser instances on those nodes but its not fixed completely.. :-( The first runs half way and then job fails and other jobs as well fail when I see the errors its related to deleting the suirefirebooter – Vamshi Jul 29 '15 at 14:20
  • Continue... @automatictester Error below : [WARNING] Could not delete temp direcotry C:\maven\XXX\target\surefire because File C:\maven\XXX\target\surefire\surefirebooter7887865930643403890.jar unable to be deleted. [ERROR] There was a timeout or other error in the fork I have tried with various build goals on jenkins like below : _tried replacing with (clean compile test),(install) and (test) commands_ **test -Dcucumber.options="src/test/resources --tags @Smoke_AITS_RDR"** **integration-test -Dcucumber-tags=@Smoke_VCT_COM** **test -Dcucumber.options="--tags @Smoke_VCT_COM"** – Vamshi Jul 29 '15 at 14:21
  • Continue.... I have gone through the opencredo.com... forum the solution is to run all the tests by the tags declared which does not work for me... There are two problems in my project... 1. How to set the Runner class without declaring the tags in that class and declaring in pom.xml ( I mean I need to declare something like to run all features like in surefire-plugin similar to the opencredo.com example ) 2. How to create a job for every feature on jenkins and If I want to run few jobs at once how to merge those few jobs into one multi job ? – Vamshi Jul 29 '15 at 14:21
  • Continue... @Automatictester If I have independent jobs for each feature file 1. Iphone 3G 2. Iphone 4 3. Iphone 5 4. Iphone 5c 5. Iphone 6 6 Iphone 6plus I should able to run the jobs independently for each feature from jenkins and when I want to run the complete 6 features I should able to have a multi job on jenkins and when I run that job all the 6 jobs should be kicked off and all the 6 tests should execute on 6 available nodes ... I cant get this fixed and it giving hard time Please Help !! – Vamshi Jul 29 '15 at 14:22

1 Answers1

0

By default, CucumberJVM ships with JUnit and runs tests in single thread. If you want to run it in parallel, here is an example of JUnit-specific solution:

https://www.opencredo.com/2013/07/02/running-cucumber-jvm-tests-in-parallel

Here is TestNG-specific solution:

http://automatictester.co.uk/2015/06/11/basic-cucumberjvm-selenium-webdriver-test-automation-framework/

I try to replace JUnit with TestNG whenever I can.

automatictester
  • 2,436
  • 1
  • 19
  • 34