UUID guide
Generate UUIDs for testing
Fresh UUIDs are handy when you need realistic IDs for fixtures, API examples, seed data, or manual testing.
Why copied IDs cause trouble
Reusing the same copied ID across tests can hide bugs or create duplicate-key failures. Generating a small batch gives each test row or request a clean value.
Example
Count: 10
Version: v4
Format: lowercase with hyphens
Ten UUIDs, one per line, ready for fixtures or requests.
How to make a useful batch
- Choose UUID v4 for simple random test IDs or UUID v7 when order is useful.
- Generate the number of IDs you need instead of copying the same ID repeatedly.
- Copy plain text for fixtures or JSON when your test data expects an array.
Keep test data boring
Good fixture IDs should be unique enough to avoid collisions and plain enough that another developer can copy them without special setup.
If a test checks sort order, generate UUID v7 values together. If order does not matter, UUID v4 is usually simpler and more familiar.
Common mistakes
- Using the same UUID in several rows that should be unique
- Pasting production identifiers into test fixtures
- Changing UUID case when a system compares IDs as strings
- Treating UUIDs as passwords or private tokens
Related problems
FAQ
Can UUIDs be used as test secrets?
No. UUIDs are identifiers, not secrets. Do not use generated UUIDs as passwords or API keys.
How many IDs should I generate at once?
Generate only what you need for the fixture or request you are working on. Small batches are easier to review.
Should test UUIDs be uppercase?
Most systems use lowercase UUIDs with hyphens. Match the format your app already uses.