Skip to content

This is an example project focused in unit testing and integration tests with hibernates and test containers.

Notifications You must be signed in to change notification settings

Katsshura/JUnitTestingDemo

Repository files navigation

The main objective of this project is to show how to test applications using JUnit5 and its features, specially how to perform Parameterized Tests.


Article using this Project.

If you want to know more about the testing methodologies applied in this project and why or when to use each one of them, please check this article on Medium that I wrote using this project as reference.

Project

Since the goal of this project is target to the test classes the project domain itself was planned to be very simple and very understandable. That said, we have only two controllers one for User context [GET and POST] and another one for Task context [GET and POST]. This behaviour is propagated to the others layers as well.

Imgur


Running The Project and Tests

  • Go to the project root folder
  • Run command docker-compose up -d to run PostgreSQL on Docker.
  • Run command ./gradlew migrateLocal to run flyway migrations.
  • Run command ./gradlew clean build to build the project. Tests are always executed in this step.
  • If you want to run only the tests you can run this command: ./gradlew :<module>:test replace <module> for either api or core depending on which layer you want to test.
  • ./gradlew :api:test | ./gradlew :core:test
  • To execute Pitest on the project: ./gradlew pitest
  • To run the project api: ./gradlew :api:bootRun

Pre-requisites

Before you begin, you will need to have the following tools installed on your machine:


Get in touch

Linkedin Badge Gmail Badge

About

This is an example project focused in unit testing and integration tests with hibernates and test containers.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages