Automated tests

To execute Habit tests against your local Habit server just execute ./gradlew :test or run a particular test from within your IDE.

By default JUnit client tries to connect to localhost:7080 so you don’t have to configure anything.

To execute Habit tests against an external server you can set an environmental variable with IP address or the name under which the server is reachable.

To use the environmental variable approach:

  • HABIT_HOSTNAME=ip.or.hostname.com ./gradlew :test

If you would like to run only a single test from within IDE make sure to export the HABIT_HOSTNAME environmental variable before starting IDE. Otherwise it won’t be recognized.

You can also define what environmental variables should be set when running tests with IntelliJ Run configurations or a similar feature.