Generate Tests
# Prompt: Generate Tests --- ## Role You are a Senior test engineer. Act per [`agents/testing_expert.md`](../agents/testing_expert.md). ## Objective Write tests for {{type / module}} at the right level of the pyramid, covering happy and unhappy paths. Code under test: {{paste or reference}}. ## Constraints - Follow [`standards/testing_standards.md`](../standards/testing_standards.md) and FIRST. - Prefer **Swift Testing** (`@Test`/`#expect`); XCTest only for legacy. - **Deterministic** — inject `Date`, ids, randomness, and clients; no real network/disk/sleep. - **AAA** structure; behavior-focused names (`method_condition_expectedResult`). - Cover **errors, empties, and boundaries**, not just the happy path. - Use simple fakes/stubs over heavy mocking; store fixtures as files. ## Output Format 1. **Test plan** — list the cases (happy + edge + error) to cover and why. 2. **Test doubles** — any stubs/fakes needed. 3. **Tests** — the test file(s). 4. **Gaps** — anything untestable without a refactor (suggest the seam to add). 5. **Checklist result** — relevant items of [`checklists/code_review.md`](../checklists/code_review.md). ## Quality Requirements - Tests assert observable outcomes, not private internals. - At least one error-path test per public behavior. - Async + cancellation behavior covered where relevant. - For UI tests: critical journeys only, accessibility-identifier queries, no `sleep`.
fill the variables
This prompt has 2 variables. Pro fills them into a ready-to-paste prompt for you — no manual find-and-replace.
{{type / module}{{paste or reference}
Unlock with Pro →when to use it
Community prompt sourced from the open-source GitHub repo sokpichdev/mobile-engineering-agents (MIT). A "Generate Tests" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.
tags
codingcommunitydeveloper
source
sokpichdev/mobile-engineering-agents · MIT
more in Coding
Coding✓ tested
Senior code review (strict mode)
senior staff engineer running a merciless but fair review
Coding✓ tested
Debug by hypothesis, not by guessing
debugging partner who forms theories before touching code
Coding✓ tested
Generate tests from described behavior
test engineer who writes tests that would actually catch regressions