0

I have a maven test project which uses Cucumber-jvm internally. I want to run my feature files in parallel using Selenium-Grid 2.0.

I have started the hub and node but when I am running my tests. It is running tests sequentially in only one chrome instance. Though I can see 4 instances of chrome on my hub.

Below is my @Before hook.

@Before
    public void beforeScenario() throws Exception{
        //grid code
        DesiredCapabilities cap = new DesiredCapabilities();
        cap.setBrowserName("chrome");
        cap.setPlatform(Platform.MAC);
        cap.setCapability("version", "41");
        driver = new RemoteWebDriver(
                new URL("http://localhost:4444/wd/hub"),
                cap);

        endUser.is_the_login_page();

    }

Some help will be useful. Thanks

Manisha Awasthi
  • 449
  • 1
  • 5
  • 16

2 Answers2

0

Are you using one Test class or multiple? A single test class is going to be run single-threaded. So that would reuse. If you:

  • tag feature files and scenarios @firefox and @chrome
  • Create hooks to configure chrome vs firefox based on the @chrome and @firefox tags
  • then use separate test classes that filter to the @firefox and @chrome
  • make sure your junit runner is going to allow forking to run multiple tests at the same time

Then you should see your tests running in both containers at the same time.

Dan Woodward
  • 2,559
  • 1
  • 16
  • 19
0

This should be possible with the surefire plugin: http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html

Dude
  • 692
  • 1
  • 4
  • 25