Show samples.xml syntax highlighted
<?xml version="1.0"?>
<document>
<properties>
<author email="engrean.AT.users.DOT.sourceforge.DOT.net">Christian Hargraves</author>
<title>Jameleon - HtmlUnit Plug-in - Samples</title>
</properties>
<meta name="keyword" content="sample, example, jameleon, htmlunit, web testing, FAQ, automated testing"/>
<body>
<section name="Examples Using the HtmlUnit Plug-in">
Please be aware that these examples may become outdated due the changes of the web application being used in the example.
<ol>
<li><a href="#Submitting a Form and Validating Results">Submitting a Form and Validating Results</a></li>
</ol>
</section>
<section name="Submitting a Form and Validating Results">
<p>
The following is an example of filling out a form, clicking a button and validating the results:
<source><![CDATA[
<j:testcase xmlns:j="jelly:jameleon">
<j:test-case-summary>
An example test that fills out variable form fields
and clicks on the apppriate button to submit the form
</j:test-case-summary>
<j:test-case-author>Christian Hargraves</j:test-case-author>
<j:test-case-level>ACCEPTANCE</j:test-case-level>
<j:functional-point-tested>sample form</j:functional-point-tested>
<j:application-tested>htmlunit-plugin</j:application-tested>
<j:htmlunit-session
baseUrl="http://jameleon.sourceforge.net/htmlunit-plugin/forms/sampleForm.html"
beginSession="true">
<j:htmlunit-validate
functionId="Validate that the page was successfully loaded"
title=""
xpath="//form[@name='sample']"/>
<j:htmlunit-set-text-field
functionId="Enter first name using XPath to locate the text field"
xpath="//form[1]//input[@name='fname']"
value="Mark"/>
<j:htmlunit-set-text-field
functionId="Enter last name using XPath to locate the text field"
xpath="//form[1]//input[@name='lname']"
value="Smith"/>
<j:htmlunit-set-radio-button
functionId="Select gender, using the form, fieldName, value and checked attributes"
form="sample"
fieldName="gender"
value="male"
checked="true"
/>
<j:htmlunit-set-password-field
functionId="Enter the password using the form (XPath this time), fieldName and value attributes"
form="//form[1]"
fieldName="password"
value="some password"
/>
<j:htmlunit-click
functionId="Click the purple submit button"
xpath="//form[@name='sample']/tr/td[1]/input[@type='button' and @value='Go']"/>
<j:htmlunit-validate
functionId="Validate that the 'Go Back' button shows up"
xpath="//input[@type='button' and @value='Go Back']"/>
<j:htmlunit-validate
functionId="Validate that the password shows up"
xpath="//tr/td[text()='Password:']/following-sibling::td[text()='some password']"/>
</j:htmlunit-session>
</j:testcase>
]]></source>
</p>
</section>
</body>
</document>
See more files for this project here