User Interface
Edit a request in text mode
An XML module editing screen makes it possible to edit, and define variables for, the request XML content. This XML content is displayed in an enhanced text field with syntax highlighting.
The text field provides a number of features and keyboard shortcuts:
- Right click on the mouse: displays the context-sensitive menu
- CTRL+Z: Undo last change
- CTRL+Y: Re-do last change
- CTRL+X: Cut selected ext
- CTRL+C: Copy selected text
- CTRL+V: Paste text copied to clipboard
- CTRL+F: Search text
- CTRL+R: Search and replace text
- CTRL+G: Go to line number...
When the request XML content has been modified, the changes can be saved by clicking on the Apply button. If a problem is detected, an error message notifies of the problem and the changes are ignored. When no problem is detected, the changes are applied.
The text field features an auto-complete function that makes entering variable names easier.
Edit a request in advanced mode
To access the advanced XML editor, it is necessary to select a request, and click on the Advanced XML editor button.
The editor is made of the following tabs:
- Flat XML allows editing the XML text.
- XML Tree is used to edit the nodes of the XML tree using the open tree view. The variable picker in this view makes it especially useful when using variables. If a node value contains a variable, and this variable is already encoded, the option not to encode it XML-wise is available. In this case, NeoLoad adds the attribute NeoLoad-encode="false" to the corresponding node, visible in the Flat XML tab. This additional attribute is deleted during the XML encoding phase of the test and is not sent to the server.
- Preview provides a read-only preview of the body of the request to be sent. The variables are interpreted and the carriage returns deleted.
The Apply button must be clicked to save any changes made to the request.
Rules for using variables
You may use NeoLoad variables in a request XML content. To do this, you need to use the expression ${VariableName}, which NeoLoad will replace with the value during the test. All the elements in the XML request may be variabilized.
- Warning: Using a variable other than in an element content (for example, to replace an XML node) will use up a large amount of system resources.
Validate an XML response
Validating a response in XML format is almost identical to the standard procedure. For more information about validating an HTTP request, see Validation.
You may define validations on the XML response using XPath. To recap, XPath is a syntax that points to a portion of an XML document.
For an XML request, response validators may be created:
- For the entire response: these are standard validators that validate the response content.
- For a particular XML node: these are validators specific to the XML modules. An XML node can then be specified by selecting it in the dialog box that is displayed by clicking on the magnifying glass next to the field.
This will create an XPath expression based on the selected XML node. You may edit the expression manually, but make sure the XPath expression remains valid. The XPath expression may be variabilized.
You will then return to the normal procedure, except that instead of carrying out the validation on the entire server response, it will be done only on the part specified by the XPath expression.
- To create a response validator using XPath
- Create a validator.
- Select the option On a particular node.
- Click on the magnifying glass next to the text field below and select the XML node to be validated.
- Click OK. The XPath expression for the selected node is displayed in the text field.
- Select the text to be validated by clicking on the magnifying glass next to the text field below.
- Warning: Response validations on XML nodes are resource-consuming operations. Only use this type of validation if absolutely necessary.
Extract variables in an XML response
The procedure for extracting variables in XML-format response is almost identical to the standard procedure. For more information about extracting variables in a standard HTTP request, see Variable extractors.
Variable extractors may be defined on an XML node.
- To create a variable extractor using XPath
- Create an extractor.
- Check the XPath expression checkbox.
- Click on the magnifying glass next to the text field, and select the XML node to be extracted.
- Click OK. The XPath expression for the selected node appears in the text field.
- Define your extractor on the XML node text.
The following screen shots show the normal and advanced variable extraction modes. The red frames highlight the parts that change in the case of an XML request.
- In normal mode:
- In advanced mode:
- Warning: Extracting variables on an XML node are resource-consuming operations. Only use this type of extraction if absolutely necessary.
Home