# Expected and received values differ

Classification: assertion-mismatch
Frameworks: Jest, Playwright, pytest
Canonical: https://automationtester.in/failures/assertion-expected-received-mismatch

## Recognizable error

```text
Expected: value Received: other-value
```

## What it means

The observed application result does not match the contract encoded in the assertion.

## Ranked causes, checks, and fixes

### 1. The product behavior regressed

The implementation now returns or renders a value outside the intended contract.

Diagnostic: Reproduce through the public behavior and compare with the requirement or API contract.

Fix: Repair the product and keep the assertion as the regression guard.

### 2. The assertion encodes stale behavior

A deliberate contract change may not have updated the test.

Diagnostic: Review the approved change and confirm which behavior is authoritative.

Fix: Update the test only when the contract change is explicit and reviewed.

### 3. Uncontrolled state changed the result

Time, locale, random values, or shared records can make the observation vary.

Diagnostic: Repeat with controlled inputs and inspect state boundaries.

Fix: Control the source of variation and assert the meaningful contract.

## Prevention

- Tie assertions to reviewed contracts.
- Control time, locale, and random sources.
- Keep failure diffs focused.

## Primary references

- [Jest expect matchers](https://jestjs.io/docs/expect)

Triage this failure locally: https://automationtester.in/tools/test-failure-triage