Panel For Example Panel For Example Panel For Example

How to Get Large Models to Generate Desired Test Cases

Author : Adrian November 04, 2025

 Large Models to Generate Desired Test Cases

Overview

Using large models to generate test cases often requires significant technical work such as knowledge bases, model evaluation, fine-tuning, or retrieval-augmented generation. For many users, the fastest approach is to design effective prompts. By tuning prompts you can create a test-case generation module with a personal or company style: assign a role, provide business context, state personal preferences, define success criteria, and specify format rules. Treat the prompt template as a personal assistant that enforces each instruction so the model generates test cases in the style you expect.

This article uses the Data4Test intelligent test-case generation features as background to discuss how to make large models produce test cases that reflect individual or organizational style and requirements.

Contents

  1. Components of a test case
  2. Prompt design for test cases
  3. Prompt design for background information
  4. Intelligent template design on the Data4Test platform
  5. Elements suitable for direct assignment
  6. Elements handled during test execution
  7. Online trial
  8. GitHub project
  9. Local quick trial

Classify test case elements

To make the model useful, first analyze which elements the model should generate, which should be assigned directly to save tokens, and which only appear at execution time. For example:

  • Elements suitable for generation by the large model: (1)–(8), (10), (16), (18).
  • Elements suitable for direct assignment: (11)–(13), (17), (19).
  • Elements handled at test execution time: (9), (14), (15), (20).

After classifying elements, design targeted prompts for the parts the model should generate and prune the rest.

Design clear prompts for each element

For each element you want the model to generate, create explicit prompt instructions. The clearer the instructions, the more likely the generated results will meet requirements and reduce manual intervention. A complete prompt should tell the model exactly what kind of test case you want.

Define role and background information

After designing prompts for the key test-case elements, provide additional background about the test-case designer and the industry context. Tell the model what role it should assume, the responsibilities of that role, the work to be completed, and the business area involved.

Example intelligent template

Template content example:

  1. Role and background: You are an XX engineer with X years of testing experience, currently responsible for testing the XX system. Based on requirement descriptions, design test cases in the specified format.
  2. Test case requirements:
    1. Each case must include: case_id, case_name, case_type, priority, module, preconditions, test_scope, test_steps, expected_results, automation_supported.
    2. Case types: functional, negative, scenario, data, boundary, etc.
  3. Requirement description: {requirement_description_placeholder}
  4. Output format: Based on the above background, generate test cases. Example output format reference:

[{"case_id":"XXX","case_name":"XXX","case_type":"XXX","priority":"XXX","module":"XXX","preconditions":"XXX","test_scope":"XXX","test_steps":"1. XXX; 2. XXX; ...","expected_results":"1: XXX; 2: XXX; ...","automation_supported":"yes or no"}]

Multi-turn conversation settings

Configure multi-turn interactions to refine and expand results. Example flow:

  1. Round 1: Add more functional test cases.
  2. Round 2: Any further additions?
  3. Round 3: Add more performance test cases.
  4. Round N: Customize prompts as needed.

Combine with existing test-case platforms

Integrate the template with your test-case platform or tools to auto-fill elements that are better assigned directly. This is the LLM "pruning" concept. On the Data4Test platform, when configuring a test-case generation task, select the associated product and input the target version. Set the case designer as the operator. The platform can automatically populate surrounding metadata and speed up test-case management.