?? overview.html.svn-base
字號:
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title> Overview and feature list for the SimpleTest PHP unit tester and web tester </title><link rel="stylesheet" type="text/css" href="docs.css" title="Styles"></head><body><div class="menu_back"><div class="menu"><a href="index.html">SimpleTest</a> | <span class="chosen">Overview</span> | <a href="unit_test_documentation.html">Unit tester</a> | <a href="group_test_documentation.html">Group tests</a> | <a href="mock_objects_documentation.html">Mock objects</a> | <a href="partial_mocks_documentation.html">Partial mocks</a> | <a href="reporter_documentation.html">Reporting</a> | <a href="expectation_documentation.html">Expectations</a> | <a href="web_tester_documentation.html">Web tester</a> | <a href="form_testing_documentation.html">Testing forms</a> | <a href="authentication_documentation.html">Authentication</a> | <a href="browser_documentation.html">Scriptable browser</a></div></div><h1>Overview of SimpleTest</h1> This page... <ul><li> <a href="#summary">Quick summary</a> of the SimpleTest tool for PHP. </li><li> <a href="#features">List of features</a>, both current ones and those planned. </li><li> There are plenty of <a href="#resources">unit testing resources</a> on the web. </li></ul><div class="content"> <p><a class="target" name="summary"><h2>What is SimpleTest?</h2></a></p> <p> The heart of SimpleTest is a testing framework built around test case classes. These are written as extensions of base test case classes, each extended with methods that actually contain test code. Top level test scripts then invoke the <span class="new_code">run()</span> methods on every one of these test cases in order. Each test method is written to invoke various assertions that the developer expects to be true such as <span class="new_code">assertEqual()</span>. If the expectation is correct, then a successful result is dispatched to the observing test reporter, but any failure triggers an alert and a description of the mismatch. </p> <p> A <a href="unit_test_documentation.html">test case</a> looks like this...<pre><?phprequire_once('simpletest/autorun.php');class <strong>MyTestCase</strong> extends UnitTestCase { <strong> function testCreatedLogFile() { $log = &new Log('my.log'); $log->message('Hello'); $this->assertTrue(file_exists('my.log')); }</strong>}?></pre> </p> <p> These tools are designed for the developer. Tests are written in the PHP language itself more or less as the application itself is built. The advantage of using PHP itself as the testing language is that there are no new languages to learn, testing can start straight away, and the developer can test any part of the code. Basically, all parts that can be accessed by the application code can also be accessed by the test code, if they are in the same programming language. </p> <p> The simplest type of test case is the <a href="unit_tester_documentation.html">UnitTestCase</a>. This class of test case includes standard tests for equality, references and pattern matching. All these test the typical expectations of what you would expect the result of a function or method to be. This is by far the most common type of test in the daily routine of development, making up about 95% of test cases. </p> <p> The top level task of a web application though is not to produce correct output from its methods and objects, but to generate web pages. The <a href="web_tester_documentation.html">WebTestCase</a> class tests web pages. It simulates a web browser requesting a page, complete with cookies, proxies, secure connections, authentication, forms, frames and most navigation elements. With this type of test case, the developer can assert that information is present in the page and that forms and sessions are handled correctly. </p> <p> A <a href="web_tester_documentation.html">WebTestCase</a> looks like this...<pre><?phprequire_once('simpletest/autorun.php');require_once('simpletest/web_tester.php');class <strong>MySiteTest</strong> extends WebTestCase { <strong> function testHomePage() { $this->get('http://www.my-site.com/index.php'); $this->assertTitle('My Home Page'); $this->clickLink('Contact'); $this->assertTitle('Contact me'); $this->assertPattern('/Email me at/'); }</strong>}?></pre> </p> <p><a class="target" name="features"><h2>Feature list</h2></a></p> <p> The following is a very rough outline of past and future features and their expected point of release. I am afraid it is liable to change without warning, as meeting the milestones rather depends on time available. Green stuff has been coded, but not necessarily released yet. If you have a pressing need for a green but unreleased feature then you should check-out the code from Sourceforge SVN directly. <table><thead> <tr><th>Feature</th><th>Description</th><th>Release</th></tr> </thead><tbody><tr> <td>Unit test case</td> <td>Core test case class and assertions</td> <td style="color: green;">1.0</td> </tr> <tr> <td>Html display</td> <td>Simplest possible display</td> <td style="color: green;">1.0</td> </tr> <tr> <td>Autoloading of test cases</td> <td> Reading a file with test cases and loading them into a group test automatically </td> <td style="color: green;">1.0</td> </tr> <tr> <td>Mock objects</td> <td> Objects capable of simulating other objects removing test dependencies </td> <td style="color: green;">1.0</td> </tr> <tr> <td>Web test case</td> <td>Allows link following and title tag matching</td> <td style="color: green;">1.0</td> </tr> <tr> <td>Partial mocks</td> <td> Mocking parts of a class for testing less than a class or for complex simulations </td> <td style="color: green;">1.0</td> </tr> <tr> <td>Web cookie handling</td> <td>Correct handling of cookies when fetching pages</td> <td style="color: green;">1.0</td> </tr> <tr> <td>Following redirects</td> <td>Page fetching automatically follows 300 redirects</td> <td style="color: green;">1.0</td> </tr> <tr> <td>Form parsing</td> <td>Ability to submit simple forms and read default form values</td> <td style="color: green;">1.0</td> </tr> <tr> <td>Command line interface</td> <td>Test display without the need of a web browser</td> <td style="color: green;">1.0</td> </tr> <tr> <td>Exposure of expectation classes</td> <td>Can create precise tests with mocks as well as test cases</td> <td style="color: green;">1.0</td> </tr> <tr> <td>XML output and parsing</td> <td> Allows multi host testing and the integration of acceptance testing extensions </td> <td style="color: green;">1.0</td> </tr> <tr> <td>Browser component</td> <td> Exposure of lower level web browser interface for more detailed test cases </td> <td style="color: green;">1.0</td> </tr> <tr> <td>HTTP authentication</td> <td> Fetching protected web pages with basic authentication only </td> <td style="color: green;">1.0</td> </tr> <tr>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -