Assertion
Last updated
Last updated
Assertion nodes are used in writing tests. Each Assertion node consists of several assertions - statements that allow you to test certain assumptions. When you run an Assertion node, you run all assertions. If any test raises an error, the entire Assertion node run is unsuccessful.
An Assertion node can only be created as a child of a RequestStep node. At the same time, a RequestStep node can have only one Assertion node as a child.
There are two ways to create an Assertion node. First, choose Add node -> Assertion from a RequestStep node context menu. Second, click + CREATE NEW ASSERTION NODE on the Assertion tab of the RequestStep node response area.
This is how an Assertion node looks like in the project tree:
If an Assertion node was run successfully, its icon in the project tree looks like that:
If an Assertion node was run unsuccessfully, its icon in the project tree changes to this:
There are several actions you can do with this node type:
Remove node. Use it to delete the node.
Run. Run the node.
Show in explorer. Open the folder with the node in the file manager.
The Assertion node tab has the following interface:
In the screenshot you can see the following parts of the interface:
The control panel
The settings panel for the chosen assertion
The list of all assertions
You can see the following buttons on the control panel:
RUN - runs all assertions in the list.
FIX ERRORS - fixes assertions errors if possible The button is available if there are some errors in the assertions. The error fixing algorithms are described for each assertion type separately.
DISABLE ERRORS - disables the failed assertions. They won't be included in further runs. The button is available if there are some errors in the assertions.
+ ADD ASSERTION - adds an assertion to the list.
The assertions list is right under the control panel. Each element of the list has the looks like this:
In the screenshot you can see the following parts of the interface:
Status highlighting. Its status is gray, if the assertion hasn't been run yet, red - if the run failed, green - if it was successful.
The assertion type icon.
The assertion type.
Delete the assertion.
Disable the assertion. It won't be included in the further runs.
Run the assertion.
Fix the assertion.
Note that the controls 4, 5, 6, and 7 appear when you hover the mouse over the assertion.
The interface of the settings panel depends on the chosen assertion type. We'll discuss all of them in the next sections.
An Assertion node is stored in the <nodename>.yml file, where <nodename> is the Assertion node name. The file has the following format: