Verify the most recently fetched page against a specification.
The page can be HTML or XML.
(See fetch for the list of url types - e.g. file:\\, http:// etc.)
This can be done "inline":
<fetch url="loginpage.html"> <verify> <form id="form" name="form" action="..." method="post"> <dbInsert dbTable="security..log" id="userid"/> <input name="name" type="text" set="..."/> <input name="password" type="text" set="..."/> </form> </verify> <submit>
Or this can be done by putting the specification in a definePageelement. This is more readable for large sites; it has the advantage of separating the test steps from the structure of the pages on the site, and is more readable in large xml test files.
<fetch url="loginpage.html"/> <verify page="loginpage"/> <submit/> ... <definePage name="loginpage"> <form id="form" name="form" action="..." method="post"> <dbInsert dbTable="security..log" id="userid"/> <input name="name" type="text" set="..."/> <input name="password" type="text" set="..."/> </form> </definePage>
An alternative use for definePage is to check for a specific feature set that should be the same on each page.
<fetch url="..."/> <verify page="page1"/> <verify page="commonfeatures"/> <fetch url="..."/> <verify page="page2"/> <verify page="commonfeatures"/>... <definePage name="page1">...</definePage> <definePage name="page2">...</definePage> <definePage name="commonfeatures"> <link id="homepage"/> <element xpath="count(//form) = 0"/> </definePage>
A variation of this is to check for a specific feature set across servers or sites
<set name="server" value="..."/> <fetch page="home"/> <varify/> <set name="server" value="..."/> <fetch page="home"/> <varify/> <definePage name="home" url="http://#{server}/file.html"> ... </definePage>
The following example checks an XML page, and illustrates a test file checking itself.
<fetch url="file:test.xml"/> <verify stepid="a1" contenttype="application/xml"> <element xpath="//verify[@stepid='a1']"/> </verify>It verifies that the xml contains a verify element whose stepid attribute is set to 'a1'.
To link check a page see verifylinks.
cookies -- Specifies that a page or response contains a one or more cookies.
dbinsert -- Defines a set of database insertions for a page or response.
element -- Defines en element in an xml or html page using an xpath expression.
form -- Specifies that a page or response contains a frameset
frameset -- Specifies that a page contains a frameset
link -- Defines a link (<a>) in a page or response.
Attribute Value(s) Default Value contentencoding CDATA #IMPLIED contenttype To use xmlTestSuite with non html files, set this to an appropriate value, e.g. To use xmlTestSuite with xml files, set this to 'application/xml'
CDATAtext/html framename CDATA #IMPLIED page The name of the definePage element to verify against. If this is not set, it will use the page defined in the previous fetch, ot the parent element, or will use nested elements for the verify
IDREF#IMPLIED responsecode Http response code is normally 200. Some applications might be designed to return other codes. Note however that redirect codes are followed automatically and cannot be checked with this attribute. This attribute is only useful with http and https requests.
CDATA200 stepid ID #IMPLIED useparentfordefault CDATA #FIXED = page valueattribute This attribute is normally set to 'value' but can be set to 'set'
CDATAvalue windowname CDATA #IMPLIED
( form | frameset | cookies | dbinsert | link | element ) *
steps -- This element contains all the test steps.
suite -- Define a set of steps which can be "called" from a run element.
with -- Group together a set of steps that use the same page definition.
Top Elements || All Elements || Tree