summaryrefslogtreecommitdiffstats
path: root/user_guide/libraries/unit_testing.html
diff options
context:
space:
mode:
authorDerek Allard <derek.allard@ellislab.com>2010-01-18 16:48:25 +0100
committerDerek Allard <derek.allard@ellislab.com>2010-01-18 16:48:25 +0100
commit0ce73efdef39b5760766fcdde08485e94b754953 (patch)
treef5bdb07547f7cfe3578ff86e80d3cfa23e2cf706 /user_guide/libraries/unit_testing.html
parent2a064ef8014413c7c6d4c9c7456665c219529a49 (diff)
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().
Diffstat (limited to 'user_guide/libraries/unit_testing.html')
-rw-r--r--user_guide/libraries/unit_testing.html28
1 files changed, 24 insertions, 4 deletions
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.
<p>Running a test involves supplying a test and an expected result to the following function:</p>
-<h2>$this->unit->run( <var>test</var>, <var>expected result</var>, '<var>test name</var>' );</h2>
+<h2>$this->unit->run( <var>test</var>, <var>expected result</var>, '<var>test name</var>', '<var>notes</var>');</h2>
-<p>Where <var>test</var> is the result of the code you wish to test,
-<var>expected result</var> is the data type you expect, and <var>test name</var> is an optional name you can give your test. Example:</p>
+<p>Where <var>test</var> is the result of the code you wish to test, <var>expected result</var> is the data type you expect,
+<var>test name</var> is an optional name you can give your test, and <var>notes</var> are optional notes. Example:</p>
<code>$test = 1 + 1;<br />
<br />
@@ -160,9 +160,29 @@ unit testing using:</p>
<code>$this->unit->active(FALSE)</code>
+<h2>Unit Test Display</h2>
+<p>When your unit test results display, the following items show by default:</p>
-<h2>Creating a Template</h2>
+<ul>
+ <li>Test Name (test_name)</li>
+ <li>Test Datatype (test_datatype)</li>
+ <li>Expected Datatype (res_datatype)</li>
+ <li>Result (result)</li>
+ <li>File Name (file)</li>
+ <li>Line Number (line)</li>
+ <li>Any notes you entered for the test (notes)</li>
+</ul>
+
+You can customize which of these items get displayed by using <kbd>$this->unit->set_items()</kbd>. For example, if you only wanted the test name and the result displayed:</p>
+
+<h3>Customizing displayed tests</h3>
+
+<code>
+ $this->unit->set_test_items(array('test_name', 'result'));
+</code>
+
+<h3>Creating a Template</h3>
<p>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:</p>