Comparison
Testlum has a function of comparison.
This function implies comparing the expected result with the actual one after the step is completed.
To compare test results, the following files are used:
expected
- expected test resultactual
- actual test result
Having the structure expected_1.json, actual_1.json - the number is put, depending on the step of the test scenario.
- Presence of
expected
file is a mandatory parameter for HTTP, SQL and noSQL requests.
The principle of operation on the example of postgres
:
<postgres comment="Check successfully adding Product to shopping cart"
alias="Shop" file="expected_11.json">
<query>
SELECT shp_cart_id, customer_id, shp_cart_code
FROM shopping_cart
WHERE merchant_id = 1
</query>
</postgres>
Steps
- Make a request specifying the
expected
file (with the scenario step number, in this case expected_11.json).- Create a file in the scenario folder with the name specified inside the
postgres
request (in this case, expected_11.json).- Leave generated expected_11.json empty.
- Run test scenario.
- After running the test scenario and executing this query,
comparison
will automatically generate anactual_file
with the scenario step number, see an empty fileexpected_11.json
and compare it with the query result received in actual_11.json. If the result of the request is satisfactory to the user, it will transfer all data from theactual
file to theexpected
file, for further comparison and successful completion of the test scenario.
comparison
- will generate the actual file only if the content betweenactual
andexpected
does not match.