This repository follows the coding example of the book Growing Object-Oriented Software Guided by Tests by Steve Freeman and Nat Pryce.
The book’s example code doesn’t need a higher version than Java 6. But sometimes I make use of Java 8 features. Hence, a JDK version 8 is needed. All further java dependencies (libraries needed at compile time, at test time and at runtime) are managed and downloaded automatically by Gradle.
The Openfire server is assumed to be "already there". The GitHub project thilomack/goos-infra downloads and installs an Openfire server as a docker container and configures it suitable for the book’s example.
On Linux machines, only:
For running all tests on a continuous integration server, setup_openfire.sh
downloads, installs and
configures an Openfire server locally. If a server is already there, the shell script just starts it.
Eclipse and IntelliJ IDEA are able to import Gradle projects without any additional plugin applied to the Gradle build file.
The build distinguishes between three different kinds of tests:
-
Unit tests: Very fast running tests that handle a single aspect (= a single class). They are executed together with the
compile
task using:./gradlew build
and, however, can be run separately with:
./gradlew test
-
End-to-end tests: Acceptance tests that once have driven development and now have to stay stable. They are designed to be as much end-to-end as possible, drive the UI directly and go through the whole stack, down to the Openfire chat server. They are run with the command:
./gradlew endtoendTest
-
Integration tests: This level of testing lies in between of unit tests and end-to-end tests. It tests the integration of several classes.
./gradlew integrationTest
-
The test that drives development: A single end-to-end test which fails until the new feature is finally developed and the test moves over to the other end-to-end tests. It is not part of the CI build and intended to run locally, only:
./gradlew endtoendFailingTest