# 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:

![](/files/-LgrMjndSzO9ONPPuSAl)

**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](/master/node-types/assertion-node.md#failovoe-predstavlenie) Assertion file representation documentation in the `#/definitions/ScriptAssertion` definition.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.testmace.com/master/node-types/assertion-node/script.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
