Tool
AI/ML APIכתיבת בדיקות יחידה עם AI
תנו ל-AI לייצר את חבילת הבדיקות שלכם. תהליך עבודה מעשי לכתיבת בדיקות שבאמת תופסות באגים.
3 steps
codingdeveloper-tools
1
רשימת כל מקרי הבדיקה לפני כתיבת הקוד
בקשו מה-AI לרשום כל מקרי הבדיקה לפונקציה לפני שכותבים שורת קוד בדיקה אחת.
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
יצירת קוד בדיקה מרשימת המקרים
כעת העבירו את רשימת המקרים חזרה ל-AI ובקשו ממנו לכתוב את קוד הבדיקה האמיתי.
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
בקשו מה-AI למצוא פערים בבדיקות הקיימות שלכם
הדבק את קובץ הבדיקות הקיים ואת קוד המקור. שאל את ה-AI אילו תרחישים אינם מכוסים.
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