-
Notifications
You must be signed in to change notification settings - Fork 11
The CSV (Comma-separated Values) format is a data format, which provides an easy way to define data. Like YAML, you can define Requests, Validations and Subrequests with CSV files.
Outline:
The first uncommented line of the CSV file is called the header of the file and defines, where which element is. This header states which row defines which value. The order, in which the headers are defined, is largely irrelevant. The single exceptions are variables.
| Header | Value | Used with Type | Default |
|---|---|---|---|
| Type | A, XA, or S | - | A |
| Name | String | A, XA | Action-<NumberOfAction> |
| Url | String | A, XA, S | No |
| Method | GET,HEAD, POST,PUT,DELETE,TRACE,OPTIONS | A, XA | GET |
| Parameters | Parameters seperated by & | A, XA | No |
| ResponseCode | Integer | A, XA | 200 |
| XPath | String | A, XA | No |
| RegExp | String | A, XA | No |
| Text | String | A, XA | No |
| Encoded | Boolean | A, XA | false |
Since most of these are self-explanatory or work like their counterpart in Yaml, this guide only explains the differences.
The Type defines, what kind of request is stated. There are three types of requests:
-
Adefines an action. That means, it's a normal HTTP request. -
XAdefines a Xhr Subrequests. The subrequest gets appended to the last defined action. -
Sdefines a static subrequest. The subrequest gets appended to the last defined action.
Parameters must be defined like this:
..., parameters, ...
..., param1=v_1¶m2=v_2, ...
Therefore, pairs of parameters must be separated by a &. The name and the value of a single parameter must be separated by a =.
To specify, whether or not parameters need to be encoded, the encoded keyword is used.
To extract an element for validation purposes, you can either use XPath or RegExp.
Please note, that you cannot use multiple XPath/RegExp expressions in a single action and cannot combine both.
To validate the extracted element, the Keyword Text is used. However, the value of Text is interpreted as pattern. Thus, the validation method is a Matches Validator.
Furthermore, the validation name is set to Validate <ActionName>. However, should Name not be mapped, the validation name will be an empty string.
For variables, you need to use a separated header for each variable, depending on the extraction method.
..., xpath1, ...
..., expression, ...
Variables starting with xpath extracts expression via XPath and stores the result.
..., regexp1, ...
..., pattern, ...
Variables starting with regexp matches pattern and stores the result. Please note, that in version 2.1.0 capturing groups do not work!
If expression or pattern is empty, the value of the variable does not get overwritten.
Notes:
- You can use any string after
xpathandregexprespectively. - Variables are always resolved at the end of the action, regardless of the order of the headers.
- Variables are resolved in order from the left-most header to the right-most header. Therefore, should the header order be
xpath-12, xpathFourth, xpath-title, a new value is assigned forxpath12beforexpathFourthis looked at. This means, shouldxpathFourthusexpath12in it's extraction expression, then the newly extracted value ofxpath12is used.