Ticket #232 (closed enhancement: fixed)
TestGen4Web Verify-Element
| Reported by: | fcohen | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Version: | 5.2 | Keywords: | |
| Cc: |
Description
This enhancement adds a new Action/Step to TestGen4Web to verify the contents of an element in a Web page. The Verify-Element action uses an XPath expression to find an element's contents. Verify-Element checks that the contents are equal to the given value. Verify-Element works with PushToTest TestMaker Data Production Libraries (DPLs) to use DPL created data.
Verify-Element has the following syntax in a TestGen4Web recorded XML file:
<action type="verify-element" window="." step="5">
<xpath><![CDATA[*/table[1]/tr[5]/td[2]]]></xpath>
<value><![CDATA[output]]></value>
</action>
The Transformer utility (Tools menu -> Transformer in TestMaker 5.2 and later) translates this tag in the following Jython code:
self.ac = 5 self.action = self.actions[self.ac] self.config.logger.stepStart(self.action, self.ac) self.context.currentAction = self.action self.context.currentActionCount = self.ac self.handleAction_verifyElement(self.context, self.action) self.config.logger.stepEnd(self.ac)
The Transformer generates similar Java code.
We changed the class com.spike.tg4w.htmlunit.HtmlUnitInterpreter? to accept this new element
else if ("verify-element".equals(action.type)) {
handleAction_verifyElement(context, action);
}...
The modified HtmlUnitInterpreter? class is found in the TM5 repository in cvs.pushtotest.com. We are in communication with SpikeSource, the originators of TestGen4Web, to see if they will roll Verify-Element into TG4W.
We have not yet changed the TestGen4Web FireFox? plug-in (recorder.xpi) to generate the Verify element XML tag. Then the user needs to manually add this tag to the xml file.
Please see an example of Verify-Element in TestMaker_home/example_agents/SOAPUI-TG4W Example
