# Script

A **Script assertion** allows to write a JavaScript test script. The script itself is a function named `test`, that takes an assertion object and an object with variables (a key/value pair). If the function returns `true` the test is successfull. If it returns `false` or raises an exception, then the **Script assertion** failed.

The **Script** assertion interface is as follows:

![](https://1914040845-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LYfhIaTTw23Sf3L5jfe%2F-LgrKP3zFd8Pe9rytuu8%2F-LgrMjndSzO9ONPPuSAl%2F9.png?alt=media\&token=d18d4f82-07f7-4b8e-a441-98a9f34200fd)

**Script** is the only field this assertion has, and it contains the script described above.

### Error Fixing

This assertion doesn't have any error fixing algorythm.

### File Representation

The assertion has the `script` type in the file. The type description can be found in [Assertion file representation](https://docs.testmace.com/master/node-types/assertion-node/..#failovoe-predstavlenie) Assertion file representation documentation in the `#/definitions/ScriptAssertion` definition.
