OnlineShopSimulator is a java program able to simulate the behavior of an online shop, where a customer can buy items and review past purchases. The project has been developed following TDD principles and using Gradle as build automation tool. CI, coverage and code quality were also taken into account linking the Git project repository to the online services of Travis, Coveralls and Sonarqube. A Dockerfile and a Jenkinsfile comes with the code to provide a portable continuous integration environment, in which is possible to reproduce the build we defined thanks to a pipeline.
Link to whole paper here.
Below are shown two screenshots from the application: the first one is the store panel where a customer can add items to its cart and the purchase them. The second one, instead, is the history panel where it's possible to check past orders.
- Gradle 5.6.1
- Docker 19.03.5
- Java
If you want to run Jenkins from Mac OS or Windows, skip the first step:
-
open a terminal and type
sudo iptables -A INPUT -i docker0 -j ACCEPT
; -
move to Docker folder and launch
docker build -t jenkins-pipeline .
: this command will build the container on which Jenkins will be instancieted with all its dependencies and the pipeline we defined. -
Then, to run it launch:
docker run -it --rm --name jenkins-pipeline -p 8081:8080 -v /var/run/docker.sock:/var/run/docker.sock jenkins-pipeline
-
After the terminal prompts "Jenkins is fully up and running", connect to
localhost:8081
and you will be redirect to the Jenkins dashboard where you will find the "pipeline" job. Click on it and start the compilation.
-
First of all launch a docker mongodb container with:
docker run --rm --name mongo -p 27017:27017 mongo:4.0.5
-
Then, from the root project folder:
-
cd OnlineShopSimulator
-
./gradlew clean app
-
java -jar build/libs/OnlineShopSimulator.jar
-
A task is defined in the build.gradle file to launch mutation testing, so you just need to open a terminal and run ./gradlew pitest
. Reports are saved under the directory OnlineShopSimulatorLocal/build/reports/pitest.