Switch branches/tags
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
110 lines (99 sloc) 6.24 KB
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
<html xmlns="">
<title>Testing Framework</title>
<div class="instructions">
<h1>Testing Framework</h1>
<h3>General information</h3>
There are different kind of tests:
<li><strong>junit</strong>: To test specific functionality of certain java components/classes see <a href=""></a></li>
<li><strong>htmlunit</strong>: To test the web pages (simulating user interaction) see <a href=""></a></li>
<li><strong>Canoo</strong>: To test the web pages (simulating user interaction) see <a href=""></a></li>
<li><strong>JMeter</strong>: To load test web applications (simulating user interaction) see <a href=""></a></li>
<h3>How to run the tests</h3>
<p>After downloading the Yanel source (either via <a href="../../download/source-repository.html">Git</a> or as <a href="../download/index.html">snapshot</a>) one can run the tests all at once (as we do it for example with <a href="">Jenkins</a>) or run the various tests individually.</p>
<p>If you want to run all at once (including build and start of Yanel), then execute the shell script</p>
<pre>./src/build/targets/continuous-integration/reCI 8080 8443 8005 8009 /home/michi/local/canoo-webtest-3.0-R_1758
whereas please make sure to have <a href="">Canoo webtests</a> installed.
<p>If you want to run the tests individually, then it's necessary to build and start yanel before running the tests.</p>
<p><strong>IMPORTANT:</strong> If you want to run the htmlunit tests, you have to start tomcat and configure the host and url inside</p>
<p>One can also set realm specific variables, like for example the realm prefix:</p>
<p>which then can be retrieved via the Java Test class:</p>
protected void setUp() throws Exception {
this.testName = "My Test";
// INFO: Overwrite htmlunit configuration (src/test/htmlunit/local.htmlunit-properties.xml) and add element &lt;my-realm-prefix&gt;
REALM_PREFIX = config.getString("");
<p>Then execute in $YANEL_HOME:</p>
<pre>./ test
<p>To run single tests standalone:</p>
./ -f src/test/build.xml junit
./ -f src/test/build.xml htmlunit
<p>To run Yanel specific Canoo webtests (including junit and htmlunit):</p>
<pre>./ test -Dwebtest.home.dir=/usr/local/canoo-webtest-3.0-R_1758 -Dwebtest.config.protocol=http -Dwebtest.config.port=8080 -Dheadless=
<p>whereas if the global property 'headless' is set, then also the Canoo property 'wt.headless' is set within src/build/targets/test.xml, which means no monitor is displayed and no browser is opened to display the Canoo results.</p>
<p>Some Canoo web-tests are located at</p>
whereas also see the README.txt files within these directories.
<p>To run realm specific Canoo webtests</p>
<pre>./ -f src/realms/yanel-website/src/test/canoo/build.xml
or to run a specific target
<pre>./ -f src/realms/yanel-website/src/test/canoo/build.xml MY_TARGET_NAME
<p>whereas make sure to configure the properties within the realm first, e.g.</p>
src/realms/yanel-website/src/test/canoo/<br /></pre>
<p>To run JMeter tests, use the "jmeter" target:</p>
<pre>./ [-f path/to/build.xml] jmeter<br /></pre>
<h3>Debugging and Logging</h3>
The log level can be set inside <code>src/test/htmlunit/local.htmlunit-properties.xml</code> (<code>debugLevel</code>), whereas the log messages are written to standard output. The log is setup inside <code>src/test/htmlunit/org/wyona/yanel/htmlunit/</code>.
<h3>How to write tests</h3>
<p>Where to place core tests: <br />$YANEL_HOME/src/test/junit/ <br />$YANEL_HOME/src/test/htmlunit/ <br /><br />Where to place resource tests: <br />$YANEL_HOME/src/resources/MYRESOURCE/src/test/junit/ <br />$YANEL_HOME/src/resources/MYRESOURCE/src/test/htmlunit/</p>
<p>Choose the name of the class according to the following convention:</p>
<p>* e.g. for junit tests</p>
<p>* e.g. for htmlunit tests</p>
<p>The tests which adhere to these conventions will be executed automatically by the testing framework.</p>
<p>Have a look at the existing tests to see how it works, e.g. in the xml resource.</p>
<p>You can find more example htmlunit tests at: <a href=""></a> (Username:anonymous Password: anonymous).</p>
<p>For writing JMeter tests, see the <a href="jmeter.html">JMeter page</a>.</p>
<p>In the case of Mac OS X (at least Snow Leopard) and Java 1.6 one needs to add xalan-2.7.0.jar to the directory <code>/Library/Java/Extensions</code> (also see <a href=""></a>).</p>
<a name="continuous-integration">&#160;</a>
<h3>Continuous Integration / Delivery /Deployment</h3>
<p>Please see <a href=""></a> regarding code modifications and associated tests.</p>