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.
プロンプト
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].
変数を置き換える
[FUNCTION]The unit under test.
[TEST FRAMEWORK]e.g. Vitest, Jest, pytest.
どのモデルを使うか
- Gemini 3.6 Flash — Test scaffolding is fast and mechanical enough for Flash.
入力例
- [FUNCTION] = "parsePrice(input)". [TEST FRAMEWORK] = "Vitest".
出力例
私たちは実際のモデル実行による出力例のみを公開しています。このテンプレートはまだ正式にテストされていないため、出力は表示されません。上記の入力を使ってご自身で実行してみてください。
この構造が機能する理由
- Value-ordered cases give you the most coverage per test.
- "Flag suspected bugs" avoids cementing wrong behaviour.
よくある失敗と修正
Tests pass but assert nothing meaningful.
修正: Require at least one edge case and one failure case with real assertions.
既知の制限事項
- Run the tests; generated tests can be shallow or wrong.