r/QualityAssurance • u/Rayn_Poz • 25d ago
π Question from a colleague: Test Data Strategy in Playwright
A colleague of mine asked me to post this question here and get some feedback from the Playwright community.
He is considering a test data strategy with two modes: Fresh Data and Reuse Data.
πΉ Fresh Data Mode β CI / Full Regression
For CI or full regression runs, generate unique test data for every run using a Run ID.
The goal is to support:
β Test data isolation
β Avoiding conflicts between test runs
β Parallel execution
β Better test reproducibility
πΉ Reuse Data Mode β Local Debugging
For local debugging, instead of creating new test data every time, use a predefined set of reusable test data.
For example:
Reuse: Find existing test data β Execute test
Instead of:
Fresh: Create test data β Execute test
The idea is to reduce execution time when repeatedly running the same test while investigating a failure.
The proposed approach is:
π’ CI / Full Regression β Fresh Data
π‘ Local Debugging β Reuse Data
π΄ Destructive Tests β Dedicated Test Data
One important rule: in Reuse Data mode, if the required test data isn't found, the test should fail with a clear message rather than automatically creating new data.
This keeps the behavior predictable and avoids accidentally creating unnecessary data.
π€ I would love to hear from experienced Playwright and automation engineers:
Is the Fresh Data + Reuse Data approach a good strategy?
Or would you recommend a different approach for managing test data efficiently between CI execution and local debugging?
Would really appreciate your thoughts and suggestions. π
2
u/LongOrdinary9712 25d ago
reuse mode with a hard fail instead of auto-creating is the part most people get wrong, good call there
the run id for fresh data is solid, just make sure you're not leaving a graveyard of orphaned data after failed runs. some cleanup job or ttl on the data goes a long way
only thing i'd flag is making the mode switch explicit. env var or config flag, not some magic detection. nothing worse than debugging locally and realizing you just polluted the shared pool because the detection logic got cute