
# Testing using the Supabase CLI

You can use the Supabase CLI to test your database. The minimum required version of the CLI is [v1.11.4](https://github.com/supabase/cli/releases). To get started:

*   [Install the Supabase CLI](../../cli/index.md) on your local machine

## Creating a test[#](#creating-a-test)

Create a tests folder inside the `supabase` folder:

```
1mkdir -p ./supabase/tests/database
```

Create a new file with the `.sql` extension which will contain the test.

```
1touch ./supabase/tests/database/hello_world.test.sql
```

## Writing tests[#](#writing-tests)

All `sql` files use [pgTAP](../extensions/pgtap/index.md) as the test runner.

Let's write a simple test to check that our `auth.users` table has an ID column. Open `hello_world.test.sql` and add the following code:

```
1begin;2select plan(1); -- only one statement to run34SELECT has_column(5    'auth',6    'users',7    'id',8    'id should exist'9);1011select * from finish();12rollback;
```

## Running tests[#](#running-tests)

To run the test, you can use:

```
1supabase test db
```

This will produce the following output:

```
1$ supabase test db2supabase/tests/database/hello_world.test.sql .. ok3All tests successful.4Files=1, Tests=1,  1 wallclock secs ( 0.01 usr  0.00 sys +  0.04 cusr  0.02 csys =  0.07 CPU)5Result: PASS
```

## More resources[#](#more-resources)

*   [Testing RLS policies](../extensions/pgtap/index.md#testing-rls-policies)
*   [pgTAP extension](../extensions/pgtap/index.md)
*   Official [pgTAP documentation](https://pgtap.org/)
