Simplified grades manager made for university classes. Main idea of project has been implementing unit, integrational and acceptance tests.
Implemented code was intend to comply imposed on specification and give interface which allowed to run this commands:
<main_app_path> student <name> <nazwisko>
- adding new student to database<main_app_path> add subject <subject_name>
- adding new subject to database<main_app_path> del student <name> <nazwisko>
- removing student from database<main_app_path> del subject <subject_name>
- removing subject from database<main_app_path> count students
- count students stored in a database<main_app_path> count subjects
- count subjects stored in a database<main_app_path> set grade <name> <nazwisko> <subject_name> <grade>
- adding new grade to student from given subject<main_app_path> average <name> <nazwisko> <subject_name>
- calculating average grade from given subject
- Language: Java
- Build system: Gradle
- Database: MongoDB
- DB Mapper: Jongo
- Tests library: JUnit 5
- Mocking library: Mockito
- Acceptance tests script language: Bash
MongoDB as a database was used mainly for educational purpose. In this case overengineering is kinda intend
- ✅ TDD (Test Driven Development)
Total tests qty: 193
- Unit tests: 91
- Integration tests: 47
- Acceptance tests: 55
In order to mock DB dependencies in unit tests, have been applied mocks and spies with Mockito library
- Classes: 100%
- Methods: 96,6%
- Lines of code: 97,2%
Total of about 1700 lines of tests code. Full code coverage report in the form of .html
files, can be found in coverage.zip
You can run all tests from IDE or using gradle tool:
Units tests:
./gradle test
Integration:
./gradle testInteg
Acceptance
./acceptance_tests.sh <main_app_path>
In order to test application API you can:
- a) Run java jar application:
java -jar app.jar <arguments>
for example:
java -jar app.jar add student Łukasz Gajerski
- b) Run wrapping scripts
./app.sh <arguments>
or./app.bat <arguments>
for example:
Linux
./app.sh add subject Biology
Windows
./app.bat add subject Biology
You can run acceptance tests by using acceptance_tests.sh
.
Acceptance tests syntax:
./acceptance_tests.sh <path to main app file>
Script takes as an argument path to any app implementation, which is comply with API mentioned in (About) section. Test will generate results for every tests and summary report. For example:
Created by
gajerski.lukasz@gmail.com - feel free to contact me! ✊