Filter Step applyFilters
Description
Applies one or more filters to the current response and treats the result as if it was a new response.
This step allows you to apply one or more filter(s) to the current response and then perform some simple tests on the result as if the filtered result is a new response.
This step should be treated as experimental. It does a few hacks under the covers but has been very useful for debugging purposes. If you use this step, a recommended approach is to not perform subsequent invokes after this step, i.e. this step should be near the end of your test sequence.
Parameters
- description
- Required? no
- The description of this test step.
- htmlId
- Required? no
- The id of an HTML element. If present, processing will be limited to this element. Will be ignored if a nested table step is used.
- save
- Required? no
- A shorthand: save='prefixName' is the same as savePrefix='prefixName' saveResponse='true'.
- savePrefix
- Required? no, default is the 'savePrefix' parameter as specified in <config>.
- A name prefix can be specified for making a permanent copy of received responses. A unique number and the file extension (depending on the MIME-Type) will be appended. The resultpath attribute of the <config> element is used for determining the location of the saved result.
- saveResponse
- Required? no
- Whether to make a permanent copy of received responses. Overrides the default value set in the <config> element.
- xpath
- Required? no
- An XPath expression identifying an HTML element. If present, processing will be limited to this element. Will be ignored if htmlId is set or if a nested table step is used.
Nested Parameters
- step
- Required? yes
- A webtest step.
- table
- Required? no
- To locate a specific cell in a specific table on the page.
Details
The following example illustrates how to use the applyFilters step:
<invoke url="testDocBookmarks.pdf"/>
<applyFilters>
<pdfToTextFilter mode="groupByLines" description="extract PDF text (default mode: normal)"/>
<lineSeparatorFilter description="normalise line separators"/>
</applyFilters>
<verifyText text="Heading Two"/>
<verifyText text="NEW PAGE"/>
</steps>
Remember that the resulting filtered response doesn't correspond to what your application is actually producing so keep your usage of this step to a minimum.
See also: the verifyContent, storeDigest, storeLength, lineSeparatorFilter, replaceFilter, tagStripper and contentStripper steps.