-
Notifications
You must be signed in to change notification settings - Fork 1
Test Infrastructure
JUnit tests test about a forth of the complete codebase.
They are distributed across different plug-ins to separate production from test code. The test plug-ins are partially fragments of the plug-ins they test so that they can access packages of their host without them being explicitly exported.
The test infrastructure consists of the following plug-ins.
- de.tud.stg.tigerseye.core.tests (unit tests for example languages)
- de.tud.stg.tigerseye.examples.tests (unit tests for the core plug-in)
- TigerseyeTestRunner (plug-in that executes all available tests)
The TigerseyeTestRunner contains JUnit test suites and launch configurations to run all tests. The launch configurations use the Multi-Project JUnit Runner plug-in and have the advantage that they dynamically collect all tests of all registered projects.
The test cases use additional test libraries.
- mockito. Mocking framework.
- powermock. Extension to mock static methods.
- fest assert. "Fixtures for Easy Software Testing".
FEST is a framework with similiar functionality as hamcrest. It takes a more type dependent approach, which makes the use of Eclipse' auto completion possible to see what assertions are valid for the type being asserted. Though it is not as flexible as hamcrest it is easy to extend.
To see the state of a test execution system.out
statements are usually used.
They have the disadvantage that it can not be controlled when they output the result
and when not. This clutters the console with much output and makes it hard
to look for relevant output. Additionally string concatenations and output are
expensive operations and can slow down the test execution considerably which
becomes a problem once the test suite reaches a certain size. SLF4J provides a
simple mechanism which ensures that string concatenation and message output
is only executed if the logging mechanism has been activated for that specific
statement. Have a look here for a description with examples.