Skip to end of metadata
Go to start of metadata

This module represents the link between the generic infrastructure contained in dh-core and the familar JUnit3 library, allowing to turn the usual unit test programming in a DuckHawk TestExecutor factory and runner.

The following diagram shows the general architecture:

The module provides three base classes that can be used according to the desired test setup.

  • ConformanceTest will turn each testXXX method into a TestExecutor that will be run by a ConformanceRunner
  • PerformanceTest will do the same, but will run in performance mode
  • StressTest will create multiple instances of the test class, all running the same test method.

There are three key elements to understand:

  • JUnit runners are starting the tests, and the DuckHawk integration turns a normal test method invocation into a TestRunner invocation. This means that you can use whatever tool you want to run a test suite, and the result will be that you'll be running a set of DuckHawk tests
  • TestExecutor.run(...) will run the current testXXX method. What about the untimed TestExecutor.check(...)? The DuckHawk integration will search for a checkXXX method, if it finds one, that will be run as the check part after invoking textXXX. This means whatever result needs to be checked in the checkXXX method will have to be passed around as a field of the class.
  • JUnit3 methods have a very strict structure, they have to be public, start with test and have no arguments. This means the single call properties cannot be provided as parameters. This is circumvented by using the base class properties field, that can be altered in order to return properties out of the test. Also, if the test needs to enter values into the test wide properties map, it can implement a initXXX(TestProperties properties) that will be called with the test properties. Finally, the environment properties provided by the TestContext are made available using the method getEnvironment(property).

To sum up, a single test can be pushed so far as to become a three methods set using properties as follows:

Labels
  • None