index.html (17192B)
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2<html xmlns="http://www.w3.org/1999/xhtml"> 3<head> 4<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> 5<meta http-equiv="X-UA-Compatible" content="IE=9"/> 6<meta name="generator" content="Doxygen 1.8.4"/> 7<title>SDL Visual Test: Visual and Interactive Test Automation for SDL 2.0</title> 8<link href="tabs.css" rel="stylesheet" type="text/css"/> 9<script type="text/javascript" src="jquery.js"></script> 10<script type="text/javascript" src="dynsections.js"></script> 11<link href="search/search.css" rel="stylesheet" type="text/css"/> 12<script type="text/javascript" src="search/search.js"></script> 13<script type="text/javascript"> 14 $(document).ready(function() { searchBox.OnSelectItem(0); }); 15</script> 16<link href="doxygen.css" rel="stylesheet" type="text/css" /> 17</head> 18<body> 19<div id="top"><!-- do not remove this div, it is closed by doxygen! --> 20<div id="titlearea"> 21<table cellspacing="0" cellpadding="0"> 22 <tbody> 23 <tr style="height: 56px;"> 24 <td style="padding-left: 0.5em;"> 25 <div id="projectname">SDL Visual Test 26 </div> 27 </td> 28 </tr> 29 </tbody> 30</table> 31</div> 32<!-- end header part --> 33<!-- Generated by Doxygen 1.8.4 --> 34<script type="text/javascript"> 35var searchBox = new SearchBox("searchBox", "search",false,'Search'); 36</script> 37 <div id="navrow1" class="tabs"> 38 <ul class="tablist"> 39 <li class="current"><a href="index.html"><span>Main Page</span></a></li> 40 <li><a href="annotated.html"><span>Data Structures</span></a></li> 41 <li><a href="files.html"><span>Files</span></a></li> 42 <li> 43 <div id="MSearchBox" class="MSearchBoxInactive"> 44 <span class="left"> 45 <img id="MSearchSelect" src="search/mag_sel.png" 46 onmouseover="return searchBox.OnSearchSelectShow()" 47 onmouseout="return searchBox.OnSearchSelectHide()" 48 alt=""/> 49 <input type="text" id="MSearchField" value="Search" accesskey="S" 50 onfocus="searchBox.OnSearchFieldFocus(true)" 51 onblur="searchBox.OnSearchFieldFocus(false)" 52 onkeyup="searchBox.OnSearchFieldChange(event)"/> 53 </span><span class="right"> 54 <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> 55 </span> 56 </div> 57 </li> 58 </ul> 59 </div> 60</div><!-- top --> 61<!-- window showing the filter options --> 62<div id="MSearchSelectWindow" 63 onmouseover="return searchBox.OnSearchSelectShow()" 64 onmouseout="return searchBox.OnSearchSelectHide()" 65 onkeydown="return searchBox.OnSearchSelectKey(event)"> 66<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark"> </span>Pages</a></div> 67 68<!-- iframe showing the search results (closed by default) --> 69<div id="MSearchResultsWindow"> 70<iframe src="javascript:void(0)" frameborder="0" 71 name="MSearchResults" id="MSearchResults"> 72</iframe> 73</div> 74 75<div class="header"> 76 <div class="headertitle"> 77<div class="title">Visual and Interactive Test Automation for SDL 2.0 </div> </div> 78</div><!--header--> 79<div class="contents"> 80<div class="textblock"><h1><a class="anchor" id="license_sec"></a> 81License</h1> 82<p>Check the file <code>COPYING.txt</code> for licensing information.</p> 83<h1><a class="anchor" id="intro_sec"></a> 84Introduction</h1> 85<p>The goal of this GSoC project is to automate the testing of testsprite2. testsprite2 takes 26 parameters which have thousands of valid combinations and is used to validate SDL's window, mouse and rendering behaviour. By having a test harness that runs testsprite2 with various command line argument strings and validates the output for each run, we can make testing an easier task for maintainers, contributors and testers. The test harness can be used by a continuous integration system (like buildbot or jenkins) to validate SDL after checkins.</p> 86<p>SDL Homepage: <a href="http://libsdl.org/">http://libsdl.org/</a></p> 87<h1><a class="anchor" id="build_sec"></a> 88Building</h1> 89<h2><a class="anchor" id="build_linux"></a> 90Building on Linux/Cygwin</h2> 91<p><code>./autogen.sh; ./configure; make;</code></p> 92<h2><a class="anchor" id="build_windows"></a> 93Building on Windows</h2> 94<p>Use the Visual Studio solution under <code>SDL/VisualC/visualtest</code>.</p> 95<h1><a class="anchor" id="docs_sec"></a> 96Documentation</h1> 97<p>Documentation is available via Doxygen. To build the documentation, cd to the SDL/visualtest/docs directory and run <code>doxygen</code>. A good starting point for exploring the documentation is <code>SDL/visualtest/docs/html/index.html</code> </p> 98<h1><a class="anchor" id="usage_sec"></a> 99Usage</h1> 100<p>To see all the options supported by the test harness, just run <code>testharness</code> with no arguments.</p> 101<p>At the moment the following options are supported: </p> 102<ul> 103<li><code>sutapp</code> - Path to the system under test (SUT) application </li> 104<li><code>sutargs</code> - Launch the SUT with the specified arguments string </li> 105<li><code>timeout</code> - The maximum time after which the SUT process will be killed; passed as hh:mm:ss; default 00:01:00 </li> 106<li><code>variator</code> - Which variator to use; see <a class="el" href="index.html#variators_sec">Variators</a> </li> 107<li><code>num-variations</code> - The number of variations to run for; taken to be 1 for the random variator and ALL for the exhaustive variator by default </li> 108<li><code>no-launch</code> - Just print the arguments string for each variation without launching the SUT or performing any actions </li> 109<li><code>parameter-config</code> - A config file that describes the command line parameters supported by the SUT; see <a class="el" href="index.html#paramconfig_sec">The SUT Parameters File</a> or the sample *.parameters files for more details </li> 110<li><code>action-config</code> - A config file with a list of actions to be performed while the SUT is running; see <a class="el" href="index.html#actionconfig_sec">The Actions File</a> or the sample *.actions files </li> 111<li><code>output-dir</code> - Path to the directory where screenshots should be saved; is created if it doesn't exist; taken to be "./output" by default </li> 112<li><code>verify-dir</code> - Path to the directory with the verification images; taken to be "./verify" by default</li> 113</ul> 114<p>Paths can be relative or absolute.</p> 115<p>Alternatively, the options can be passed as a config file for convenience:</p> 116<p><code>testharness --config testsprite2_sample.config</code></p> 117<p>For a sample, take a look at the *.config files in this repository.</p> 118<p>We can also pass a config file and override certain options as necessary: <code>testharness --config testsprite2_sample.config --num-variations 10</code></p> 119<p>Note: You may find it convenient to copy the SUT executable along with any resources to the test harness directory. Also note that testsprite2 and its resources (icon.bmp) are automatically copied when using the Visual Studio solution.</p> 120<h2><a class="anchor" id="usageexamples_subsec"></a> 121Usage examples:</h2> 122<p>Passing a custom arguments string: <code>testharness --sutapp testsprite2 --sutargs "\-\-cyclecolor \-\-blend mod 123\-\-iterations 2" --action-config xyz.actions</code></p> 124<p>Using the random variator: <code>testharness --sutapp testsprite2 --variator random --num-variations 5 --parameter-config xyz.parameters --action-config xyz.actions</code></p> 125<h2><a class="anchor" id="config_subsec"></a> 126Config Files</h2> 127<p>Config files are an alternate way to pass parameters to the test harness. We describe the paramters in a config file and pass that to the test harness using the --config option. The config file consists of lines of the form "x=y" where x is an option and y is it's value. For boolean options, we simply give the name of the option to indicate that it is to be passed to the testharness.</p> 128<p>The hash '#' character can be used to start a comment from that point to the end of the line.</p> 129<h1><a class="anchor" id="paramconfig_sec"></a> 130The SUT Parameters File</h1> 131<p>To generate variations we need to describe the parameters the will be passed to the SUT. This description is given in a parameters file. Each line of the parameters file (except the blank lines) represents one command line option with five comma separated fields: <code>name, type, values, required, categories</code></p> 132<ul> 133<li><code>name</code> is the name of the option, e.g., <code>--cyclecolor</code>. </li> 134<li><code>type</code> can have one of three values - integer, boolean and enum. </li> 135<li><code>values</code> - for integer options this is the valid range of values the option can take, i.e., [min max]. For enum options this is a list of strings that the option can take, e.g., [val1 val2 val3]. For boolean options this field is ignored. </li> 136<li><code>required</code> - true if the option is required, false otherwise. </li> 137<li><code>categories</code> - a list of categories that the option belongs to. For example, [video mouse audio]</li> 138</ul> 139<p>Just like with config files, hash characters can be used to start comments.</p> 140<h2><a class="anchor" id="additionalnotes_subsec"></a> 141Additional Notes</h2> 142<ul> 143<li>If you want to have an option that always takes a certain value, use an enum with only one value. </li> 144<li>Currently there isn't any way to turn an option off, i.e., all options will be included in the command line options string that is generated using the config. If you don't want an option to be passed to the SUT, remove it from the config file or comment it out.</li> 145</ul> 146<h1><a class="anchor" id="variators_sec"></a> 147Variators</h1> 148<p>Variators are the mechanism by which we generate strings of command line arguments to test the SUT with. A variator is quite simply an iterator that iterates through different variations of command line options. There are two variators supported at the moment: </p> 149<ul> 150<li><b>Exhaustive</b> - Generate all possible combinations of command line arguments that are valid. </li> 151<li><b>Random</b> - Generate a random variation each time the variator is called.</li> 152</ul> 153<p>As an example, let's try a simple .parameters file:<br/> 154 <code> --blend, enum, [add mod], false, [] <br/> 155 --fullscreen, boolean, [], false, [] </code></p> 156<p>The exhaustive variator would generate the following four variations:<br/> 157 <code> --blend add <br/> 158 --blend mod <br/> 159 --blend add --fullscreen <br/> 160 --blend mod --fullscreen <br/> 161 </code></p> 162<p>The random variator would simply generate a random variation like the following:<br/> 163 <code>--blend mod</code></p> 164<h1><a class="anchor" id="actionconfig_sec"></a> 165The Actions File</h1> 166<p>Once the SUT process has been launched, automated testing happens using a mechanism called actions. A list of actions is read from a file and each action is performed on the SUT process sequentially. Each line in the actions file describes an action. The format for an action is <code>hh:mm:ss ACTION_NAME additional parameters</code>. There are five actions supported at the moment: </p> 167<ul> 168<li><b>SCREENSHOT</b> - Takes a screenshot of each window owned by the SUT process. The images are saved as <code></code>[hash]_[i].bmp where <code></code>[hash] is the 32 character long hexadecimal MD5 hash of the arguments string that was passed to the SUT while launching it and <code>i</code> is the window number. i = 1 is an exceptional case where the <code>_</code>[i] is dropped and the filename is simply <code></code>[hash].bmp<br/> 169 Note: The screenshots are only of the window's client area. </li> 170<li><b>VERIFY</b> - Verifies the screenshots taken by the last SCREENSHOT action by comparing them against a verification image. Each <code></code>[hash]_i.bmp image output by the SCREENSHOT action is compared against a <code></code>[hash].bmp image in the verify-dir. </li> 171<li><b>QUIT</b> - Gracefully quits the SUT process. On Windows this means sending a WM_CLOSE message to each window owned by the SUT process. On Linux it means sending a SIGQUIT signal to the SUT process. </li> 172<li><b>KILL</b> - Forcefully kills the SUT process. This is useful when the SUT process doesn't respond to the QUIT action. </li> 173<li><b>LAUNCH [/path/to/executable] [args]</b> - Runs an executable with <code></code>[args] as the arguments string.</li> 174</ul> 175<p>Just like with config files, hash characters can be used to start comments.</p> 176<h1><a class="anchor" id="contint_sec"></a> 177Continuous Integration (CI)</h1> 178<p>One of the goals of the project was to create a test harness that integrates with CI systems to provide automated visual and interactive testing to SDL.</p> 179<p>At the moment the test harness can be run in two modes that are useful for CI: </p> 180<ul> 181<li>Crash testing mode - launch the SUT with every variation and all parameters, report to the CI if there's a crash </li> 182<li>Visual testing mode - launch and visually verify the SUT for a smaller subset of the parameters</li> 183</ul> 184<p>Look at the launch_harness.sh/launch_harness.cmd for an example scripts that run the test harness for all variations with all parameters and report an error on a crash. The script uses the testsprite2_crashtest config, so remember to copy those files over to the test harness executable directory along with the script.</p> 185<h1><a class="anchor" id="todo_sec"></a> 186TODOs</h1> 187<ul> 188<li>Allow specifying a clipping box along with the VERIFY action, i.e., hh:mm:ss VERIFY x, y, w, h </li> 189<li>Add support for spaces between the equals sign in test harness config files </li> 190<li>Implement the SCREENSHOT action on Linux </li> 191<li>Add a pairwise variator </li> 192<li>Add actions to inject keyboard/mouse events </li> 193<li>Add actions to manipulate the SUT window, e.g., minimize, restore, resize </li> 194<li>Add support to load and save screenshots as .pngs instead of .bmps</li> 195</ul> 196<h1><a class="anchor" id="issues_sec"></a> 197Known Issues</h1> 198<ul> 199<li>The QUIT action does not work on a testsprite2 process with multiple windows. This appears to be an issue with testsprite2. </li> 200<li>The SCREENSHOT action doesn't capture the testsprite2 window correctly if the –fullscreen option is supplied. It works with –fullscreen-desktop, however.</li> 201</ul> 202<h1><a class="anchor" id="moreinfo_sec"></a> 203More Information</h1> 204<p>Author Contact Info:<br/> 205 Apoorv Upreti <code><<a href="#" onclick="location.href='mai'+'lto:'+'apo'+'or'+'vup'+'re'+'ti@'+'gm'+'ail'+'.c'+'om'; return false;">apoor<span style="display: none;">.nosp@m.</span>vupr<span style="display: none;">.nosp@m.</span>eti@g<span style="display: none;">.nosp@m.</span>mail<span style="display: none;">.nosp@m.</span>.com</a>></code> </p> 206<p>Other useful links:</p> 207<ul> 208<li>Project Repository: <a href="https://bitbucket.org/nerdap/sdlvisualtest">https://bitbucket.org/nerdap/sdlvisualtest</a></li> 209<li>Project Wiki: <a href="https://github.com/nerdap/autotestsprite2/wiki">https://github.com/nerdap/autotestsprite2/wiki</a></li> 210<li>Project Blog: <a href="http://nerdap.github.io">http://nerdap.github.io</a></li> 211<li>Verification images for testsprite2_blendmodes: <a href="https://www.dropbox.com/s/nm02aem76m812ng/testsprite2_blendmodes.zip">https://www.dropbox.com/s/nm02aem76m812ng/testsprite2_blendmodes.zip</a></li> 212<li>Verification images for testsprite2_geometry: <a href="https://www.dropbox.com/s/csypwryopaslpaf/testsprite2_geometry.zip">https://www.dropbox.com/s/csypwryopaslpaf/testsprite2_geometry.zip</a> </li> 213</ul> 214</div></div><!-- contents --> 215<!-- start footer part --> 216<hr class="footer"/><address class="footer"><small> 217Generated on Thu Sep 26 2013 00:18:24 for SDL Visual Test by  <a href="http://www.doxygen.org/index.html"> 218<img class="footer" src="doxygen.png" alt="doxygen"/> 219</a> 1.8.4 220</small></address> 221</body> 222</html>