In this section we are going to write a very basic automated test script that simply loads the Google site, does a query and validates that the query was made by validating the new title of the page.
<jm:testcase xmlns:jm="jelly:jameleon"> <jm:test-case-summary>Tests searching on the sourceforege site</jm:test-case-summary> <jm:test-case-author>Christian Hargraves</jm:test-case-author> <jm:test-case-level>ACCEPTANCE</jm:test-case-level> <jm:functional-point-tested>Jiffie Example</jm:functional-point-tested> <jm:ie-session baseUrl="http://sourceforge.net" beginSession="true"> <jm:ie-validate functionId="Verify that we are on the sourceforge home page" title="SourceForge.net: Welcome to SourceForge.net" textPresent="Open Source Technology Group"/> <jm:ie-set-text-field functionId="Enter jameleon into the search box." name="words" value="jameleon" form="searchform"/> <jm:ie-click-button functionId="Click on the 'Google Search' button." form="searchform" value="Search" eventToFire="onclick" functionDelay="300"/> <jm:ie-validate functionId="Check that we actually did a search for 'Jameleon' and that we found 'Jameleon'" title="SourceForge.net: Software Search" linkPresent="Jameleon"/> <jm:ie-click-link functionId="Click on the 'Jameleon' link" link="Jameleon"/> <jm:ie-validate functionId="Validate that we arrived at the Jameleon SourceForge Page." title="SourceForge.net: Jameleon" linkPresent="engrean"/> <jm:ie-click-link functionId="Navigate to the Jameleon site by clicking on the 'Home Page' link" link="Home Page"/> <jm:ie-validate functionId="Validate that we arrived at the Jameleon SourceForge Page." title="Jameleon - An Automated Testing Tool - Overview"/> </jm:ie-session> </jm:testcase>
Save the above file as jameleon-test-suite-x.x.x/scripts/jiffie-sourceforge.xml.
This section will begin explaining from the <ie-session/> tag since the other tags are discussed in the Jameleon Getting Started section.
If you start up the Jameleon GUI, select the "Functional Points" tab and navigate to the net->sf->jameleon->plugin->jiffie package, you will see the following tags:
By selecting the ie-session tag, we can see that baseUrl and beginSession are supported attributes. baseUrl tells the Jiffie plug-in where to open IE to and beginSession tells the Jiffie plug-in to start IE at the baseUrl or Sourceforge's home page.
Try clicking on the other tags used above to see what they do. Now select your new script by selecting the "Test Cases" tab and then selecting the new script. If it's not there, then try double-clicking on the "Test Cases" folder. Now select the jiffie-sourceforge.xml script and you should see the following:
I believe the generated docs explain what is happening in the script. I will discuss a few tricky points to this script.