This free AI prompt helps Software Developers with Code Review tasks. Copy and paste it directly into ChatGPT, Claude, or Gemini — then replace the [brackets] with your specific details to get professional results in seconds.
This prompt has been copied 0 times by Software Developers professionals. It works best when you are as specific as possible in the [brackets] — vague input gives generic output, specific input gives professional results.
The Prompt
Create a unit testing guide for [language/framework] codebase.
Project details:
- Language: [JavaScript/Python/Java/other]
- Test framework: [Jest/PyTest/JUnit/other]
- Coverage target: [%]
- Current coverage: [%]
- Mocking library: [Jest mocks/unittest.mock/Mockito]
UNIT TESTING GUIDE
1. WHAT TO TEST
TEST THESE
- Business logic functions
- Data transformations
- Error handling paths
- Edge cases (empty/null/boundary values)
- Each branch of conditionals
- Public API of modules
DO NOT TEST
- Framework internals
- Third-party libraries
- Implementation details (test behavior not how)
- Private methods directly
2. TEST STRUCTURE — AAA PATTERN
```javascript
describe('calculateDiscount', () => {
it('should apply 10% discount for premium users', () => {
// ARRANGE
const user = { type: 'premium' }
const price = 100
// ACT
const result = calculateDiscount(price, user)
// ASSERT
expect(result).toBe(90)
})
})
```
3. NAMING CONVENTIONS
Pattern: [unit]_[scenario]_[expected result]
Examples:
- calculateTax_withZeroIncome_returnsZero
- validateEmail_withInvalidFormat_throwsError
- getUser_withValidId_returnsUser
- getUser_withMissingId_returns404
4. MOCKING DEPENDENCIES
WHEN TO MOCK
- External APIs
- Database calls
- File system
- Date/time (for deterministic tests)
- Random number generators
```javascript
jest.mock('../services/emailService')
const emailService = require('../services/emailService')
emailService.send.mockResolvedValue({ success: true })
```
5. EDGE CASES TO ALWAYS TEST
- Null/undefined inputs
- Empty string/array/object
- Zero values
- Negative numbers
- Very large numbers
- Special characters in strings
- Boundary values (min/max)
6. TEST QUALITY CHECKLIST
☐ Each test has one assertion focus
☐ Tests are independent (no shared state)
☐ Tests run in any order
☐ No network calls in unit tests
☐ Tests are fast (under 100ms each)
☐ Test names explain what is being tested
☐ Failure message is clear
7. COVERAGE GUIDE
- Line coverage: [% target]
- Branch coverage: [% target — more important]
- Focus: critical paths over 100% coverage
- Exclude: generated code/config files
How to Use This Prompt
- Click Copy Prompt above
- Open ChatGPT or Claude
- Paste the prompt and replace anything in [brackets] with your own details
- Press Enter and get your result instantly
When to Use This Prompt
Use the Dev Unit Test Writing Guide prompt when you need to quickly create professional code review as a Software Developer. This prompt saves significant time compared to writing from scratch and ensures you cover all the key elements that matter most in a professional context.
- You need a professional first draft quickly
- You want to ensure you haven't missed any important elements
- You need consistent quality across multiple similar documents
- You want to adapt an output for different situations by changing the brackets
Pro Tip
The more specific you are when replacing the [brackets], the better your result. For example instead of writing [Job Title] write "Senior Software Engineer with 5 years experience" — specificity is what separates a good AI response from a great one.
This prompt works best with ChatGPT . If you are not happy with the first result, try adding "make it more concise" or "give me 3 alternative versions" as a follow-up message.
Frequently Asked Questions
Is this Dev Unit Test Writing Guide prompt free to use?
Yes — completely free. Copy it as many times as you want for personal or professional use. No account required.
Which AI tool works best with this prompt?
This prompt works well with ChatGPT, Claude, and Gemini. We recommend ChatGPT GPT-4o for best results with this type of content. Try both ChatGPT and Claude if you want to compare outputs.
How do I get the best results from this prompt?
Replace every [bracket] with specific, detailed information. The more specific your input, the more professional and useful the output. For example instead of writing [client name] write the actual client name and their specific situation — this transforms generic output into something genuinely useful.
Can I modify this prompt?
Absolutely — these prompts are designed to be customized. Add sections, remove sections, change the tone, adjust the length. The prompt is a starting framework — adapt it to your specific needs.
Are there more prompts for Software Developers?
Yes — we have a full collection of prompts specifically for Software Developers. Browse all Software Developers prompts →