GithubHelp home page GithubHelp logo

tests-in-containers's Introduction

Run tests in multiple containers

docker-container

This is a simple example of how to run tests in multiple containers using Docker and Docker Compose. and generate a common allure report.

File structure

File structure

Overview

  1. Dockerfile: This file contains the Dockerfile configuration, which uses maven-jdk image. It also copies the pom.xml, src folder, and XML files.
  2. docker-compose.yml: The Docker Compose file defines three services:
    • The first two services are used to run tests in two different containers.
    • The third service is responsible for generating the common allure report.
  3. pom.xml: This file contains the project dependencies.
  4. src/test: This directory contains the test files.
  5. *.xml: Multiple XML files are created to specify the tests to be run in each container.

How to run

  1. Clone the repository
  2. Give execute permission to the docker-compose-entrypoint.sh file
chmod +x docker-compose-entrypoint.sh
  1. Run the following command to run the tests in multiple containers and generate a common allure report.
  • To run specific groups, use the following command
./docker-compose-entrypoint.sh  <-Dgroups={group_name}> <-Dgroups={group_name}>

Example:

./docker-compose-entrypoint.sh  -Dgroups=container1 -Dgroups=container2
  • To run specific xml files, use the following command
./docker-compose-entrypoint.sh  <-Dsurefire.suiteXmlFiles={xml_file_name}> <-Dsurefire.suiteXmlFiles={xml_file_name}>

Example:

./docker-compose-entrypoint.sh  -Dsurefire.suiteXmlFiles=container1.xml -Dsurefire.suiteXmlFiles=container2.xml

How to view the report

After running the tests, to view the combined allure report.

  1. Go to your chrome browser and type the following url
http://localhost:5050/allure-docker-service/latest-report

After running tests in multiple continers, if u want to run the tests in only one of the container

  1. Open the terminal
  2. Get the container id of the container in which you want to run the tests
docker ps
  1. Run the following command to run the tests in the container
docker exec -it <container_id> /bin/bash
  1. Run the following command to run the tests in the container
mvn  test -Dgroups={group_name}
  1. Now refresh the below link you will be able to see the latest test along with the previous run in the report
http://localhost:5050/allure-docker-service/latest-report

Resources

tests-in-containers's People

Contributors

prajwal-dunzo avatar prajwalgn-07 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.