Giter VIP home page Giter VIP logo

coffee-testing's Introduction

Effective Testing & Test Automation

Some projects for my presentations on effective enterprise testing.

The example projects contain a coffee-shop application, which uses the coffee-shop-db database, and a barista application.

Running

You run the environment, containing the coffee-shop, barista applications and the coffee-shop-db using Docker containers.

In order to run the Docker containers locally, you need to create a Docker network first:
docker network create --subnet=192.168.42.0/24 dkrnet

Then you can build the coffee-shop project and run the environment as follows:

./local-build.sh
./local-run-env.sh

You can access the coffee-shop application using HTTP, after the applications have been started:

curl localhost:8001/
curl localhost:8001/orders

You create new coffee orders by POST-ing the JSON representation of a new order:

curl localhost:8001/orders -i \
  -XPOST \
  -H 'Content-Type: application/json' \
  -d '{"type":"Espresso","origin":"Colombia"}'

INFO: To stop and clean up the containers again, run: docker stop coffee-shop barista coffee-shop-db

Running the tests

You run the non-integration tests by executing mvn test, or mvn package (any goal that executes Maven’s test phase).

You run the integration tests by executing mvn test-compile failsafe:integration-test failsafe:verify.

You can run the systems tests either in a Kubernetes environment or using plain Docker containers.

System tests on local Docker containers

You run the system test environment by executing:

./systemtest-run-env.sh

This starts up the coffee-shop application, the coffee-shop-db database, and a barista mock server.

The system tests contained in coffee-shop-st/ will run against that deployed environment:

cd coffee-shop-st/
mvn verify

INFO: To stop and clean up the system test containers again, run: docker stop coffee-shop barista coffee-shop-db

System tests with Quarkus dev mode

The system test environment with Docker containers also works with the Quarkus remote-dev mode where we can see our code changes immediately being reflected in the running coffee-shop application.

You run the system test environment with dev mode by executing:

./systemtest-run-dev-env.sh

You can run the system tests like in the description before, and also you can change the sources under coffee-shop/ and see the changes being reflected in the running coffee-shop application.

System tests on Kubernetes

In order to run the system tests in Kubernetes & Istio you need to apply the systemtest Kubernetes resources: kubectl apply -f coffee-shop/deployment/systemtest/. The files assume that you have Istio installed on your cluster.

You can point your integration & system tests to the remote environment using the following system variables:

  • for the smoke integration tests:

cd coffee-shop/
mvn test-compile failsafe:integration-test failsafe:verify \
  -Dcoffee-shop.test.host=1.2.3.4 \
  -Dcoffee-shop.test.port=80
  • for the system tests:

cd coffee-shop-st/
mvn verify \
  -Dcoffee-shop.test.host=1.2.3.4 \
  -Dcoffee-shop.test.port=80 \
  -Dbarista.test.host=1.2.3.4 \
  -Dbarista.test.port=80

coffee-testing's People

Contributors

sdaschner avatar asolntsev 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.