liveBook · Manning

State management

As explained in Software Testing with Generative AI

State management is the control and maintenance of the system conditions required for an operation or test.

State management controls the system conditions needed for an operation or test. In UI automation, choose the layer that creates the required state most efficiently: create a message through an API instead of navigating the Contact Us form when the check only verifies its display in the Admin panel. section 7.2.1

A practical workflow is:

  • Capture the UI-generated HTTP request from browser DevTools, select the Network tab, submit the form, and copy the request as curl. section 7.2.1
  • Prompt an LLM to convert the curl request into a Spring method that accepts a POJO payload and does not parse the response. section 7.2.1
  • Create the payload in Java and send it before the UI assertion, reducing slow and potentially brittle setup. section 7.2.1

Creating a message before an Admin-panel check

Replace form interactions such as entering name, email, phone, subject, and description with a MessagePayload populated in Java and passed to a request sender. Keep the UI portion focused on verifying that the resulting message is visible. section 7.2.1

###
curl 'https://automationintesting.online/message/' -X POST -H
➥'Accept: application/json' -H 'Content-Type: application/json'
➥--data-raw '{"name":"Mark","email":"test@test.com",
➥ "phone":"071234567890","subject":"This is a test message",
➥ "description":"This allows me to create a message rapidly"}'
###

Inspect the captured curl request that supplies the concrete endpoint, headers, and message payload for the API-based setup. section 7.2.1

How Software Testing with Generative AI covers it

How deep it goes
Demonstrates request capture, prompt constraints, POJO modeling, and API setup, but omits HTTP-response parsing.
Examples
Uses a Contact Us message, a captured curl command, a Java MessagePayload, and an Admin-panel visibility check.
What you can do after
Apply it via API calls and Spring-based Java helpers to make UI checks faster and less brittle.
How it connects
Connects UI automation, API calls, HTTP requests, test data management, and selective tooling.

Also explained in

Compare how 9 books explain state management →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Software Testing with Generative AI. The section links point to the parts of the book it draws on.