How AI Transforms Test Case Creation: From Manual Pain to Automated Precision

This article demonstrates how AI tools like Coze and Cursor can automate the generation, validation, and execution of test cases, turning tedious manual processes into fast, accurate, and integrated workflows that boost testing efficiency and coverage.

转转QA
转转QA
转转QA
How AI Transforms Test Case Creation: From Manual Pain to Automated Precision

Preface

Test engineers staring at screens writing test cases, coding, fiddling with parameters need a new approach.

Test Engineer's Daily Evolution:

Past: Hand‑typing test cases until fingers numb, code reading causing headaches, frustrating interface error verification.

Present: AI generates test cases from requirements, tools handle code logic instantly, AI + engineering automatically validates interface errors.

Today we share a practical guide that turns a “bronze assistant” AI into a “king‑level partner”.

Part 1: Ten Minutes to 100 Test Cases – AI Test‑Case Factory

Uploading tables with dozens of fields, manually enumerating required, format, enum – copy‑paste fatigue and rule checking eye strain – a tester’s nightmare?

These repetitive “muscle‑work” rules are perfect for AI’s logical engine: it can clarify rules and generate test cases with a single click, tirelessly.

1. From Ideal Blueprint to Minimal MVP

Our ideal scenario is shown below:

But the ideal is costly; we therefore downgrade to the simplest MVP.

Prompt design focuses on three points:

Clear Structure & Precise Validation: “Three‑section + step indentation” skeleton – preconditions | steps → expected results, making dependencies obvious.

Immediate Result & Single Verification: Each step is followed by a dedicated result; each result validates only one point.

Full Coverage & Realistic Scenarios: Normal and at least one abnormal case per function point.

Normal/Abnormal Binding: Pair each feature with normal and abnormal scenarios to close gaps.

Exhaustive Paths & User Perspective: Force AI to consider all boundary cases and mimic real user flows.

Machine‑Readable & Efficient Implementation:

“Precondition | separator + .md output” – concise format for AI parsing, generating standard Markdown ready for import.

“Modular terminology” – unified classification of feature modules for easy organization and maintenance.

Initial Prompt:

你是一位互联网公司的资深测试工程师,需要根据以下需求内容和输出要求,生成测试用例,必须保证每一个功能的测试点的正常和异常场景没有遗漏
输出要求和示例格式如下:
1、按照前置条件、操作步骤、预期结果的结构进行
2、前置条件尽量简洁,若存在多条无论内部有多少层级,都按照 | 进行分隔,展示在同一个内容框中
3、使用多级缩进明确步骤依赖关系(如 输入→填写→点击 形成三级嵌套)
4、每个操作步骤后紧跟专属预期结果,避免结果滞后。
5、不允许一个预期结果包含多个验证点。且预期结果必须为用例的末节点,末节点必须为预期结果。
6、需贴合真实用户的操作流程,覆盖可能存在的所有正常路径和异常路径。
7、每个测试点必须独立包含:正常场景用例 和 至少一个异常场景用例
8、以.md代码进行输出
输出格式示例:
# 用例名称
## 1、功能模块
### 1.1、功能点
 - **前置条件**:条件1|条件2|条件3
    - **操作步骤**:
        - 1.点击上传
            - **预期结果**:弹出上传弹框
            - 2.选择文件
                - 3.点击确定按钮
                    - **预期结果**:toast提示:文件上传成功
需生成用例的需求内容如下:{{INPUT}}

2. From Problem‑Driven to Precise Optimization

After the first rollout, three high‑frequency issues were identified:

Unstable Markdown output affecting downstream conversion.

Occasional missing feature modules.

Low usability of abnormal cases, producing invalid test cases.

Problem‑Driven Prompt Iteration:

MD drift → lock format: enforce Markdown code block output.

Coverage gaps → coverage check: AI self‑inspects and fills missing cases.

Low abnormal case quality → precise definition: enforce ≥30% abnormal cases with defined scope.

Two major time‑consumers were identified:

Inconsistent requirement document formats (prototypes, tables, flowcharts) requiring manual processing.

Manual copying of prompts, causing finger fatigue.

3. Automation Leap: Integrating Workflow

