---
title: "Generating Test Data | Speedscale Docs"
description: "Learn how to generate realistic test data from redacted production snapshots by applying recommendations or creating them manually."
canonical: "https://docs.speedscale.com/guides/dlp/test-data-generation/"
---

[Documentation index](https://docs.speedscale.com/guides/llms.txt) | [Markdown](https://docs.speedscale.com/guides/dlp/test-data-generation/index.md) | [Canonical page](https://docs.speedscale.com/guides/dlp/test-data-generation/)

# 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.

<a id="prerequisites"></a>

## 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

<a id="applying-test-data-recommendations"></a>

## 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.

<a id="reviewing-recommendations"></a>

### 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](https://docs.speedscale.com/guides/transformation/recommendations/) for the shared Prepare layout.

<a id="selecting-recommendations"></a>

### 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

<a id="applying-recommendations"></a>

### 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](https://docs.speedscale.com/guides/transformation/recommendations/#working-through-recommendations-in-the-prepare-tab).

<a id="creating-recommendations-manually"></a>

## 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.

<a id="manual-recommendation-process"></a>

### Manual Recommendation Process

1.  **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.
    
2.  **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.
    
3.  **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_field`](https://docs.speedscale.com/guides/transformation/transforms/dlp_field/) and `reverse=true`, which turns a `REDACTED-` token back into a value of the same kind, or with `rand_string` and a pattern
4.  **Apply Transform Chain**: Apply the transform chain to the snapshot to generate test data.
    

<a id="example-manual-email-test-data-recommendation"></a>

### Example: Manual Email Test Data Recommendation

```text
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 `email` field using JSONPath with `json_path(path="email")`
*   Generates realistic email addresses matching the email pattern using `rand_string()` to replace `REDACTED-` tokens

For more information on writing transform chains, see [Creating DLP Rules](https://docs.speedscale.com/guides/dlp/creating-rules/#writing-a-chain).

<a id="next-steps"></a>

## Next Steps

*   [Troubleshooting](https://docs.speedscale.com/guides/dlp/troubleshooting/#test-data-is-not-generated): when tokens are not replaced.
*   [Creating DLP Rules](https://docs.speedscale.com/guides/dlp/creating-rules/#pattern-discovery): turn on pattern discovery so tokens record the kind of value they replaced.
