Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Cannot run parallel selenium grid test on pipelines

Ronald Faizaan Shaikh August 20, 2019

I am trying to run parallel test using selenium grid setup

The test runs successfully on bitbucket pipelines but doesn't execute in parallel however the same scripts runs fine on my local docker setup

Below is how my bitbucket-pipelines.yml file looks like

image: maven:3.6.1-jdk-8


pipelines:

  default:

    - step:

        name: E2E tests

        size: 2x

        caches:

          - maven

        script:

          - mvn -B clean install # -B batch mode makes Maven less verbose

        services:

            - chrome

            - firefox

            - hub

            

definitions:

  services:

    chrome:

      environment:

        HUB_PORT_4444_TCP_ADDR: localhost

        HUB_PORT_4444_TCP_PORT: 4444

        NODE_MAX_INSTANCE: 8

        NODE_MAX_SESSION: 8

      image: selenium/node-chrome-debug

      memory: 2048

    firefox:

      environment:

        DISPLAY: :88

        HUB_PORT_4444_TCP_ADDR: localhost

        HUB_PORT_4444_TCP_PORT: 4444

        NODE_MAX_INSTANCE: 8

        NODE_MAX_SESSION: 8

        SE_OPTS: -port 5556

      image: selenium/node-firefox-debug

      memory: 1536

    hub:

      environment:

        SE_OPTS: -host 127.0.0.1

      image: selenium/hub

      memory: 2048

 

1 answer

0 votes
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 20, 2019

Hello @Ronald Faizaan Shaikh,

I'm not an expert in Pipelines configuration, but I don't see anything related to parallelisation in the script you posted. There can be two ways to parallelise the tests you're running:

  1. By means of Pipelines. You need to configure parallel steps, each of them running a test against a particular browser (you'll need to set up something like maven profiles in for this I guess).
  2. By means of Maven. This really depends on your maven config, Pipelines has no visibility into parallelisation. For instance, if you're using Maven Surefire plugin, here's the relevant documentation on configuring parallel test execution.

Hope this helps. Let me know if you have any questions.

Cheers,
Daniil

Ronald Faizaan Shaikh August 20, 2019

Hi @Daniil Penkin ,

Thanks for the quick response.

I am using the second method. Maven surefire plugin is handling the parallelisation. When I execute the exact same code on my local docker setup it runs the suite files in parallel however the same doesn't work using bitbucket pipeline it runs sequentially one thread at a time. Is there a thread limit ?

Below is Maven surefire plugin configuration for your reference

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-surefire-plugin</artifactId>

<version>3.0.0-M3</version>

<configuration>

<systemPropertyVariables>

<environment>${env.USER}</environment>

<selenium-hub.host>localhost</selenium-hub.host>

</systemPropertyVariables>

<forkCount>0</forkCount>

<suiteXmlFiles>

<!-- TestNG suite XML files -->

<suiteXmlFile>test1.xml</suiteXmlFile>

<suiteXmlFile>test2.xml</suiteXmlFile>

<suiteXmlFile>test3.xml</suiteXmlFile>

<suiteXmlFile>test4.xml</suiteXmlFile>

<suiteXmlFile>test5.xml</suiteXmlFile>

<suiteXmlFile>test6.xml</suiteXmlFile>

<suiteXmlFile>test7.xml</suiteXmlFile>


</suiteXmlFiles>

<properties>

<property>

<name>suitethreadpoolsize</name>

<value>3</value>

</property>

</properties>

</configuration>

</plugin>

</plugins>

Below is docker-compose.yml  that I run locally for your reference

Ignore the environment variable in the mvn command

version: "3"

services:

  hub:

    image: selenium/hub

    ports:

      - "4444:4444"

  chrome:

    image: selenium/node-chrome-debug

    volumes:

      - /dev/shm:/dev/shm

    depends_on:

      - hub

    links:

      - hub

    ports:

      - "5900:5900"

    environment:

      - HUB_HOST=hub

      - HUB_PORT=4444

      - NODE_MAX_SESSION=8

      - NODE_MAX_INSTANCES=8


  firefox:

    image: selenium/node-firefox-debug

    volumes:

      - /dev/shm:/dev/shm

    depends_on:

      - hub

    links:

      - hub

    ports:

      - "5901:5900"

    environment:

      - HUB_HOST=hub

      - HUB_PORT=4444

      - NODE_MAX_SESSION=8

      - NODE_MAX_INSTANCES=8


  mvn:

    # Run pre-built maven image from docker library

    image: maven:3.6.1-jdk-8

    volumes:

      # Cache maven dependencies

      #- $HOME/.m2:/root/.m2

      # Mount the application source and target directories

      - ./:/usr/src/mvn-src

    # Run maven inside the application directory

    working_dir: /usr/src/mvn-src

    command: mvn clean install -Dselenium-hub.host=hub

    links:

      - hub

      - firefox

      - chrome 
Abhilash March 3, 2022

@Ronald Faizaan Shaikh Were you able to find a solution to run the scripts parallely?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events