Skip to content
Prompt Maker Studio

Write tests for existing code

Add tests that pin down current behaviour, following the project’s test conventions.

Free to use and change. Filling in and copying happen in your browser.

Fill in
<GOAL>
Add tests for {{target}}.
</GOAL>

<CONTEXT>
Follow the conventions of the existing tests in {{test_location}}.
</CONTEXT>

<TASK>
Cover the main behaviour, edge cases ({{edge_cases}}) and error handling. Test behaviour through public functions, not private details.
</TASK>

<CONSTRAINTS>
Do not change the code under test. If you find a bug, write a failing test for it, mark it as expected to fail, and report it.
</CONSTRAINTS>

<DONE_WHEN>
{{test_command}} passes and each new test fails if the behaviour it describes breaks.
</DONE_WHEN>

How it is built

  • Goal: Add tests for {{target}}.
  • Context: Follow the conventions of the existing tests in {{test_location}}.
  • Task: Cover the main behaviour, edge cases ({{edge_cases}}) and error handling. Test behaviour through public functions, not private details.
  • Constraints: Do not change the code under test. If you find a bug, write a failing test for it, mark it as expected to fail, and report it.
  • Done when: {{test_command}} passes and each new test fails if the behaviour it describes breaks.

Tips

  • Ask the agent to show each new test failing against a deliberately broken copy of the code, then revert it.

Adapting it? Check your version with the prompt checker.

More coding-agent templates