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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,463,370
Community Members
 
Community Events
176
Community Groups

Cannot run parallel selenium grid test on pipelines

Edited

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

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

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 

@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

Atlassian Community Events