Skip to main content
Experience faster, smarter testing with BrowserStack AI Agents. See what your workflow’s been missing. Explore now!
No Result Found
Get your setup working faster. Join our Discord for optimisation tips from elite testers. Join our DiscordJoin our Discord

Refine your test cases with Iterative prompting

Use iterative prompting to refine AI-generated test cases in a conversational workflow over multiple rounds for a tailored final output.

Generating the perfect test cases from a single prompt or document can be difficult. Iterative prompting solves this. After BrowserStack AI generates your initial set of test cases, you can refine, restructure, or prune them using Iterative Prompting. This feature lets you guide the AI agent with natural language to ensure the final output aligns with your specific testing strategy.

Think of this as a conversation. After the initial generation, you can provide follow-up instructions to refine and shape the output until it perfectly matches your testing strategy.

What you can do with iterative prompts

Use iterative prompts to steer the agent to do the following:

What you want to do Prompt examples
Restructure your test scenarios By feature / functionality: Group test cases by feature name. Create one scenario per feature. Put all test cases under one scenario.
By test type: Separate test cases into Functional (happy, negative, edge, boundary) and Non-functional (UI, performance, security).
By clearly defined attribute: Group test cases by attribute (for example platform, role, region). Create a scenario for each value.
Prune unnecessary test cases Delete by kind: Remove all negative test cases. Keep only happy path and boundary.
Delete by feature: Keep only <FEATURE> test cases. Remove everything else.
Delete by priority: Remove all low priority test cases (P3 and below).
Delete by test type: Remove all UI/UX test cases. Keep only Accessibility tests.
Delete by role: Remove admin-only test cases. Keep end-user flows.
Combine related test cases Explicit merge: Combine <TC1> and <TC2> into one test case. Preserve coverage from both.
Type-based consolidation: Merge all browser compatibility tests into one cross-browser test case.
Flow-based combination: Create an end-to-end test that combines login β†’ navigation β†’ logout.
Scenario consolidation: Combine happy path and negative cases for the <FLOW> flow into a single scenario with clearly labeled test cases.
Expand your test coverage Add new areas: Add test cases for <NEW_AREA> that is not covered yet.
Add missing types: Add edge and negative test cases for <FEATURE>. Keep existing happy path.
Add NFR coverage: Add UI, performance, and security test cases for <FEATURE>. Keep functional tests unchanged.
Refine specific fields Steps only: Rewrite the steps of the selected test cases to validate each input field. Keep the other fields unchanged.
Expected results: Update only the expected results of the selected test cases to mention the exact success message.
Preconditions: Add a precondition about test data setup to the selected test cases.
Apply cosmetic changes Naming convention: Rename all test cases to follow: [<TYPE>], and [<PRIORITY>] <FEATURE> – <ACTION> .
Terminology alignment: Replace β€˜sign in’ with β€˜log in’ across titles and descriptions.

How iterative prompting works

The process is a simple loop:

  1. Generate an initial set of test cases from a prompt, file, or linked requirement.
  2. Review the generated scenarios and test cases.
  3. Refine with iterative prompts.

After you generate your first set of test cases from a document, your test case list becomes interactive. You now have new options to guide the AI for the next prompt.

How to refine your test cases

Use this loop each time you want to steer the output:

Generate your first test cases

Follow this documentation to generate your test cases. Provide your PRD, image, or other requirements to the test case generator agent.

Review and categorize your results

Review the output and use these actions:

  • Select test cases (for modification): Click the checkbox next to the test cases you want to change. Your next prompt will only apply to these selected test cases.
  • Add: Click the Add icon for test cases that you want to retain. The AI saves these, protects them from future changes, and avoids creating duplicates of them later.
  • Reject: Click the Reject icon for test cases that are irrelevant or wrong. The AI learns from this and will not generate similar, irrelevant test cases again.

Tests that you do not select, accept, or reject will be carried over unchanged to the next iteration.

Select appropriate test cases to add or reject them

Write your refinement prompt

  • Write specific, descriptive prompts. The AI Agent’s output quality depends directly on the clarity of your instructions. Use highly descriptive language to guide specific iterations.
  • You can only use one integration (like Jira, Confluence, or Azure) in a single generation journey. After you generate test cases from a source, you cannot add more from that same source or switch to another integration within that same cycle.
  • You can add as many as 5 files to provide context to the AI.
  1. Write a new prompt in the Refine and Add Test Cases field. The AI agent reads this prompt along with the context of which test cases you have selected, accepted, and rejected.

    The Refine and Add Test Cases field with pre-defined prompt suggestions shown above it

  2. Instead of writing a prompt from scratch, you can select one of the pre-defined prompt suggestions, such as Add edge cases, shown above the Refine and Add Test Cases field. Selecting a suggestion fills the prompt field, and you can edit it before you generate.
  3. You can add new files, such as a Confluence page or Jira ticket, or provide a text command. Your selection changes how the AI applies the prompt:

    • If you select test cases, your prompt should describe how to change only those selected items.
    • If you do not select anything, write prompts that add or restructure broadly.
  4. Click the send icon in the field to run the iteration.

The AI agent processes your new request and updates the test case list. You can repeat this review and refine loop as many times as you need.

Review what changed in an iteration

After each iteration, Test Management shows you exactly what changed, so you do not have to compare test cases by hand:

  • Refinement summary: In the conversation panel, the result card lists the changes the agent made under In this refinement, such as the fields it updated or the test cases it added.
  • Edited count: A banner above the test case list shows how many test cases the refinement edited.
  • Show changes only: Turn on this toggle to hide unchanged test cases and review only the edited and new ones. New test cases are labeled New.

    The review screen after an iteration with the refinement summary, the added count banner, the Show changes only toggle on, and per-scenario change counts

  • Per-test-case note: Click the refinement icon next to an edited test case to see a short note about what changed in it and what stayed the same.

    The refinement note on an edited test case stating that only the name field was updated

Refine individual fields

You can also refine test cases at the field level. Select the test cases you want to change and write a prompt that targets a specific field, such as the steps, expected results, or preconditions. For example, prompt Update only the expected results of the selected test cases to mention the exact validation message. The agent updates only that field and leaves the rest of the test case unchanged.

Change settings during iterations

You are not locked into all the settings you chose for the first generation. Before any iteration, click the Settings icon in the Refine and Add Test Cases field and change the Type or Priority values. The next generation applies the updated settings to the test cases it creates or modifies. You cannot change the template or language after the first generation.

The settings menu during an iteration with Type and Priority editable and Template and Language locked

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback!

Talk to an Expert
Download Copy Check Circle