Search⌘ K

Create the Pipeline and Run the Tests

Learn how to create the pipeline and execute the Selenium tests using Docker containers.

The pipeline that runs the Selenium tests in a Docker container relies on the Dockerfile from the root project folder:

Shell
FROM selenium/node-chrome
COPY . .
USER root
RUN apt-get update
RUN apt-get install maven -y
RUN apt-get install openjdk-8-jdk -y
ENTRYPOINT ["bash", "command.sh"]

Add the above Dockerfile to the root of your project repository.

The Docker pipeline

The Docker pipeline YAML code is below:

YAML
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
steps:
- task: Bash@3
displayName: 'Create Java Test Image'
inputs:
targetType: inline
script: 'docker build -t seleniumtests .'
- task: Bash@3
displayName: 'Run Java Test Container'
inputs:
targetType: inline
script: 'docker run -e "BROWSER=chrome" --name tests seleniumtests'

The pipeline has only two tasks, one for building the Docker image and ...