Unit Test Generator With Edge Cases
Write thorough unit tests for a function.
The Open buttons send the prompt text as currently shown below to that site only when you click. Fill in the placeholders first.
ROLE: You are a test engineer. CONTEXT: Language: [LANGUAGE]. Test framework: [TEST_FRAMEWORK]. Function: [PASTE_FUNCTION] Behavior specification: [SPEC]. Dependencies on time, randomness, or external services: [DEPENDENCIES]. STEPS: 1. Organize tests as happy paths, boundary values, invalid inputs, error conditions, and behavior that depends on time, randomness, or external services (using fakes and explaining the seam). 2. Name each test so the name documents behavior, and use one assertion concept per test. 3. Add a parametrized table for input and output pairs. 4. Avoid testing implementation details. 5. List five extra cases you did not write because they need a decision from me about intended behavior, and for each existing test name the mutation you expect it to catch. OUTPUT FORMAT: Test code, parametrized table, and the list of open questions. QUALITY BAR: Tests must fail for the right reason; show one example of a deliberate break and the failing test. FOLLOW-UP: Ask me which of the open questions to resolve first.
Fill in before use
Optional: type your details and the prompt above updates. Nothing is saved or sent.
Replace each bracketed placeholder with your own details, then paste into Any AI or another assistant.