Environment and Test Data Problems
When a test fails, first ask what failed: the product, or the setup it ran on. An environment problem is a fault around the build under test: a service that is down, an old build, a changed setting, an expired certificate. A test data problem is a record the test needs that is missing, in the wrong state, out of date or changed by someone else.
Example: a refund test fails with "Order already refunded". The product is right: another tester refunded that order an hour earlier, and a defect report would send a developer hunting for a defect that does not exist. This lesson follows the environment and data branches of the triage from the lesson on failed and blocked tests.
Why it matters
In the ISTQB Foundation syllabus, test execution includes analysing each anomaly for its likely cause, and a reported anomaly may turn out to be a false-positive result rather than a real defect. Environment and test data problems are typical causes of such false positives, and they can also produce false negatives, where a test passes although a defect is present.
Repeated setup failures also wear down trust in the results: a team whose runs are often red for setup reasons learns to ignore red.
Environment problems and their signs
Any layer of the environment from the lesson on test environments can break during execution, and each break leaves typical signs.
- Wrong build: an old or partial deployment; a fixed defect is back, or the reported version differs from the run's build.
- Dependency down: a database, queue, payment sandbox or SMS stub is unavailable. Connection errors, timeouts or the HTTP status codes 502 (bad gateway), 503 (service unavailable) and 504 (gateway timeout) appear across unrelated features; with these codes a server says that it, or a service behind it, cannot answer properly right now.
- Configuration drift: a feature flag, environment variable or service address differs from what the tests assume, so a feature is missing or calls the wrong system.
- Expired access: a test account password, an API token (the key one system uses to call another) or the environment's TLS certificate (what lets browsers connect over HTTPS); requests that worked yesterday are rejected with 401 (not authenticated), logins fail, or browsers refuse the connection with a certificate warning.
- Resources and interference: a full disk, exhausted database connections, or someone redeploying the shared environment during your run; failures begin in the middle of a run, or everything fails for a few minutes and then recovers.
Try it: API Health Checker Try it: HTTP Status Code Lookup Try it: JWT Expiration Checker
Test data problems and their signs
Many of a test case's preconditions are about data: customer C-101 exists, the order is paid and not shipped. A data problem means such a precondition was not true when the test ran, although the product may have behaved correctly.
Data can also hide a defect: a test of the first login, which should ask the user to verify their email address, runs on an account already verified in an earlier run, so the verification step never appears and the test passes even if verification is broken. Such false negatives are rarely investigated, because the result is green.
- Missing: the seed script did not run, or the baseline was not restored after a refresh.
- Wrong state: another test or tester used the record, so the order is already refunded or the account is locked.
- Collisions: parallel runs share an account, or "email already registered" appears because a previous run left its user behind.
- Out of date: a hard-coded date, coupon or test card has expired, or a copy of the data made months ago no longer matches the current prices or settings.
Telling them apart from product defects
Do not decide from the error message alone. Collect a few facts, cheapest first; together they usually point to one cause.
One trap: a wrong precondition does not excuse wrong behaviour. If an already refunded order produces a server error instead of a clear message, the data was wrong for that test, and the product still has a defect: it must handle that state safely. Fix the data and report the error handling separately.
- Pattern: many unrelated tests failing together point to the environment; one test or feature points to its data or the product.
- Timing: did the failures start with a deployment, a configuration change or a data refresh rather than with the change under test?
- Message: gateway and connection errors point to the environment; a business message such as "already refunded" says: check the data first.
- Baseline: is it the right build, are the dependencies healthy, is the record in the state the test case requires?
- Clean rerun: repeat with fresh data or in a second environment. A failure that persists in a healthy environment with correct data is not an environment or data problem: check the test case as in the previous lesson, and if it is right, report a product defect.
| Symptom | Usually points to | Check first | Record as |
|---|---|---|---|
| Many unrelated tests fail at onceconnection errors, timeouts, 502, 503, 504 | Environment: a dependency or the whole environment is down | Health checks; recent deployments and restarts | Environment issue; tests blocked |
| A fixed defect is back, or old screens appear | Environment: wrong or stale build | The version the environment reports against the build of the run | Environment issue; rerun after redeployment |
| A feature is missing or calls the wrong system | Environment: configuration drift | Feature flags and settings against the environment record | Environment issue; rerun after the fix |
| Passes alone, fails in a full or parallel run | Test data: shared or leftover records | Who else uses the record, and its state before the step | Own data for each test; rerun |
| "Already exists", "already refunded", "account locked" | Test data: a record in the wrong state | The record’s state against the precondition of the test case | Data fix and rerun; a defect only if the product mishandles the state |
| Started failing on a date, with no change | Test data or access: something has expired | Fixed dates, coupon codes, test cards, tokens, certificates | Renew the data or access; dates relative to the run from now on |
| One rule gives a wrong resulthealthy environment, correct data | Product defect | Reproduce with fresh data; compare with the requirement | Defect report |
- Outlined: the only row that goes straight to a defect report against the product
Likely causes, not verdicts: confirm each one with its check before you record it.
Worked example: 14 failures in one morning
By 09:40, 14 of 40 tests in the checkout regression run on build 4.1.0 have failed. Instead of filing 14 defect reports, the tester groups the failures by symptom and time and checks each group.
The nine API failures hit unrelated endpoints with the same 401 (not authenticated) from the first request at 09:00, which points to access rather than to any one feature. Decoding the test client's API token shows that it expired at midnight: one environment issue, and once the environment owner had renewed the token, all nine reruns passed. The coupon tests used a coupon whose fixed end date has passed. The order used by the refund test had already been refunded by another run, which explains the failure but not the server error (HTTP 500): that is a defect of its own. Only the VAT failure reproduces on fresh data in a healthy environment.
Result: one environment issue whose nine reruns passed after the token was renewed, two data fixes whose reruns passed, and two defect reports instead of 14.
Run: Checkout regression / build 4.1.0 / test environment / 09:00-09:40
Not passed: 14 of 40 (before triage)
API-01..09 401 Unauthorized from cart, address and order endpoints alike
test client's API token expired at 00:00 -> ENV-31, renewed, reruns passed
CPN-01..03 "Coupon expired"
coupon in the data has a fixed end date -> data fixed, rerun passed
RFD-04 500 error when refunding order O-7781
O-7781 refunded by another run at 08:50 -> data reset, rerun passed
a refunded order needs a clear message -> defect DEF-436
TOT-02 VAT calculated on the price before discount
same result on a fresh order, healthy env -> defect DEF-437Prevention: check the setup before the tests
In the ISTQB Foundation syllabus, the test environment is built and verified to be set up correctly during test implementation, before execution, and available environments and test data are among the typical entry criteria; ISO/IEC/IEEE 29119-3 describes readiness reports for both. Martin Fowler's article on non-determinism in tests names lack of isolation, remote services and time among the usual causes of unreliable results. The habits below target them.
- Smoke first: check the dependencies' health and run a short smoke test after every deployment, before planned testing.
- Check the build: compare the version the environment reports with the run's build.
- Own your data: unique records per tester and parallel run, created by the test or a script.
- Make data repeatable: restore a known baseline, and write dates relative to the run date.
- Announce changes: no deployments, restarts or data refreshes in the middle of someone's run.
- Log environment issues with an owner, and treat a cause that returns every week as a risk to fix, not a nuisance to work around.
Common mistakes
- Resetting the data and moving on when the product answered the bad state with a server error or a corrupted record.
- Fixing environment or data problems quietly, so the same problem returns next run and nobody sees the time lost.
- Sharing accounts between testers and parallel runs, and hard-coding dates and codes that expire.
The QA perspective
Testers rarely own environments or seed scripts, but they are often the first to see them break. Your job is a fast, evidence-based first diagnosis and getting the problem to the right owner: the developer for a product defect, DevOps or the environment owner for the environment, whoever maintains the test data for data. Warn the team channel as soon as a shared environment looks broken.
Record what you found, not only the status: the environment issue id, time window, build and affected tests, or the data record, its state and the fix. Some teams set up their tracker with an issue type or resolution such as "Environment" or "Test data" for reports that turn out not to be product defects; use it rather than deleting the report. Time lost and recurring causes belong in the execution report, the subject of the next lesson.
Practice exercise
Sort five failures by cause
Below is a snapshot of a run on staging. For each failure, decide whether it is most likely an environment problem, a test data problem or a product defect, then say what you record and which status the test gets.
Run: Orders regression / build 2.7.0 / staging / from 10:30
ID What the tester saw
ORD-03 Log in as rider R-12: "Account locked. Try again in 30 minutes."
ORD-07 Track order: empty map; console: 504 from maps-proxy, 10:31-10:44
ORD-08 Track order: empty map; console: 504 from maps-proxy, 10:31-10:44
ORD-11 Receipt: a tip of 5.00 SAR is added to the total twice
ORD-12 Cancel order O-5521: "Order already delivered"- Group the failures that share a symptom and a time window.
- For each group, name the likely cause and the check that confirms it.
- Record an environment issue, a data fix with a rerun, or a defect report, and set each status.
Show the model answer
ORD-07 and ORD-08 (environment): the same 504 from the maps proxy in the same 13 minutes. Check the health of the maps service, record one environment issue with the time window, set both tests to blocked and rerun them after the fix.
ORD-03 (test data): the message is a deliberate lockout, which normally follows repeated failed logins, so someone else using R-12, such as another tester or a lockout test, has used up the attempts. Check who else uses R-12, then have it unlocked or use your own rider account and rerun; note the data cause on the first result and record the rerun as a new execution. Suggest one rider account per tester.
ORD-12 (test data): "Order already delivered" is right for a delivered order; another test or the delivery simulator moved O-5521 on. Note the data cause and rerun with a fresh order in the preparing state, created by the test; the rerun gives the result.
ORD-11 (likely product defect): a calculation error. Reproduce it with a fresh order in a healthy environment; if the tip is counted twice again, record the test as failed and file a defect report with the order, the amounts and the expected total.
Result: one defect report, one environment issue covering two blocked tests and two data fixes, instead of five defect reports.
Frequently asked questions
Should I write a bug report for an environment problem?
Not a product defect report. Record it where the environment owner works, often as an environment issue in the same tracker with its own type or component, and link the blocked tests to it. If the cause is a script or a configuration that will also be used for production, such as a deployment step that forgets a setting, say so: that is a defect too, just not in the application code.
How long should I investigate before I report?
Only as long as the cheap checks take: the build, the health of the dependencies, the state of the data and one rerun with fresh data. Agree a short time box with your team. If the cause is still unclear, report what you know with the evidence, say which checks you made, and ask a developer to look with you; do not hold the information back.
Are intermittent failures environment problems?
Sometimes, but not by default. A test that fails only now and then can be caused by a slow dependency, by data it shares with other runs, by the test itself, such as a missing wait, or by a real race condition in the product, where the result depends on which of two simultaneous operations finishes first. The lesson on reproducing failures shows how to narrow it down; call it an environment problem only when the evidence says so.
References
- ISTQB Certified Tester Foundation Level (CTFL) v4.0The foundation syllabus of software testing: test levels and types, test design techniques, test management and tools.
- ISTQB GlossaryThe standard definitions of testing terms — test case, regression testing, severity, priority, boundary value analysis and the rest.
- ISO/IEC/IEEE 29119-3:2021 — Software and systems engineering — Software testing — Part 3: Test documentationTemplates and content for test documentation — test policy, strategy, plan, status and completion reports, incident reports.
- Eradicating Non-Determinism in Tests (Martin Fowler)Why flaky tests destroy a suite's value, their common causes (isolation, asynchrony, remote services, time, resource leaks) and quarantine as a response.
Practise with Mutqan tools
Check several API health endpoints at once and get status, latency and a pass/fail summary.
Look up any HTTP status code with its meaning, RFC reference and when to use it.
Check whether a JWT is expired, not yet valid, or how long remains until expiry.
Compare two API responses (e.g. staging vs production) and list every structural and value difference.
Generate UUID v4 (random) and v7 (time-ordered) identifiers in bulk, and validate existing ones.
One-stop factory for synthetic test data: users, customers, companies, addresses, numbers, dates and strings in JSON, CSV, SQL or XML.
Go deeper
Your progress on this topic
Not started
Mark the topic complete when you have studied it and done the exercise.
Sign in to track your progress
Mark topics complete, continue where you left off and unlock specialisation exams.