Guides / Test data
How to create Chargebee test data
Last updated
Good tests need realistic customers and subscriptions. Here's how to create them, and how to make sure you can create the same set again next week.
What good test data looks like
Aim for a small set that covers your real cases, not hundreds of random records. For example:
- A customer on each plan you sell.
- Monthly and yearly billing.
- Each currency you bill in.
- A customer with add-ons, and one with usage-based items.
- A customer in a trial, and one with a coupon.
The most important rule: keep the data in one place you can re-run. If test data only exists on the site, it's gone after the next cleanup.
The manual options
1. By hand in the Chargebee UI
Fine for two or three customers. Slow, and hard to repeat exactly.
2. Chargebee's bulk import
Chargebee lets you import customers and subscriptions from CSV files. It's faster than clicking, but the column format has to be exactly right, and finding out what failed takes time.
3. A script against the API
Create a customer with POST /api/v2/customers, then a subscription for that customer with the item prices you want. Scripts are repeatable, but someone has to write them, update them when the catalog changes and run them.
Tip: whichever way you choose, use clear IDs like test-eur-yearly-addons. You'll find records faster, and it's obvious they're test data.
The simple way with Testabee
- Keep your test customers and subscriptions in a simple table inside Testabee.
- Save sets with names like "Renewal tests" or "EU customers" and reuse them on any connected site.
- Load a set onto a test site in one go, with a preview before anything is created.
- Every import is recorded, so you can undo it and remove exactly what it created.
Combine it with a site reset and every test run starts from the same data.