The RICCE framework is a structured approach to writing prompts for large language models (LLMs), named after its five parts: Role, Instructions, Constraints, Context and Examples. Testers use the RICCE prompting framework to get more precise, usable output from AI assistants, such as test automation code that fits their project rather than generic snippets.
Why it matters: Vague prompts tend to produce vague or wrong answers, which then take time to review and fix. Covering each part of RICCE gives the model the information a human colleague would need to do the job well. That matters most for testers new to coding, who may not yet spot when generated code is subtly off.
In practice: A RICCE prompt covers each element in turn:
- Role: who the model should act as, for example an experienced test automation engineer.
- Instructions: the task, stated clearly.
- Constraints: limits such as the framework, language, coding standards or what not to do.
- Context: background about the product, the existing codebase or the scenario under test.
- Examples: a sample of the expected output, such as an existing test written in the house style.
The output still needs a human to review, run and adjust it.
Examples:
- Asking an AI assistant, acting as a Playwright expert, to write a login test in TypeScript that uses the existing page object classes and follows an attached example test.
- Constraining a prompt to "no hard-coded waits" so generated tests rely on the framework's own waiting behaviour.
- Supplying the acceptance criteria for a story as context when asking for a list of test scenarios.
Common pitfalls:
- Leaving out context and examples, so the model invents structures and naming that clash with the existing framework.
- Treating a well-structured prompt as a guarantee of correct output and skipping review.
Is RICCE the only prompting framework? No. Several similar frameworks exist, and most cover the same ground of role, task, context and examples.
Do you need coding skills to use RICCE? Not to write the prompt, but you do need enough foundational knowledge to judge whether the code that comes back is any good.