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.