# Testing


# Testing

Test what really happens, without it reaching a customer, a CRM or a sales rep: build in a **sandbox organization**. Ask your AutoUncle contact for one. It is in **safe mode**, so AutoUncle CoDriver runs everything (opportunities, follow-up messages, CRM deliveries, notifications, events) but nothing it would send leaves AutoUncle CoDriver.

- **Test leads.** Send `"test": true` with a lead. A test lead is a label: it never counts in reports, and events about it carry `"test": true`. It is otherwise processed in full, so outside safe mode it does reach the customer's address, the dealer's CRM and sales reps. Opportunities only test leads have reached say `"test": true` in the API, so a sync can leave them out.
- **Test clients.** Tick *Test client* when you create an API client. Every lead it pushes is a test lead.
- **Send a test lead.** **Settings → Developers → Send a test lead** pushes an invented lead through the same path an API client uses. It only works while the organization is in safe mode.
- **Test events.** On a webhook endpoint's page, **Send a test event** sends a sample of any event type, marked `"test": true`, to that endpoint right away and shows what it answered. The sample uses an invented customer.
- **Deliveries.** The endpoint's page lists recent deliveries with the HTTP status, timing and error, and resends any of them.

## Go-live checklist

1. Your test leads arrive and reach `processed` (`GET /api/v1/leads/{id}`).
2. Retrying a push with the same `Idempotency-Key` creates nothing new.
3. Your endpoint verifies signatures, rejects a tampered body, and dedupes on `webhook-id`.
4. A test event of every type you subscribe to is accepted.
5. You handle `429` (wait for `Retry-After`) and `5xx` (retry with backoff).
6. Switch to a live client (untick *Test client*), and watch the first real leads with the dealer.
