WARNING: This server provides a static reference view of the NetKernel documentation. Links to dynamic content do not work. For the best experience we recommend you install NetKernel and view the documentation in the live system .

Overview

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.

2009-03-09 14:48ZCanvas 1Layer 1Unit Test SpaceSpace Under TestImportXUnit

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:

  1. Setup
  2. Test Request
  3. Assert Checks
  4. Teardown

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:

urn.com.mycomp.application.accounting.services

with a unit test module

urn.test.com.mycomp.application.accounting.services