[ CCUnit project page ] |  | [ CCUnit home page ]

Data Structures | Functions

# TestRunner
[TestListener]

Runs a single test and collects its results. More...

Collaboration diagram for TestRunner:

## Data Structures
struct | CCUnitTestRunner
| Runs a single test and collects its results. More...
## Functions
static void | startTest (CCUnitTestListener *listener, CCUnitTestCase *test)
| receive startTest notification.
static void | endTest (CCUnitTestListener *listener, CCUnitTestCase *test)
| receive endTest notification.
static void | addFailure (CCUnitTestListener *listener, CCUnitTestFailure *failure)
| receive addFailure notification.
static void | printHeader (CCUnitTestRunner *runner, CCUnitTestResult *result)
| Prints the header of the report.
static void | printFailures (CCUnitTestRunner *runner, CCUnitTestResult *result)
| Prints failures.
static void | print (CCUnitTestRunner *runner, CCUnitTestResult *result)
| Prints failures.
static int | doRun (CCUnitTestRunner *runner, CCUnitTestSuite *suite)
| Runs a single test and collects its results.
CCUnitTestResult * | ccunit_getResult (CCUnitTestRunner *runner)
| Get test result.

## Detailed Description

Runs a single test and collects its results.

This method can be used to start a test run from your program.

## Function Documentation

static void addFailure | ( | CCUnitTestListener * | listener,
|  | CCUnitTestFailure * | failure |
| ) |  |  | `[static]`

receive addFailure notification.

Parameters:

  | listener | notification listener.
  | failure | failure information.

References ofp.

CCUnitTestResult * ccunit_getResult | ( | CCUnitTestRunner * | runner | ) | `[inline]`

Get test result.

Parameters:

  | runner | test runner.

Returns:
  test result object.

static int doRun | ( | CCUnitTestRunner * | runner,
|  | CCUnitTestSuite * | suite |
| ) |  |  | `[static]`

Runs a single test and collects its results.

Parameters:

  | runner | test runner
  | suite | test suite

Returns:
  0 if succeeded. -1 if error occurd.

References ccunit_addResultListener(), ccunit_newTestResult(), ccunit_runTestSuite(), ccunit_wasSuccessful(), listener, ofp, print(), and result.

Here is the call graph for this function:

static void endTest | ( | CCUnitTestListener * | listener,
|  | CCUnitTestCase * | test |
| ) |  |  | `[static]`

receive endTest notification.

Parameters:

  | listener | notification listener.
  | test | ended test case

static void print | ( | CCUnitTestRunner * | runner,
|  | CCUnitTestResult * | result |
| ) |  |  | `[inline, static]`

Prints failures.

Parameters:

  | runner | test runner
  | result | test result

References printFailures(), and printHeader().

Referenced by doRun().

Here is the call graph for this function:

Here is the caller graph for this function:

static void printFailures | ( | CCUnitTestRunner * | runner,
|  | CCUnitTestResult * | result |
| ) |  |  | `[static]`

Prints failures.

Parameters:

  | runner | test runner.
  | result | test result.

References CCUnitTestFailure::actual, ccunit_deleteListIterator(), ccunit_failureCount(), ccunit_failures(), ccunit_nextListIterator(), CCUnitTestFailure::condstr, CCUnitTestCase::desc, CCUnitTestFailure::expect, CCUnitTestFailure::file, CCUnitTestFailure::line, ofp, and CCUnitTestFailure::testCase.

Referenced by print().

Here is the call graph for this function:

Here is the caller graph for this function:

static void printHeader | ( | CCUnitTestRunner * | runner,
|  | CCUnitTestResult * | result |
| ) |  |  | `[static]`

Prints the header of the report.

Parameters:

  | runner | test runner.
  | result | test result.

References ccunit_failureCount(), ccunit_runCount(), ccunit_wasSuccessful(), and ofp.

Referenced by print().

Here is the call graph for this function:

Here is the caller graph for this function:

static void startTest | ( | CCUnitTestListener * | listener,
|  | CCUnitTestCase * | test |
| ) |  |  | `[static]`

receive startTest notification.

Parameters:

  | listener | notification listener.
  | test | starting test case

References ofp.

| hosts this site. |  | Send comments to: CCUnit Developer |