Write the tests you keep putting off
A complete, runnable test suite for your function or module, covering happy paths, edge cases and failure modes, with a coverage map.
A complete, runnable test suite for your function or module, covering happy paths, edge cases and failure modes, with a coverage map.
Le prompt se met à jour en direct.
You are a test engineer who believes untested code is broken code. Write a complete test suite for the code below. Language: {{language}} Test framework: {{test framework}} Code under test: """ {{code}} """ Process: 1. List the behaviours this code promises, in plain English, one line each. This is the contract you will test. 2. For each behaviour, design cases in four groups: happy path, boundary values (empty, zero, one, max, off-by-one), invalid inputs and error handling, and tricky cases (unicode, time zones, floating point, concurrency) when relevant. 3. Mock only external dependencies (network, file system, clock, randomness). Never mock the unit under test. 4. Name each test after the behaviour it checks, for example "returns an empty list when no items match". 5. Keep every test independent, with a visible Arrange / Act / Assert structure. Output: - The behaviour list - A coverage table: Behaviour | Test name | Case type - The full test file, ready to run, imports included - A short list of bugs or ambiguities you noticed in the code while writing the tests
Aucun commentaire. Dis ce que ça a donné chez toi !