This page contains information on running and writing unit tests for updown.
This is about as simple as it gets.
- Be sure you have completed Getting Started. In particular, be sure
$UPDOWN_DIRis defined correctly.
- Execute this command from the updown project directory:
$ updown build test
Alternatively, if you're using IDEA with the SBT console installed, you can just type
test in the console.
Try to write tests that exercise as much of the code as possible, but at the same time, try to keep efficiency in mind. We are going to try to keep it feasible to run tests constantly as a sanity check while we are developing. If the tests start to take too long, we won't use them as frequently.
The testing framework we are using is http:www.scalatest.org/. The website has a ton of documentation on writing tests. Each scala class we have should have an analogous ClassNameTest.scala file in
$UPDOWN_DIR/src/test/scala/. Copying one of the tests that are already there is probably a good starting point.
We have included scct ([Scala Code Coverage Tool|http://mtkopone.github.com/scct/]) in the project, so you can see how much code is exercised by your tests. Just make sure $UPDOWN_DIR is defined, and the do:
$ updown scct
This will run the tests and open the report in firefox (Assuming "firefox" is a valid command on your system). According to the scct folks, firefox is really the only browser that works for the report.
If you like doing thins in separate steps, here they are: Generate the report:
$ updown build clean test-coverage
Then you can view the report:
$ firefox $UPDOWN_DIR/target/coverage-report/index.html