Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
README.md 5.4 KiB
Newer Older
Daya Adianto's avatar
Daya Adianto committed
# Sitodo (PMPL Variant)

[![pipeline status](https://gitlab.cs.ui.ac.id/pmpl/examples/sitodo-pmpl/badges/main/pipeline.svg)](https://gitlab.cs.ui.ac.id/pmpl/examples/sitodo-pmpl/-/commits/main)
[![coverage report](https://gitlab.cs.ui.ac.id/pmpl/examples/sitodo-pmpl/badges/main/coverage.svg)](https://gitlab.cs.ui.ac.id/pmpl/examples/sitodo-pmpl/-/commits/main)
Daya Adianto's avatar
Daya Adianto committed

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](https://github.com/addianto/sitodo)
> in order to be used in PMPL (SQA) course at the Faculty of Computer Science Universitas Indonesia.
Daya Adianto's avatar
Daya Adianto committed

## Table of Contents

1. [Getting Started](#getting-started)
   1. [Setting Up Development Environment](#setting-up-development-environment)
   2. [Build & Run](#build--run)
   3. [Running Example](#running-example)
2. [Behavior-Driven Development (BDD)](#behavior-driven-development-bdd)
3. [License](#license)
4. [Written Exercise Report (For PMPL (SQA) Course Participants)](#written-exercise-report-for-pmpl-sqa-course-participants)

## Getting Started

### Setting Up Development Environment
Daya Adianto's avatar
Daya Adianto committed

The following tools need to be installed in order to build and run the project:

-  [Java 17 JDK (Java Development Kit)](https://adoptium.net)
-  PostgreSQL 14
    -  You can install PostgreSQL system-wide or use container (Docker/Podman).
Daya Adianto's avatar
Daya Adianto committed
-  [Apache Maven 3.8.5](https://maven.apache.org/download.cgi)
-  [Mozilla Firefox](https://www.mozilla.org/en-US/firefox/)
    - Required by the functional (Selenium) test suite and BDD test suite.
Daya Adianto's avatar
Daya Adianto committed

Ensure `java`, `javac`, and `mvn` commands can be invoked from inside the shell:

```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](https://www.jetbrains.com/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.

### Build & Run
Daya Adianto's avatar
Daya Adianto committed

To run the whole test suite, execute:

```shell
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, execute
> `mvn test -Dgroups=unit`.  Similarly, to run only the functional test suite,
> execute `mvn test -Dgroups=e2e`.

To build an executable Spring Boot application, execute:

```shell
mvn package -DskipTests
```

> The `-DskipTests` option lets `package` 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`](./target) directory. To run it,
execute:

```shell
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](./src/main/resources/application.properties).

You can also set the configuration during runtime using environment variables.
Following Spring Boot convention, properties are named in all uppercase and dot separators are replaced with underscores.
For instance, `spring.datasource.url` becomes `SPRING_DATASOURCE_URL` when configured using an environment variable.
See the example in the [GitLab CI/CD configuration](./.gitlab-ci.yml), specifically in the job for running tests.

### Running Example
Daya Adianto's avatar
Daya Adianto committed

See the running example based on the [upstream's `main` branch](https://gitlab.cs.ui.ac.id/pmpl/examples/sitodo-pmpl/-/tree/main) at [Fly.io](https://sitodo-pmpl.fly.dev).
Daya Adianto's avatar
Daya Adianto committed

## Behavior-Driven Development (BDD)
Daya Adianto's avatar
Daya Adianto committed

> Outline:
> - Quick overview of BDD
> - Example-driven development, both TDD & BDD
>   - TDD developer centric, while BDD team centric
> - Gherkin format (Given-When-Then) as executable scenarios
> - Glue code, step definitions
> - Screenplay & Page Object pattern
>
> Quotes:
> - Ideally, if all of the acceptance criteria for a feature have been automated and run successfully, you can say that this feature is finished and ready for production.
> 
> References:
> - https://livebook.manning.com/book/bdd-in-action-second-edition/chapter-8
> - See chapter 8.5.1 of the BDD reference book to learn how to perform setup & teardown phase in BDD test.
>
> Draft Scenario: Todo item cannot be empty
> 
> - Given Alice is looking at the todo list
> - When she accidentally adds an empty item
> - Then she should be presented with a warning message containing "Todo item cannot be empty"
Daya Adianto's avatar
Daya Adianto committed
## License

This project is licensed under the terms of the [MIT license](./LICENSE).

## Written Exercise Report (For PMPL (SQA) Course Participants)
Daya Adianto's avatar
Daya Adianto committed

> You can write your report in English or Bahasa Indonesia.
>
> TODO: Write the URL to your deployed application in this section.
> TODO: Write your report in this section.