The NetKernel XUnit Unit Test System is a comprehensive and extensible ROC testing framework that provides an integrated unit test execution and test result reporting tool.
Unit testing is the process of issuing external requests for resources and services provided by a space under test and checking the responses and returned representations to make sure they meet certain criteria. A unit test framework is a system that performs these tests automatically.
In NetKernel unit tests are defined within a unit test space. The unit test space imports the space under test so that requests issued in the unit test space can be resolved in the space under test. The XUnit test manager is an external application that issues test requests for each the test steps in the unit test space.
Each unit test may comprise multiple steps: setup, test request, a set of assert checks and then a teardown step. Each of these steps is executed by a separate request issued into the unit test space by the XUnit test manager. In the setup step, actions are taken to establish the context for the test. The test itself defines a request that is issued into the unit test space and the response is captured for use in the assert checks. An assert check is a request that is provided the result of the test request. An assert check can test various aspect of the response for compliance. For example, the Java class of the returned representation can be checked to make sure it matches the expected class. All assert checks must pass for the unit test to pass. Finally, the teardown step deconstructs any context created by the previous steps. In summary, each unit test may comprise the following:
XUnit discovers unit test spaces by looking for the public resource
res:/etc/system/Tests.xml in each module known to NetKernel.
This resource enumerates all test lists contained in the unit test space.
Each test list includes a set of individual unit tests.
This multi-level organization allows for groups of logically related tests.
The XUnit test manager can execute an individual test, a group of tests (enumerated
in a test list) or all tests discovered for all modules.
Tests.xml | +- Testlist 1 | Unit test A | +- Testlist 2 Unit test B Unit test C
The recommended approach is to create a separate unit test module that defines the unit test space for each application or system module being tested. Because the unit test module and the module being tested are related, one can use similar module identifiers such as this pair:
with a unit test module