Acceptance Test Prompt Engineering eBook
Write Gherkin scenarios and acceptance tests using
by Connor Dick
Write Gherkin scenarios and acceptance tests using prompts that convert user stories into Given-When-Then format for test automation.
Formats
Free sample
Chapter 1: The Translation Trap--–- In a dimly lit conference room at a mid-sized fintech company, a senior QA manager named Priya stared at a spreadsheet that told a painful story. Her team of twelve testers had logged 1,247 hours last quarter writing acceptance tests. Yet despite this enormous effort, three critical bugs had reached production—each one traced back to a simple misunderstanding of a user story. The developers had interpreted “the user should not be able to submit the form twice” as a front-end disable button. The product owner meant a backend idempotency key.
The testers, working from the same vague sentence, had verified only the front-end behavior. No one was wrong. Everyone was wrong.Priya’s problem was not unique. It is the silent epidemic of modern software development: the translation trap.For three decades, the testing industry has focused on the wrong bottleneck. We built faster test runners, parallel execution grids, record-and-playback tools, codeless automation platforms, and sophisticated assertion libraries.
We mastered the art of execution. Yet acceptance testing remains slow, expensive, and error-prone. Why? Because the hardest part of testing has never been running tests—it has been translating a business requirement written in ambiguous human language into a precise, logical specification that a machine can execute.This book argues that we have reached the end of that era. The emergence of large language models (LLMs) capable of understanding narrative structure—of extracting preconditions, actions, and outcomes from plain English—has fundamentally changed what is possible.
The new bottleneck is no longer translation. It is prompt engineering: knowing exactly what to ask the AI to get reliable, production-ready acceptance tests.This chapter establishes the foundation for everything that follows. We will trace the evolution of the testing bottleneck, dissect why traditional approaches failed, define the core thesis of prompt-driven testing, and set realistic expectations for the journey ahead. By the end of this chapter, you will understand not just what this book teaches, but why it matters more than any testing methodology that has come before.The False Idols of Test Automation To understand where we are going, we must first understand how we got lost. The history of test automation is a graveyard of good intentions, each promising to solve the translation problem and each falling short because they addressed execution, not interpretation.The Manual Era (1990s–2000s): Testers wrote step-by-step scripts in Excel or Word documents.
A typical instruction read: “Click the login button, enter username, enter password, click submit, verify dashboard appears.” The bottleneck was execution—a human had to physically perform every click and keystroke. A full regression suite might take three days to run. The solution seemed obvious: automate the clicking.The Record-and-Playback Era (2000s–2010s): Tools like HP Quick Test Pro (now UFT) and Selenium IDE emerged, promising to “record” a tester’s actions and “play them back” at high speed. For exactly one week, this felt like magic. Then the UI changed.
A button moved from the left side of the page to the right. The recorded script broke. A developer added a new field to a form. The script broke. The CSS class names were regenerated by a build process.
Everything broke. The bottleneck shifted from execution to maintenance. Teams spent 80% of their time fixing broken locators and 20% actually testing.The BDD Era (2010s–2020s): Behavior-Driven Development (BDD) with Gherkin syntax (Given/When/Then) was a genuine leap forward. For the first time, tests could be written in a language that was simultaneously human-readable and machine-executable. A product owner could read Given the user is logged in and understand it.
A test automation engineer could execute it. The promise was collaboration. The reality was translation.Consider a typical BDD scenario:text Copy Download Scenario: User applies expired discount code Given the user has items in their cart totaling $100 When the user enters discount code "EXPIRED2024" Then the system displays "This code has expired" And the cart total remains $100This looks perfect. But who wrote it? In most organizations, the tester wrote it after interpreting the product owner’s spoken description and the developer’s implementation details.
The translation still happened—it just moved from test scripts to Gherkin. The bottleneck shifted again, this time to thinking. Writing good Gherkin is a high-skill, time-consuming activity that requires deep domain knowledge, logical rigor, and an instinct for edge cases. Junior testers struggle; senior testers are overworked.The AI Era (2024–present): Generative AI models like GPT-4, Claude 3.5, and Gemini can read a user story in plain English and output valid Gherkin in seconds. This is not magic.
It is pattern recognition. These models have been trained on millions of examples of narratives, requirements, and structured specifications. They understand that “user can log in” implies preconditions (user exists, not already logged in), actions (enter credentials, click button), and outcomes (redirect to dashboard, show welcome message).But—and this is crucial—they only understand this when prompted correctly. The bottleneck has shifted for the final time. It is now prompt engineering: the skill of crafting instructions that reliably extract the right logic from an LLM while suppressing hallucinations, enforcing business rules, and generating executable code.The Core Thesis: Prompt Engineering as a Testing Discipline This book advances a single, central claim: Prompt engineering for acceptance tests is a distinct software design discipline, not a curiosity or a productivity hack.
It requires its own patterns, anti-patterns, heuristics, and quality gates—just like test-driven development (TDD), behavior-driven development (BDD), or any other mature testing methodology.Why does prompt engineering deserve this status? Because the cognitive work that a QA analyst performs when writing a test—identifying preconditions, enumerating edge cases, anticipating failure modes, selecting appropriate assertions—is precisely the work that an LLM can perform if the prompt correctly scaffolds that reasoning.Consider the difference between a bad prompt and a good prompt.Bad prompt (the default for most beginners):“Write Gherkin tests for user password reset.”This is useless. The LLM has no context about rate limiting, token expiration, email delivery, or security constraints. It will generate a single happy-path scenario, miss all edge cases, and produce something like:text Copy Download Scenario: User resets password Given the user is on the login page When the user clicks "Forgot password" Then an email is sent Good prompt (using patterns we will teach in Chapter 4):*“You are a QA automation expert testing a password reset system with these rules: (1) Users are limited to 3 reset requests per hour, (2) Reset links expire after 15 minutes, (3) Links cannot be reused. Generate Gherkin scenarios covering the happy path, the rate limiting condition, the expired link condition, and the link reuse prevention.
Use strict Given-When-Then syntax. Include negative paths where the system rejects invalid attempts.”*The LLM will now generate four to six scenarios, each with proper preconditions and assertions. The difference is not the AI—it is the prompt architecture.Throughout this book, we will treat prompt engineering as a first-class testing skill. You will learn how to structure prompts for different scenario types (happy, sad, destructive, environmental), how to inject HTML context so the AI knows which buttons exist, how to chain prompts to generate Gherkin then code, and how to review…
This is the end of the free sample. Get the eBook to keep going. Buy now
About this book
Details
- Author
- Connor Dick
- Publisher
- SamEnrico
- Language
- English
- Genre
- Non-Fiction, AI Operator
- Released
- 2026-06-01
- Pages (approx.)
- 150
- Available as
- eBook, Audiobook
Read better in the ZLOADR app
Your eBooks on your phone or tablet. Sign in with your SamEnrico account and start reading.
More by Connor Dick
Hungary Green IncentivesConnor Dick$11.99
Women's Addiction Recovery MovementConnor Dick$11.99
Substance Abuse and PsychopathyConnor Dick$11.99
Social Factors in Cannabis Use DisorderConnor Dick$11.99
Learning Arabic in DubaiConnor Dick$11.99
Growth Mindset For Financial IndependenceConnor Dick$11.99
Autism Caregiver BurnoutConnor Dick$11.99
Profile Completion MeterConnor Dick$11.99
The Silk Road Pioneers: African Navigators of the Indian OceanConnor Dick$11.99
The Cairo Derby: A Clash of Titans in the Golden Age of Egyptian FootballConnor Dick$11.99
Understanding Menieres DiseaseConnor Dick$11.99
How to Produce Garden and Stepping StonesConnor Dick$11.99You may also like
Hong Kong Handover 1997Dunn Johnnie$11.99
Zumba For Postnatal Recovery CourseNeal Christian$11.99
Zumba for BeginnersLadner Nikia$11.99
YouTube Comment Mining GuideHumes Pandora$12.99
Worry Box MeditationCarlin Rudy$11.99
Workplace Stress MeditationNguyen Lynn$11.99
Workplace Stress and Sleep RepairHawley Ivory$11.99
Workplace Perfectionism CureDelaney Jeffry$11.99
Workplace Injustice Anger GuideWallen Isabelle$11.99
Work Addiction and Burnout LinkGreenwood Ester$11.99
Women in Yoga and WellnessBeattie Galina$11.99
Women in Stand Up ComedyChun Evangeline$11.99