← Back to Docs

AI Auto-Fix

Automatic error detection and code correction

When tests fail, WellTested’s AI analyzes the error, identifies the root cause, and automatically generates fixed code.

How It Works

When a test step fails:

  1. Error Detection - System captures error message, stack trace, request/response data
  2. AI Analysis - AI compares expected vs actual behavior and identifies root cause
  3. Code Regeneration - AI generates corrected code
  4. Validation - Fixed code is re-executed automatically

Common Error Types

Assertion Failures

Problem: Expected value doesn’t match actual

# Original
assert response.status_code == 200  # Got 201

# Fixed
assert response.status_code == 201

API Response Changes

Problem: API structure changed

# Original
user_id = response.json()['id']  # KeyError: 'id'

# Fixed
user_id = response.json()['user_id']

Type Mismatches

Problem: Wrong data type

# Original
assert age == "25"  # age is int, not str

# Fixed
assert age == 25

Using AI Auto-Fix

When a test fails:

  1. Click “Analyze Error”
  2. AI analyzes failure (5-10 seconds)
  3. Review suggested fix
  4. Click “Apply Fix”
  5. Test re-runs automatically

What Can Be Fixed

✅ Assertion adjustments ✅ Field name changes ✅ Type conversions ✅ Error handling ✅ Logic corrections

What Cannot Be Fixed

❌ API unavailable ❌ Invalid credentials ❌ Missing prerequisite data ❌ Wrong environment configuration

Next Steps


← Back to Documentation