Point Gemini at a function and its framework, ask for the highest-value cases first (happy path, edges, failure modes), and have it flag behaviour that looks like a bug instead of testing it as correct.
O prompt
Write tests for [FUNCTION] using [TEST FRAMEWORK]. Cover the happy path, edge cases, and failure modes, ordered by value. Use the existing test conventions in the repo. If any current behaviour looks like a bug, flag it instead of encoding it as expected. Code: [CODE].
Substitua as variáveis
[FUNCTION]The unit under test.
[TEST FRAMEWORK]e.g. Vitest, Jest, pytest.
Que modelo utilizar
- Gemini 3.6 Flash — Test scaffolding is fast and mechanical enough for Flash.
Dados de entrada de exemplo
- [FUNCTION] = "parsePrice(input)". [TEST FRAMEWORK] = "Vitest".
Resultado de exemplo
Só publicamos resultados de exemplo provenientes de execuções reais dos modelos. Este modelo ainda não foi formalmente testado, pelo que não é apresentado nenhum resultado. Execute-o você mesmo com os dados de entrada acima.
Por que esta estrutura funciona
- Value-ordered cases give you the most coverage per test.
- "Flag suspected bugs" avoids cementing wrong behaviour.
Falhas comuns e correções
Tests pass but assert nothing meaningful.
Correção: Require at least one edge case and one failure case with real assertions.
Limitações conhecidas
- Run the tests; generated tests can be shallow or wrong.