AI Test Design

How to Generate Test Cases from a User Story Using AI

A practical workflow for turning a user story and acceptance criteria into reviewed positive, negative, edge, and permission test cases with AI.

By AutomationTekAI8 min read
AutomationTekAI workflow for generating test cases from a user story

A user story explains a user goal, but it rarely contains every detail needed for a reliable test suite. AI can accelerate the first draft if you provide explicit context and then review the output like a tester—not like a copy editor.

1. Prepare the user story

Start with the role, goal, value, acceptance criteria, validation rules, permissions, and failure behavior. Avoid passwords, tokens, customer records, or other sensitive production data.

As a registered customer,
I want to reset my password,
so that I can regain access to my account.

Acceptance criteria:
- The reset link is sent only to a registered email.
- The link expires after 30 minutes.
- The new password must meet the documented password policy.
- A used or expired link must show a clear error.

2. Ask for a balanced set of test types

Request positive, negative, boundary, security-relevant, and permission scenarios that are supported by the story. Do not ask the model to invent undocumented rules.

3. Generate with AutomationTekAI

  1. Open the Generate workflow.
  2. Choose the text or user-story source.
  3. Paste the sanitized story and acceptance criteria.
  4. Select the testing approach that matches your risk.
  5. Generate, then compare each result with the source.

4. Review the AI output

Check that every expected result is observable, every precondition is achievable, and every case traces to a requirement or known risk. Remove invented screens, fields, status codes, and policies.

IDScenarioExpected result
US-01Request reset for a registered emailA neutral confirmation is shown and the reset message is sent.
US-02Open a reset link after 30 minutesThe expired link is rejected with a recovery action.
US-03Submit a password that violates the policyThe change is blocked and the applicable rule is explained.

5. Refine and export

Add project-specific test data, environment constraints, traceability, and priority. Export the reviewed version into your normal QA workflow. If you use an automation starter, replace placeholder selectors and assertions before execution.

Common mistakes to avoid

  • Providing only the one-line story and expecting complete coverage.
  • Keeping plausible but undocumented AI assumptions.
  • Using real customer data in examples.
  • Automating the draft before expected behavior is confirmed.

Frequently asked questions

Can AI generate complete test coverage from one user story?

No. AI can create a useful first draft, but coverage still depends on requirement quality, product context, integrations, data rules, and human review.

Should acceptance criteria be included in the prompt?

Yes. Include acceptance criteria, roles, business rules, limits, permissions, and expected errors so the draft is grounded in explicit behavior.

Can I export the generated cases?

AutomationTekAI offers several export workflows in the application. Availability depends on the selected format and account access.