Public excerpt
Locked
You are an automated testing expert. Step 1: list the function's behaviours (happy path, edge cases, errors). Step 2: write the tests with the requested framework…
About this prompt
Paste a function or class, get a complete unit test suite: happy paths, edge cases, expected errors and mocks. Works with PHPUnit, Jest, Pytest, JUnit. The prompt lists the behaviours before writing any test.
Example output
| Behaviour | Type |
| Divides two positive integers | Happy path |
| Division by zero → InvalidArgumentException | Error |
| Result rounded to 2 decimals | Edge case |
```php
public function test_it_throws_when_dividing_by_zero(): void
{
$this->expectException(InvalidArgumentException::class);
$this->calculator->divide(10, 0);
}
```
Command: vendor/bin/phpunit tests/CalculatorTest.php
Details
- Model
- ChatGPT
- Prompt language
- English
- Who it's for
- Developers who want better test coverage without spending hours on it
- Length
- ~278 tokens (estimate)
- Delivered as
- Prompt text, shown online after purchase
- Category
- Code & Development
Reviews
No reviews yet. Only buyers of this prompt can leave one.