# Writing tests

## Adding a new test

Midio comes with a simple interface for writing and running tests, found in the [`Testing`](https://docs.midio.com/midio-docs/built-in-nodes/core-std#testing) module.

To add a test, first add a [`Testing Test`](https://docs.midio.com/midio-docs/built-in-nodes/core-std#test) event node, and give it a name.

<figure><img src="https://1896308808-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRdFpuRAnTVYgmlCXLLou%2Fuploads%2FrEDN2JfGFSqNFtskAtID%2Fimage.png?alt=media&#x26;token=16854394-25f2-4846-b144-e97444137246" alt="" width="496"><figcaption></figcaption></figure>

If you open the 'Services' panel and click the 'refresh services list' button, you will get a new item called **Testing**. Click it to get an overview of all your tests, and buttons to execute them.

<figure><img src="https://1896308808-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRdFpuRAnTVYgmlCXLLou%2Fuploads%2FDoJjFZXtTO56LAfKy03x%2Fimage.png?alt=media&#x26;token=b2c2ec15-10fd-4e8c-bb27-4ed3e3a7653d" alt=""><figcaption></figcaption></figure>

## Assertions

The Testing module contains several functions which can be used to perform assertions during a test, like `Testing.AssertEqual`. These functions can only be used in the context of a test, and will report to the testing service whether they pass or fail.

<figure><img src="https://1896308808-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRdFpuRAnTVYgmlCXLLou%2Fuploads%2FwDJKQ3nPfeQiZUJos81Q%2Fimage.png?alt=media&#x26;token=2894314c-f15b-4153-88b3-fe0234899528" alt="" width="563"><figcaption></figcaption></figure>

You can then click on the **Run all** button to run all tests, or the individual **Run** buttons to run a single test at a time.

<figure><img src="https://1896308808-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRdFpuRAnTVYgmlCXLLou%2Fuploads%2FqHcP5y9bTqeCfPnz76BJ%2Fimage.png?alt=media&#x26;token=5afb2df0-d84e-4b7d-9b8e-42791dadd0da" alt="" width="332"><figcaption></figcaption></figure>

## Tips

Clicking on a test in the services panel will make the editor jump directly to where that test is defined.
