# Write Automated Tests

> Creates focused tests for normal behavior, edge cases, and failures.

## Best For

- Creates focused tests for normal behavior, edge cases, and failures.
- Work involving coding and tests
- Producing a copy-ready deliverable with explicit accuracy rules

## Recommended AI

- ChatGPT
- Claude
- Gemini

## Difficulty

Intermediate

## Information to Provide

- [INSERT TOPIC OR SOURCE MATERIAL]
- [INSERT GOAL]
- [INSERT AUDIENCE]
- [INSERT REQUIREMENTS]
- [INSERT CONSTRAINTS]
- [INSERT OUTPUT FORMAT]
- [INSERT TONE OR STYLE]
- [INSERT DEADLINE OR LENGTH IF RELEVANT]

## Quick Prompt

```text
Act as a senior software engineer, code reviewer, and technical mentor. Your objective is to deliver the result described here: Creates focused tests for normal behavior, edge cases, and failures.

Use this context: [INSERT TOPIC OR SOURCE MATERIAL]. Goal: [INSERT GOAL]. Audience: [INSERT AUDIENCE]. Requirements: [INSERT REQUIREMENTS]. Constraints: [INSERT CONSTRAINTS]. Output format: [INSERT OUTPUT FORMAT].

Choose the appropriate test level, use deterministic cases, cover boundaries and error paths, and explain how to run the suite. Avoid vague filler, unsupported claims, invented facts, and unnecessary repetition. Do not invent missing facts. If a missing detail is essential, ask up to three focused questions; otherwise state a reasonable assumption. Return the requested code or analysis in clearly labeled sections, with runnable snippets, assumptions, and verification steps.
```

## Advanced Prompt

```text
Act as a senior software engineer, code reviewer, and technical mentor.

OBJECTIVE
Deliver the result described here: Creates focused tests for normal behavior, edge cases, and failures.

CONTEXT
- Topic or source material: [INSERT TOPIC OR SOURCE MATERIAL]
- Goal or decision this must support: [INSERT GOAL]
- Intended audience: [INSERT AUDIENCE]
- Known background and evidence: [INSERT CONTEXT AND VERIFIED FACTS]
- Platform, environment, or channel: [INSERT PLATFORM]

REQUIREMENTS
1. Choose the appropriate test level, use deterministic cases, cover boundaries and error paths, and explain how to run the suite.
2. Follow these user requirements: [INSERT REQUIREMENTS].
3. Respect these constraints: [INSERT CONSTRAINTS].
4. Match this tone or style: [INSERT TONE OR STYLE].
5. Use this target length or deadline when relevant: [INSERT LENGTH OR DEADLINE].
6. Make the result specific to the code, programming language, environment, expected behavior, and constraints; do not produce a generic answer.
7. Check the final result for internal consistency, missing steps, and unusable ambiguity.

ACCURACY AND BOUNDARIES
- Do not invent facts, quotations, sources, product features, statistics, experience, or results.
- Clearly label assumptions, estimates, and inferences.
- When current or external facts are required and browsing is available, verify them with reliable sources and cite direct links.
- When required evidence is unavailable, write [NEEDS VERIFICATION] or ask a focused question instead of guessing.
- Avoid vague filler, unsupported claims, invented facts, and unnecessary repetition.

OUTPUT
Return the requested code or analysis in clearly labeled sections, with runnable snippets, assumptions, and verification steps.
Use this exact requested format: [INSERT OUTPUT FORMAT].
Begin with the finished deliverable. Put assumptions, verification needs, or optional alternatives afterward.
```

## Example Input

```text
Topic: Python task manager; Goal: add persistent JSON storage; Audience: a beginner developer; Requirements: type hints and error handling; Constraints: standard library only, Python 3.12; Output: changed files, code, and test commands.
```

## Customization Options

* Tone
* Length
* Audience
* Detail level
* Output format
* Platform or AI model

## Expected Output

Return the requested code or analysis in clearly labeled sections, with runnable snippets, assumptions, and verification steps. The result should directly address the stated goal, preserve supplied facts, label assumptions, and be usable without another rewrite.

## Related Prompts

* [Explain Code Step by Step](Explain%20Code%20Step%20by%20Step.md)
* [Improve Code Performance](Improve%20Code%20Performance.md)
