Automation lab Aú API Interaction & Mocking (API_INTERACTION)

Lab 035: Handle 400 validation error from API

Practice handle 400 validation error from api in a real web app context as part of the API Interaction & Mocking module.

intermediate intermediate
intermediate

Objectives

Use for test scripts
  • Understand the purpose and business flow of handle 400 validation error from api.
  • Design stable locators for key UI elements.
  • Automate user interactions and verify the resulting UI state.

Sandbox

API & Network • api • intermediate • active

Handle 400 validation error from API

Surface server-side validation errors and keep form state.

Reading and understanding requirements Choosing stable locators Designing assertions based on business rules

Learning objectives

  • Handle 400 responses with field-level errors.
  • Keep user input intact on failure.
  • Display summary and inline errors.

Steps

  1. Submit invalid data to trigger 400.
  2. Assert summary + inline errors appear.
  3. Fix input and resubmit for success.

Practice sandbox

Trigger a 400 validation response.

Waiting for input

Assertions to practice

  • Summary + inline errors show on 400.
  • Inputs keep user-entered values.
  • Success after fixing errors.