Prefer officially reserved fictional ranges
Some numbering authorities publish values for drama, documentation or creative works. Examples include the UK's Ofcom drama ranges and specific Australian values published by ACMA. The North American plan reserves a limited set of 555 line numbers for entertainment and advertising use; not every number containing 555 is fictional.
Where no general fictional range exists, use conspicuous placeholders in documentation, isolate fixtures from communications systems and never trigger calls or messages. GetPhoneNum labels generated output as structural test data rather than a live virtual number.
Make fixtures deterministic
Random data makes failing tests hard to reproduce. Seed a fixture factory or keep a versioned dataset for automated tests. Give each case a stable identifier and record the scenario it exercises: national input, canonical E.164, invalid length, unknown country or unsupported service type.
{
"id": "gb-mobile-fictional-001",
"country": "GB",
"input": "07700 900123",
"e164": "+447700900123",
"expected": "valid_structure"
}Separate positive and negative datasets
A positive fixture should test one intended path. Negative fixtures should each fail for a known reason: too short, too long, invalid country code, alphabetic contamination, duplicated plus sign or a trunk prefix left inside an international value. If one fixture violates five rules, the assertion will not tell you which validation behavior regressed.
Protect staging and demo environments
- Disable outbound SMS and voice by default.
- Allowlist explicit internal destinations when delivery testing is required.
- Use provider test credentials or sandbox modes.
- Redact imported production contact data.
- Log attempted sends without exposing full numbers.
These controls matter even when your fixture source is careful, because a formatting mistake can transform a value into a different destination.
Useful official references
Review Ofcom's drama ranges, ACMA's creative-work numbers and the NANPA 555 reference. Use the GetPhoneNum responsible-use policy as a release checklist.