From 0ce73efdef39b5760766fcdde08485e94b754953 Mon Sep 17 00:00:00 2001 From: Derek Allard Date: Mon, 18 Jan 2010 15:48:25 +0000 Subject: The Unit Test Class now has an optional "notes" field available to it, and allows for discrete display of test result items using $this->unit->set_test_items(). --- user_guide/libraries/unit_testing.html | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'user_guide/libraries') diff --git a/user_guide/libraries/unit_testing.html b/user_guide/libraries/unit_testing.html index b9916045e..bf86738f4 100644 --- a/user_guide/libraries/unit_testing.html +++ b/user_guide/libraries/unit_testing.html @@ -79,10 +79,10 @@ to determine if it is producing the correct data type and result.

Running a test involves supplying a test and an expected result to the following function:

-

$this->unit->run( test, expected result, 'test name' );

+

$this->unit->run( test, expected result, 'test name', 'notes');

-

Where test is the result of the code you wish to test, -expected result is the data type you expect, and test name is an optional name you can give your test. Example:

+

Where test is the result of the code you wish to test, expected result is the data type you expect, +test name is an optional name you can give your test, and notes are optional notes. Example:

$test = 1 + 1;

@@ -160,9 +160,29 @@ unit testing using:

$this->unit->active(FALSE) +

Unit Test Display

+

When your unit test results display, the following items show by default:

-

Creating a Template

+ + +You can customize which of these items get displayed by using $this->unit->set_items(). For example, if you only wanted the test name and the result displayed:

+ +

Customizing displayed tests

+ + + $this->unit->set_test_items(array('test_name', 'result')); + + +

Creating a Template

If you would like your test results formatted differently then the default you can set your own template. Here is an example of a simple template. Note the required pseudo-variables:

-- cgit v1.2.3-24-g4f1b