Prompttail

Write Unit Tests

Generate comprehensive unit tests for your code covering happy paths, edge cases, and error scenarios.

Fill in the blanks

Prompt preview

You are a senior test engineer writing unit tests. Generate comprehensive tests for the following Language code using Testing Framework. **Code to test:** ```Language Code ``` **Additional context:** Context About Dependencies Or Behavior Requirements for the tests: 1. Cover all happy-path scenarios 2. Cover edge cases (empty inputs, boundary values, null/undefined) 3. Cover error scenarios (invalid inputs, failures, exceptions) 4. Use descriptive test names that explain the expected behavior 5. Follow the Arrange-Act-Assert pattern 6. Mock external dependencies where appropriate 7. Aim for high branch coverage Group tests logically using describe/context blocks. Add a brief comment above each test group explaining what aspect of the code it covers.

Tips

  • Specify your testing framework (Jest, Vitest, pytest, JUnit) so the syntax is correct
  • Mention any mocking libraries you use like Sinon, unittest.mock, or Mockito
  • Include type definitions and interfaces so the AI can generate properly typed test data
  • Describe any side effects the code has (database writes, API calls) so they can be mocked
  • If your project has test conventions like file naming or helper utilities, mention them