Current responseby Group Public on Thursday July 10 2008 @ 15:18:54 (1/1 Points) |
|
| Tutorial ↪User Guide ✑ Reply ✓ Stick It ✗ Ditch It ⚐ Tag It |
Responses form the system are stored as the current response. All actions within .test which work with responses work on the most recent response.
Checking the values in a Reponse
The check→ command evaluates the XPath. It succeeds it the return of the XPath is non-empty, that is, it returns at least one node, a true value, or a non-zero length string (though I haven't tested the last one).
This example checks that there is an input element with the name attribute "subject".
check //input[@name='subject']
Extracting the value from a response
The Response is exposed through a special "Response" object in the context, thus it can be accessed just like any other contect object.
set %title% %Response://title/text()%
Be very careful about auto conversion from XPath. Try using the explicit conversion operators and referring to the exact nodes desired. The rules for conversion are not too complex, but there are a lot of gotchas.
Formats of the response
Refer to Response Formats→
Working with CSV
Often you'll need to work with a specific line of a CSV file, which can be troublesome in XPath. A basic approach you can take is below, identify which line you want, and then use that line in further tests.
setas %Line% response count(//value[@name='user.Email'][contains(text(),'%Group:Owner:Email%')]/preceding-sibling::line)+1
notice %Line%
notice %Response://line[{Line}]/value[@name='user.NamedAttribute.Something']%Refer XPath↗
TestPlan Current response