We introduced Coze workflow to eliminate copy‑paste of prompts, automatically recognize document content, and organize it.

Add document recognition module to parse and structure text.

Add prompt node to skip manual copying.

Coze trial address: https://www.coze.cn/store/agent/7516903547016511523?bot_id=true&bid=6gtgu37482g1b

Workflow results:

90% accuracy in recognizing text and table images; recognized content can directly generate test cases.

Test‑case generation efficiency increased by 20%.

Note: AI‑generated cases still require manual verification.

Part 2: Cursor Mine‑Sweeper – From Blind Guessing to Millisecond定位

1. Fast Error Localization

Example: Front‑end developer reports an error when publishing a product; back‑end is absent; QA searches logs and code for hours.

Operation: Identify the failing service and interface, open the project in Cursor, and ask:

I am calling hero_social_interaction/postCommodity and get “permission restricted”. Help find the cause and troubleshooting steps.

Result: The back‑end had the user on a blacklist.

Resolution took 3 minutes.

2. Clarify Business Logic

Example: Need to quickly understand membership renewal logic for upcoming feature.

Operation: Query Cursor with a detailed prompt about renewal formulas, conditions, examples.

Explain the membership renewal logic, including conditions, generic formula, examples, and any essential details.

Outcome: Previously required reading multiple documents; now a single query provides the answer.

Business knowledge is also synthesized.

3. Analyze Code Bugs

Example: Developer changed interface A implementation; how to ensure sufficient coverage?

Operation: Open the changed branch in Cursor and ask it to analyze potential bugs.

Analyze potential bugs in this implementation: (set value semantics, null pointer, Java syntax issues).

Result: Cursor quickly identified white‑box issues.

Additional optimizable code was discovered.

Summary of Cursor Benefits

Problem localization ↑80%: Directly feed error messages to AI for instant answers.

Complex logic understanding ↓70%: Query AI to grasp business flow instantly.

White‑box depth ↑50%: AI analysis reveals hidden bugs early.

Cursor can also suggest additional abnormal test scenarios, but beware of AI hallucinations.

Part 3: From Separate Test‑Case Writing & Execution to Integrated Generation & Execution

Still struggling with endless abnormal interface test cases?

Solution: Combine exhaustive generation with automatic execution.

Coze + Cursor enable code generation and HTTP‑based test execution.

Cursor assists code generation: Expose HTTP endpoint for test cases, let Cursor generate code. Coze generates cases & HTTP calls: Automatically creates and runs test cases (illustrated).

Prompt for Abnormal Cases: Addresses completeness, validation depth, and format constraints.

Completeness – cover all interfaces and fields.

Validation depth – define required/optional, type errors, etc.

Standardization – sequential case IDs, YAML output.

Final prompt ensures AI‑generated cases deeply cover exceptions, are structurally sound, and safely executable.

角色:你是软件测试专家,专注接口测试
任务:根据传入的接口文档,生成每个接口都有完整信息的接口测试用例,确保能够每个接口完整生成符合要求的yaml。
生成基本规则:
1. 每个接口的用例集,所有必填项字段要单独验证,所有要单独验证(传值和不传值),所有入参数据类型错误要单独校验(比如数字格式以中文请求)
2. 确保生成传入文档中所有接口的测试用例,不遗漏任何接口
3. 每个接口每个字段全面地生成异常case,...(省略)

Remember to set the model to maximum tokens for long API docs.

Interface document screenshots and AI‑generated cases are shown (images).

Conclusion

Abnormal interface cases have moved from “manual entry + platform run” to “auto‑generate + auto‑run”, achieving ~90% coverage and cutting test time by 60%.

Key findings:

Automated generation and execution close “missing parameter” vulnerabilities.

Simulated abnormal data exposes system tolerance issues.

Further business‑flow testing still needs knowledge bases and exploration.

Outlook

Future AI should have system‑level vision, integrating requirements, code, defect history, constraints, and user scenarios to precisely locate high‑risk regression targets after code changes.

We continue to explore how AI can better serve testing; please share your insights in the comments.

AIprompt engineeringsoftware testingtest automationCursorCoze
转转QA
Written by

转转QA

In the era of knowledge sharing, discover 转转QA from a new perspective.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.