Sitodo (PMPL Variant)
TODO: Create badges that display pipeline status and code coverage percentage
A basic todo app project for teaching basic Web programming, Git workflows, and CI/CD. Heavily inspired by the running example in "Test-Driven Development with Python" book by Harry Percival.
Note: The project has been customised from the upstream in order to be used in PMPL (SQA) course at the Faculty of Computer Science Universitas Indonesia.
Setting Up Development Environment
The following tools need to be installed in order to build and run the project:
- Java 17 JDK (Java Development Kit)
- PostgreSQL 14
- You can install PostgreSQL system-wide or use container (Docker/Podman)
- Apache Maven 3.8.5
-
Mozilla Firefox
- Required by the functional (Selenium) test suite
Ensure java
, javac
, and mvn
commands can be invoked from inside the shell:
$ java --version
openjdk 17.0.3 2022-04-19
OpenJDK Runtime Environment Temurin-17.0.3+7 (build 17.0.3+7)
OpenJDK 64-Bit Server VM Temurin-17.0.3+7 (build 17.0.3+7, mixed mode, sharing)
$ javac --version
javac 17.0.3
$ mvn --version
Apache Maven 3.8.2 (ea98e05a04480131370aa0c110b8c54cf726c06f)
We recommend IntelliJ IDEA Community Edition as the IDE for developing the project. Other IDE or text editors, such as Eclipse and Visual Studio Code, might work. However, we may not be able to help troubleshoot any IDE-related issues. In addition, we include IntelliJ-specific run configurations in the codebase that will add shortcuts for running the test suites and coverage reporting from within IntelliJ.
Getting Started
To run the whole test suite, execute:
mvn test
To run a select test suite, e.g. unit or functional test, add
-Dgroups
parameter. For example, to run only the unit test suite, executemvn test -Dgroups=unit
. Similarly, to run only the functional test suite, executemvn test -Dgroups=e2e
.
To build an executable Spring Boot application, execute:
mvn package -DskipTests
The
-DskipTests
option letspackage
task to build the app into executable JAR file without running all test suites. If the option was omitted, then all test suites will run, thus increasing the duration of the building process, especially the functional test suite that runs much longer than the unit test suite.
The JAR file will be generated at ./target
directory. To run it,
execute:
java -jar sitodo.jar
You can customise the configuration by providing an application.properties
file in the same directory as the executable JAR file. See the built-in
configuration in the source code.
Practical Tasks
See the TODO items spread across several files in the project:
grep -nr "TODO:"
Note: If you are using Windows, you can use Git Bash or Bash on WSL to execute the command above.
Running Example
See the running example based on the main branch at Heroku.
DB_* Variables Needed for Running The Test in Gitlab
The following DB variables need to be defined in Gitlab Environment Variable in order run the test in Gitlab:
- DB_HOST
- DB_NAME
- DB_PASSWORD
- DB_PORT
- DB_USER
License
This project is licensed under the terms of the MIT license.
Exercise Report
TODO: (For SQA/PMPL course participants) Write the URL to your deployed application in this section. TODO: (For SQA/PMPL course participants) Write your report in this section.