Generating Test Data
After applying DLP rules to production and capturing redacted traffic in a snapshot, you can generate realistic test data to replace REDACTED- tokens. This enables comprehensive testing with data that behaves like production data but contains no sensitive information.
Prerequisites
Before generating test data, ensure you have:
- A snapshot containing
REDACTED-tokens (created from production traffic after DLP rules are applied) - Access to the snapshot in the Speedscale dashboard
Applying Test Data Recommendations
The system automatically analyzes snapshots with REDACTED- tokens and generates recommendations for test data generation. These recommendations suggest appropriate test data types based on discovered patterns, field names, and context.
Reviewing Recommendations
Open the snapshot's Prepare tab and select a test-data suggestion under To review. Check the chain preview and several matching requests to confirm that the REDACTED- token becomes a suitable test value. A redaction suggestion removes sensitive values; it does not demonstrate test-data generation.
See the illustrated recommendation review workflow for the shared Prepare layout.
Selecting Recommendations
Available test data patterns include:
- Email Addresses: Realistic email addresses
- Phone Numbers: E.164 format phone numbers
- Credit Card Numbers: Valid format credit cards (test numbers)
- SSNs: SSN format (test values)
- UUIDs: Various UUID formats
- IP Addresses: IPv4 and IPv6 addresses
- Dates/Timestamps: Realistic dates and timestamps
- All supported PII patterns: Any pattern type supported by DLP
Applying Recommendations
Select Accept to stage the suggestion, then Save and reanalyze to save the changes. Inspect the transformed requests to verify the generated values before replaying. Use Ignore for an unsuitable suggestion or Skip to leave it for later. See Working through recommendations.
Creating Recommendations Manually
If automatic recommendations don't meet your needs, or you want to create test data for specific patterns, you can create recommendations manually.
Manual Recommendation Process
-
Identify REDACTED Tokens: Open your snapshot and open the Prepare tab, then either review the automatic recommendations under To review, or edit the snapshot transform chains manually to pinpoint a data token. Note the JSONPath locations and field names where tokens appear.
-
Determine Test Data Type: Based on the field names, context, and your knowledge of the data structure, determine what type of test data should replace each token.
-
Create Transform Chain: Recommendations will automatically create transform chains that can be modified. For manual creation, create a transform chain that:
- Filters: Identifies the RRPairs containing the tokens (using filters like path, method, service, etc.)
- Extracts: Selects the body with a Request Body or Response Body extractor, then the token's field with a JSON Path transform
- Transforms: Generates the replacement, for example with
dlp_fieldandreverse=true, which turns aREDACTED-token back into a value of the same kind, or withrand_stringand a pattern
-
Apply Transform Chain: Apply the transform chain to the snapshot to generate test data.
Example: Manual Email Test Data Recommendation
req_body() -> json_path(path="email") -> rand_string(pattern="(?:[a-z0-9!#$%&'*+\x2f=?^_`\x7b-\x7d~\x2d]+(?:\.[a-z0-9!#$%&'*+\x2f=?^_`\x7b-\x7d~\x2d]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9\x2d]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9\x2d]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9\x2d]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])")
This example:
- Extracts the request body using
req_body() - Extracts the
emailfield using JSONPath withjson_path(path="email") - Generates realistic email addresses matching the email pattern using
rand_string()to replaceREDACTED-tokens
For more information on writing transform chains, see Creating DLP Rules.
Next Steps
- Troubleshooting: when tokens are not replaced.
- Creating DLP Rules: turn on pattern discovery so tokens record the kind of value they replaced.