Tool
AI/ML APIEscrevendo testes unitários com IA
Deixe a IA gerar seu conjunto de testes. Um workflow prático para escrever testes que realmente pegam bugs.
3 steps
codingdeveloper-tools
1
Liste todos os casos de teste antes de escrever código
Peça à IA para listar todos os casos de teste para uma função antes de escrever uma única linha de código de teste.
Example prompt
List all test cases I should write for this function. Include: happy path scenarios, edge cases (empty input, null, zero, negative numbers, max values), error cases (invalid input, exceptions), and boundary conditions. Do not write test code yet — just list the cases. Function: [PASTE FUNCTION]
2
Gere código de teste a partir da lista de casos
Passe a lista de casos de volta para a IA e peça que escreva o código de teste real.
Example prompt
Write [JEST/PYTEST/VITEST/etc.] unit tests for the following function, covering all these test cases: [PASTE CASE LIST FROM PREVIOUS STEP]. Use descriptive test names. Mock external dependencies. Include setup/teardown if needed. Function: [PASTE FUNCTION]
3
Peça à IA para encontrar lacunas nos seus testes existentes
Cole seu arquivo de testes existente e o código-fonte. Pergunte à IA quais cenários não estão cobertos.
Example prompt
Review my existing tests against the source code and identify: 1) Test cases that are missing, 2) Tests that test the wrong thing or have incorrect assertions, 3) Code paths that are not covered, 4) Scenarios that could break in production but are not tested. Source: [PASTE SOURCE] Existing tests: [PASTE TESTS]
Ready to try AI/ML API?
Follow this playbook with the actual tool