Script
Last updated
Last updated
A Script assertion allows to write a JavaScript script to check an assertion. The script itself is a function named test
which takes an assertion object and an object with variables (in a key-value format) as arguments. If the function returns true
, the assertion was successful. If it returns false
or raises an exception, the Script assertion failed.
Deprecated syntax:
We strongly recommend you use a new way of writing test scripts instead of defining the test
function. You'll have an opportunity to apply the API to all entities in your project, use built-in helper libraries (e.g. lodash
and chai
), and define a detailed description for every test script, which will be shown in the error list and in the console.
Your tests written via the test
function will still be working, but in future major releases this syntax won't be supported.
Script assertions support the same API as Script nodes do.
ScriptIf while running a script an exception of any kind was raised, this Script assertion run is considered to be unsuccessful and successful otherwise.
This Assertion interface is similar to the one of a Script node:
The Name field allows to set a description for test of this kind.
This Assertion doesn't have any error fixing algorithm.
The assertion is of the script
type in the file. The type description can be found in the Assertion file representation documentation in the #/definitions/CompareAssertion
definition.