liveBook · Manning

ChatGPT

As explained in Software Testing with Generative AI

ChatGPT is a conversational artificial-intelligence system that generates responses to user prompts using language-model technology.

ChatGPT is a conversational AI language model that generates human-like text from prompts. It can answer questions, provide explanations, write creatively, and adapt to testing and development tasks. section 2.0

Its practical value comes from focused prompting rather than autonomous replacement of developers or testers. Specific, incremental requests produce more useful results than broad requests, while people must verify generated code, assumptions, and behavior. section 4.0 section 7.1.3

Useful testing and development applications include:

  • Generate a Java HTTP client from a request such as “Write me some Java code that sends an HTTP request to a booking API,” then adapt and validate the result against a real endpoint. section 4.1
  • Improve UI automation interactively by asking ChatGPT to wait for a message list to load, then correcting API changes such as Selenium's Duration-based WebDriverWait. section 7.1.3
  • Explain unfamiliar service-layer code through comments, while checking that the code remains unchanged and confirming the resulting understanding with a visual model. section 8.2.1

From generic request to working check

Instead of asking for an entire contact-form test in one prompt, work through the check step by step: create the page interaction, wait for the message list, count messages, and improve the assertion to assertEquals(1, messagePage.getMessageCount()). This narrows each task and exposes missing waits or incorrect assumptions. section 7.1.3

private WebDriver driver;
private WebDriverWait wait;
 
@FindBy(className = "detail")
private List<WebElement> messageList;
 
public MessagePage(WebDriver driver) {
    this.driver = driver;
    // Adjust the timeout as needed
    this.wait = new WebDriverWait(driver, 10); 
    PageFactory.initElements(driver, this);
}
 
public int getMessageCount() {
    wait.until(ExpectedConditions.visibilityOfElementLocated(
      By.className("detail")));
 
    return messageList.size();
}

Inspect the generated page-object method that waits for the message list before returning its count; compare it with the corrected Duration-based version in b3. section 7.1.3

How Software Testing with Generative AI covers it

How deep it goes
Explains prompt use through worked code and testing examples, but stops short of treating generated output as reliable without verification.
Examples
Uses conversational prompts, Java API-client generation, Selenium page objects, contact-form checks, code comments, and visual process models.
What it assumes
Assumes basic testing or development context, while demonstrating prompt engineering and code understanding through concrete examples.
What you can do after
Apply it via focused prompts to draft code, improve automated checks, and clarify unfamiliar systems while independently validating results.
How it connects
Connects ChatGPT with large language models, prompt engineering, GitHub Copilot, test automation, exploratory testing, and hallucination risk.

Also explained in

Compare how 20 books explain ChatGPT →

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.