# Interrupt Events

The test file supports events, automatically raised by funTEST while specified action occurs. These events are defined as a sub-programs with special label names and format:

```
*event(event-type{:args})
```

#### Parameter Description

<table data-full-width="true"><thead><tr><th width="133.33333333333331">Parameter</th><th width="115">Type</th><th>Options</th></tr></thead><tbody><tr><td>event-type</td><td>[string]</td><td>Event type to catch, see following section for supported events.</td></tr><tr><td>args</td><td>[string]</td><td>Optional arguments to specific event types.</td></tr></tbody></table>

Here is an example of how this looks like in a test file

<figure><img src="/files/Rdno0cILl6XajatccEwo" alt=""><figcaption><p>Interrupt event defined in a test file</p></figcaption></figure>

{% hint style="info" %}
Event sub-programs acts like standard asynchronously called methods (by funTEST), they can have passed some argument and must have a #return. Make sure that defined event is outside the main program loop. Recommended location is at the end of the test-file.
{% endhint %}

## Event Types

### <mark style="color:blue;">prj-closing (Project closing)</mark>

Occurs before the test file is closed. The closing can be refused by the #return argument

0 = refuse to close the test file, continue normally&#x20;

(otherwise) = finish closing

### <mark style="color:blue;">prj-closed (Project closed)</mark>

Occurs after test-file has been closed. Any GUI (Operator interface) command is denied here.

### <mark style="color:blue;">oper-changed (Operator changed)</mark>

Occurs after a new user is logged in (when another user is already logged in).

### <mark style="color:blue;">run-at (Run at specified time)</mark>

```
run-at:<hour>{:<min>{:<sec>}})
```

This label will be called by funTEST at specified time in a day. Call is repeated every day at this time. The time can be specified by hour only or also by minutes and seconds.

### Examples

<table data-full-width="false"><thead><tr><th width="238">Label</th><th>Description</th></tr></thead><tbody><tr><td>*event(run-at:1)</td><td>Run at 01:00.</td></tr><tr><td>*event(run-at:13:30)</td><td>Run at 13:30.</td></tr><tr><td>*event(run-at:15:10:30)</td><td>Run at 15:10:30.</td></tr></tbody></table>

### <mark style="color:blue;">run-every (Run every interval)</mark>

```
run-every:<ms>{:<sec>{:<min>{:<hour>}}})
```

This label will be called by funTEST repeatedly, after specified interval elapses. Time is defined by a sum of all parameters. It is possible to define the interval for example by only one parameter - passing i.e. 150 seconds is equivalent to 2 minutes and 30 seconds and so on. The next call is ignored when previous call is not finished.

### Examples

<table data-full-width="false"><thead><tr><th width="238">Label</th><th>Description</th></tr></thead><tbody><tr><td>*event(run-every:5)</td><td>Run every 0,5 second.</td></tr><tr><td>*event(run-every:0:30)</td><td>Run every 30 second</td></tr><tr><td>*event(run-every:0:0:60)</td><td>*event(run-every:0:0:0:1)</td></tr></tbody></table>


---

# 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://funtest-1.gitbook.io/funtest-documentation/creating-test-sequence/interrupt-events.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.
