# Testing

Try a form on localhost, use test mode, and read the test answers that never count.

You can try a form as often as you like without touching your numbers. Answers sent from your own machine, or while a form is in test mode, are test answers: the form shows a Test ribbon, and the answer is kept for a week so you can check it, then removed. Test answers never count anywhere.

## Test on localhost

Add your development address to the form's allowed sites. On the form's **Install** tab, under **Allowed sites**, add the origin your page runs on, with its port:

```text Allowed sites
http://localhost:3000
http://127.0.0.1:5173
```

Each port is its own site, so add the one your dev server uses. Plain `http` is accepted for `localhost` and `127.0.0.1` only; every other site must use `https`. The Install tab marks these entries with a **Test answers** pill.

Every answer from `localhost` or `127.0.0.1` is a test answer, on every form and also in production. That means you can leave your development address on a live form's allowed sites: nothing sent from it will ever mix with real answers.

## What a test answer does

A test answer goes through the same checks as a real one: the form's version, required questions, follow up questions, contact rules and signed tokens. Only the one answer per person rule skips test answers (see below). What changes is what happens after it is stored:

- The form shows a Test ribbon while it runs as a test.
- It is not counted in **Results**, in CSV exports or in the [REST API](https://onestar.sh/docs/feedback/rest-api.md).
- It does not count toward your monthly answers or a form's answer limit.
- It sends no [webhook](https://onestar.sh/docs/feedback/webhooks.md) events and posts nothing to Slack.
- Its written answers are never read for themes.
- It is removed, with its written answers, a week after it arrived.

A form drawn on `localhost` or in test mode is not counted as a load either, so the shown, started and finished numbers on Results stay real.

When you send answers from your own UI with `onestar.submit`, the receipt's `test` field tells you which kind you got:

```json receipt
{ "id": "5c0e7d2a9b8f4e61a3d2c4b7e9f01a6d", "state": "received", "test": true, "thanks": { "title": "Thanks, that helps.", "body": null }, "write": "..." }
```

## Test mode

Test mode turns every answer to a form into a test answer, wherever it comes from. Switch it on under **Test mode** on the form's **Install** tab.

Test mode applies at once to the live form. Real visitors see the Test ribbon too, and their answers are kept as tests and removed after a week. Use it before you launch, while only you and your team have the link, or on a staging site. To test a form that is already live with real people, add `localhost` to its allowed sites instead and leave test mode off. The Install tab warns you while test mode is on for a live form.

## See your test answers

The **Test answers** card on the form's **Install** tab shows how many test answers arrived in the last 7 days and when the latest one came. **See test answers** opens the list: when each answer came, the site it came from, whether it was finished, and every question with its answer. Use it to confirm that an install sends what you expect, including follow up questions and context like the app version.

## Answer again

The server does not apply the one answer per person rule to test answers, but the browser remembers that it answered. After a finished answer, a form set to one answer per person shows its thank you message on that browser. To answer again, open the page in a private window, or clear the site's storage entries whose names start with `onestar:`.

## Going live

When the install works, check the form from a real allowed site that is not `localhost`, with test mode off. That answer counts: it shows in **Results** within a minute. See the [Quickstart](https://onestar.sh/docs/feedback/quickstart.md) for the whole path, and [Troubleshooting](https://onestar.sh/docs/feedback/troubleshooting.md) if nothing shows up.
