Datatransfer Teststep
Testing efficiently means to link Teststeps efficiently together. A testcase will often use a set data. Often, this come from previous stepsUse a Datatransfer teststep to transfer data from a SOAP or HTTP Teststep to a stored variable. A Datatransfer Teststep may contain a list of datatransfers of different types
Examples
- You must authenticate for a webservice through a security token service and provide a token for the business webservice under test.
- You receive a list of results and need to select a specific element for further test steps
Supported Datatransfer Value Providers
- XPath Value Providers
- XQuery Value Providers
- JSONPath Value Providers
- Text Value Providers
Overview
A Datatransfer Teststep can be created in the Teststep List View . Once it is created, selecting a Datatransfer Teststeps displays the following details view
- Create new XPath Value Provider, opens a dialog where you enter the name of the XPath Value Provider and creates a new list element.
- Create new XQuery Value Provider, opens a dialog where you enter the name of the XQuery Value Provider and creates a new list element.
- Create new JSONPath Value Provider, opens a dialog where you enter the name of the XQuery Value Provider and creates a new list element.
- Create new Text Value Provider, opens a dialog where you enter the name of the XQuery Value Provider and creates a new list element.
- Rename selected Datatransfer opens a dialog where you can change the name of the Datatransfer
- Result status of the current run displays an icon that visualizes the last run (success, failed, not started)
- Run selected Datatransfer(s) will run your configuration and displays the results for each Datatransfer ValueProvider in the selected list
- Enable/disable selected Datatransfer(s) will mark the ValueProviders to be included/excluded in Test runs
- Move selected Datatransfer(s) down can help you to better organize your ValueProviders.
- Move selected Datatransfer(s) up can help you to better organize your ValueProviders.
- You see the Datatransfer list (ValueProviders), which is empty when you create a new Datatransfer Teststep
- When you have may ValueProviders you may filter them by name, where we check the entered text to be contained in the ValueProvider name
- Pasteboard Commands
Configuration of ValueProvides
When yu want to extract data from SOAP/HTTP Teststep you will create one of the above mentioned ValueProviders. Each ValueProvider has its own functionality to get data from a request or response,
but the general approach is as follows
- You select a supported Teststep e.g. SOAP Teststep for Xpath or HTTP Teststep for JSONPath in the containing Testcase
- You select if you want to use the request or the response
- You configure/define you extraction logik (This is specific for each ValueProvider
- You attach am variable to Value Provider. All ValueProviders use a common view VariableValueTransfer to perform this task
- A test run is successful, if input teststep is defined, the type (request,responseI is configured, the extraction logic does not run into an error (e.g. wrong Xpath) and a variable is referenced by this ValueProvider
XPath Value Provider
An XPath Value Provider allows to enter an XPath and run the XPath against a defined request or response. The result is stored in a variable as described above.
When you create an XPath Value Provider and select it from the list, you get the following Details view:
- select input teststep is the first step where you pick a SOAP- or HTTP- Teststep that will hold a request/response
- When you have selected a teststep you can configure, if you want to read the request or response
- select XPath from existing request/response IF you have a teststep that holds a request or response you can select an element here. When the request/response is empty, the view will not show up
- enter your xpath allows you to enter an XPath, please make sure, you use XPath 1. When you edit the XPath we read the namespaces from request/response, otherwise you will have to edit it manually in the tab Namespaces
- Variable Value Transfer configures the referenced variable that will hold the Xpath expression result
XQuery Value Provider
An XQuery Value Provider allows you to enter a simplified XQuery or XPath expression (which supports unnamed prefixes like *:element) and run the expression against a request or response. The result is stored in a variable as described above.
When you create an XQuery Value Provider and select it from the list, you get the following Details view:
- select input teststep is the first step where you pick a SOAP- or HTTP- Teststep that will hold a request/response
- When you have selected a teststep you can configure, if you want to read the request or response
- enter your XQuery or XPath, this ValueProvider supports a simplified XQuery/XPath 2 expression. As you can use unnamed prefixes like *:element, there is no support for prefix/namespace mappings.
- Variable Value Transfer configures the referenced variable that will hold the Xpath expression result
JSONPath Value Provider
A JSONPath Value Provider allows you to enter a JSONPath expression and run the expression against an HTTP Teststep request or response
When you create a JSONPath Value Provider and select it from the list, you get the following Details view:
- select input teststep is the first step where you pick an HTTP- Teststep that will hold a request/response
- When you have selected a teststep you can configure, if you want to read the request or response
- enter your jsonpath that will select the elements from your request/response
- Variable Value Transfer configures the referenced variable that will hold the Xpath expression result
Text Value Provider
A Text Value Provider allows you to arrange a list of Text transformations in an ordered list to retrieve and transform text
To illustrate how it works, we added a screenshot with a ready-configured Text Value Provider that reads a JSON-response AND has linked a variable that holds the result
The operations are applied in the order in which they are defined in the list and can be enabled/disabled, moved up and moved down
You can include the following operations:
- select substring with providing start and end index
- startIndex 0 with endIndex 0 selects the first character
- startIndex -1 with endIndex -1 selects the whole text
- search and replace with providing the static search and static replacing text
- encode to base64 creates the base64 representation of the text
- decode from base64 recreates the original text from the base representation, which is disabled in this example
- Variable Value Transfer configures the referenced variable that will hold the Xpath expression result, which is done here for a variable on the Testcase