diff options
Diffstat (limited to 'tests/FunctionalTests/selenium/doc/testrunner.html')
-rw-r--r-- | tests/FunctionalTests/selenium/doc/testrunner.html | 213 |
1 files changed, 213 insertions, 0 deletions
diff --git a/tests/FunctionalTests/selenium/doc/testrunner.html b/tests/FunctionalTests/selenium/doc/testrunner.html new file mode 100644 index 00000000..86cac0cb --- /dev/null +++ b/tests/FunctionalTests/selenium/doc/testrunner.html @@ -0,0 +1,213 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<meta name="generator" content="Docutils 0.3.5: http://docutils.sourceforge.net/" /> +<title>TestRunner Reference</title> +<link rel="stylesheet" href="default.css" type="text/css" /> +</head> +<body> +<h1 class="title">TestRunner Reference</h1> +<div class="document" id="testrunner-reference"> +<div class="section" id="test-suites"> +<h1><a name="test-suites">Test Suites</a></h1> +<blockquote> +<p>A test suite is represented by an HTML document containing a single-column table. Each entry in the table should be a hyperlink to a test-case document. The first row will be ignored by Selenium, so this can be used for a title, and is typically used to hold a title.</p> +<p>By default Selenium will attempt to load the test-suite from "tests/TestSuite.html". An alternative test-suite source can be specified by appending a "test" parameter to the TestRunner.html URL, e.g.:</p> +<pre class="literal-block"> +http://localhost:8000/TestRunner.html?test=AllTests.php +</pre> +<p>The "test" URL is interpreted relative to the location of TestRunner.html.</p> +</blockquote> +</div> +<div class="section" id="test-cases"> +<h1><a name="test-cases">Test Cases</a></h1> +<blockquote> +<p>A test-case is represented by an HTML document, containing a table with 3 columns: <em>command</em>, <em>target</em>, <em>value</em>. Not all commands take a value, however. In this case either leave the column blank or use a &nbsp; to make the table look better.</p> +<p>The first row will be ignored by Selenium, so this can be used for a title or any other information.</p> +<p>Example:</p> +<blockquote> +<table border="1" class="table"> +<colgroup> +<col width="31%" /> +<col width="38%" /> +<col width="31%" /> +</colgroup> +<tbody valign="top"> +<tr><td colspan="3">Simple Test Table</td> +</tr> +<tr><td>open</td> +<td>/mypage</td> +<td> </td> +</tr> +<tr><td>type</td> +<td>nameField</td> +<td>John Smith</td> +</tr> +<tr><td>click</td> +<td>submitButton</td> +<td>True</td> +</tr> +<tr><td>verifyText</td> +<td>name</td> +<td>John Smith</td> +</tr> +</tbody> +</table> +</blockquote> +</blockquote> +</div> +<div class="section" id="setup-teardown"> +<h1><a name="setup-teardown">SetUp / TearDown</a></h1> +<blockquote> +<p>There are no setUp and tearDown commands in Selenium, but there is a way to handle these common testing operations. On the site being tested, create URLs for setUp and tearDown. Then, when the test runner opens these URLs, the server can do whatever setUp or tearDown is necessary.</p> +<p>Example:</p> +<blockquote> +<p>For the T&E project, we wanted the functional tests to run as a dummy user. Therefore, we made a /setUpFT URL that would create a dummy user and write the userID to the page. Then, we can store this value (using the command storeValue) and use it in the script. Finally, we made a /tearDownFT URL which takes the dummy userID as a parameter and deletes the user. Therefore, our tests look like this:</p> +<table border="1" class="table"> +<colgroup> +<col width="21%" /> +<col width="58%" /> +<col width="21%" /> +</colgroup> +<tbody valign="top"> +<tr><td colspan="3">Setup and Teardown</td> +</tr> +<tr><td>open</td> +<td>/setUpFT</td> +<td> </td> +</tr> +<tr><td>storeValue</td> +<td>userid</td> +<td> </td> +</tr> +<tr><td>open</td> +<td>/login</td> +<td> </td> +</tr> +<tr><td>type</td> +<td>userID</td> +<td>${userid}</td> +</tr> +<tr><td>click</td> +<td>submit</td> +<td> </td> +</tr> +<tr><td>open</td> +<td>/tearDownFT?userid=${userid}</td> +<td> </td> +</tr> +</tbody> +</table> +</blockquote> +</blockquote> +</div> +<div class="section" id="continuous-integration"> +<h1><a name="continuous-integration">Continuous Integration</a></h1> +<blockquote> +<p>Selenium can be integrated with an automated build. When the parameter "auto=true" is added to the URL, Selenium will run the entire suite of tests, and then post the results to a handling URL. The default URL is "/postResults", but an alternative handler location can be provided by specifying a "resultsUrl" parameter.</p> +<p>The fields of the post are:</p> +<blockquote> +<table border="1" class="table"> +<colgroup> +<col width="15%" /> +<col width="85%" /> +</colgroup> +<thead valign="bottom"> +<tr><th>Parameter</th> +<th>Description</th> +</tr> +</thead> +<tbody valign="top"> +<tr><td>result</td> +<td>the word "passed" or "failed" depending on whether the whole suite passed or at least one test failed.</td> +</tr> +<tr><td>totalTime</td> +<td>the time in seconds for the whole suite to run</td> +</tr> +<tr><td>numTestPasses</td> +<td>tht total number of tests which passed</td> +</tr> +<tr><td>numTestFailures</td> +<td>the total number of tests which failed.</td> +</tr> +<tr><td>numCommandPasses</td> +<td>the total number of commands which passed.</td> +</tr> +<tr><td>numCommandFailures</td> +<td>the total number of commands which failed.</td> +</tr> +<tr><td>numCommandErrors</td> +<td>the total number of commands which errored.</td> +</tr> +<tr><td>suite</td> +<td>the suite table, including the hidden column of test results</td> +</tr> +<tr><td>testTable.1</td> +<td>the first test table</td> +</tr> +<tr><td>testTable.2</td> +<td>the second test table</td> +</tr> +<tr><td>...</td> +<td>...</td> +</tr> +<tr><td>testTable.N</td> +<td>The Nth test table</td> +</tr> +</tbody> +</table> +</blockquote> +<dl> +<dt>Therefore, the steps for continuous integration are:</dt> +<dd><ol class="first last arabic"> +<li><p class="first">Create a servlet-type application at the url /postResults which can read the parameters above and write them to a file</p> +</li> +<li><dl class="first"> +<dt>Create a script which can start up a brower and send to to the URL: selenium?auto=true</dt> +<dd><ul class="first last"> +<li><dl class="first"> +<dt>Generally, this can be done by merely calling the browser with the URL as an argument:</dt> +<dd><p class="first last">firefox.exe <a class="reference" href="http://localhost/selenium?auto=true">http://localhost/selenium?auto=true</a></p> +</dd> +</dl> +</li> +</ul> +</dd> +</dl> +</li> +<li><dl class="first"> +<dt>Make your continuous build:</dt> +<dd><ul class="first last simple"> +<li>Call the script from step 2, preferably using more than one browser</li> +<li>Wait for it to finish, possibly by checking for the existence of the file(s) from step 1</li> +<li>Parse these files to determine whether the build passed or failed</li> +<li>Act accordingly (send emails, update a build web page, etc.)</li> +</ul> +</dd> +</dl> +</li> +</ol> +</dd> +</dl> +</blockquote> +<hr /> +<table class="field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field"><th class="field-name">Authors:</th><td class="field-body">Paul Gross, Jason Huggins</td> +</tr> +<tr class="field"><th class="field-name">Created Date:</th><td class="field-body">08/23/2004</td> +</tr> +<tr class="field"><th class="field-name">Modified Date:</th><td class="field-body">28/01/2005</td> +</tr> +<tr class="field"><th class="field-name">Created With:</th><td class="field-body">reStructuredText: <a class="reference" href="http://docutils.sourceforge.net/rst.html">http://docutils.sourceforge.net/rst.html</a></td> +</tr> +</tbody> +</table> +</div> +</div> +</body> +</html> |