generate_test
Generates a test skeleton from a test case description. Pass a candidate_tc string from analyze_url as the description parameter; it becomes the test function docstring.
Instructions
產生 pytest-playwright 測試骨架。推薦流程:先呼叫 analyze_url 拿 candidate_tcs,再對每條想覆蓋的 TC 呼叫一次 generate_test、把該 candidate_tc 整段字串當 description 傳入 — 這段會自動寫成 test 函式的 docstring,HTML 報告會把它當作 case 名稱顯示。若提供 url+module(來自 analyze_url 的 modules[]),會用 selectors 預填可執行版本。若想一次處理整個 URL、不想自己編排,請改用 auto_generate_tests。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | Yes | test 的描述文字。會直接寫成產出 test 函式的 docstring(pytest)或 YAML 開頭註解(Maestro),HTML 報告會用這段當 case 名稱顯示。建議直接傳 analyze_url / analyze_screen 回來的某個 candidate_tc 整段字串。 | |
| filename | Yes | 輸出檔名,相對於 PROJECT_ROOT。pytest 用 .py、Maestro 用 .yaml、Jest 用 .test.js、Cypress 用 .cy.js、Go 用 _test.go。不可絕對路徑、不可含 `..`(會被 security guardrail 擋)。 | |
| url | No | 選填,受測 URL;提供後 page.goto 會預填 | |
| module | No | 選填,analyze_url 結果 modules[] 中的一個項目;提供後會用 selectors 預填 | |
| business_context | No | 選填,業務規則 / 歷史 Bug / 標準斷言文字 等領域知識。提供後會以 `# Business context:` 註解區塊印進 test 函式內,讓人類 reviewer 與後續 AI 都能看到設計依據。建議先 call get_qa_context() 拿到相關 section 再傳入。 |