CUnit Progammers Guide |
||
---|---|---|
Prev | Home | Next |
CUnit uses a simple framework for building test structures, and provides a rich set of assertions for testing common data types. In addition, several different interfaces are provided for running tests and reporting results. These include automated interfaces for code-controlled testing and reporting, as well as interactive interfaces allowing the user to run tests and view results dynamically.
The data types and functions useful to the typical user are declared in the following header files:
Header File | Description |
---|---|
#include <CUnit/CUnit.h> | ASSERT macros for use in test cases, and includes other framework headers. |
#include <CUnit/CUError.h> | Error handing functions and data types. Included automatically by CUnit.h. |
#include <CUnit/TestDB.h> | Data type definitions and manipulation functions for the test registry, suites, and tests. Included automatically by CUnit.h. |
#include <CUnit/TestRun.h> | Data type definitions and functions for running tests and retrieving results. Included automatically by CUnit.h. |
#include <CUnit/Automated.h> | Automated interface with xml output. |
#include <CUnit/Basic.h> | Basic interface with non-interactive output to stdout. |
#include <CUnit/Console.h> | Interactive console interface. |
#include <CUnit/CUCurses.h> | Interactive console interface (*nix). |
#include <CUnit/Win.h> | Windows interface (not yet implemented). |
CUnit is organized like a conventional unit testing framework:
Test Registry | ------------------------------ | | Suite '1' . . . . Suite 'N' | | --------------- --------------- | | | | Test '11' ... Test '1M' Test 'N1' ... Test 'NM'Individual test cases are packaged into suites, which are registered with the active test registry. Suites can have setup and teardown functions which are automatically called before and after running the suite's tests. All suites/tests in the registry may be run using a single function call, or selected suites or tests can be run.
The deprecated API functions are described in the appropriate sections of the documentation.