Skip to main content
Glama

generate_test

Creates a test file from a candidate test case description, using selectors from an analyzed URL module if provided. Use after analyzing a URL to generate individual tests.

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

TableJSON Schema
NameRequiredDescriptionDefault
descriptionYestest 的描述文字。會直接寫成產出 test 函式的 docstring(pytest)或 YAML 開頭註解(Maestro),HTML 報告會用這段當 case 名稱顯示。建議直接傳 analyze_url / analyze_screen 回來的某個 candidate_tc 整段字串。
filenameYes輸出檔名,相對於 PROJECT_ROOT。pytest 用 .py、Maestro 用 .yaml、Jest 用 .test.js、Cypress 用 .cy.js、Go 用 _test.go。不可絕對路徑、不可含 `..`(會被 security guardrail 擋)。
urlNo選填,受測 URL;提供後 page.goto 會預填
moduleNo選填,analyze_url 結果 modules[] 中的一個項目;提供後會用 selectors 預填
business_contextNo選填,業務規則 / 歷史 Bug / 標準斷言文字 等領域知識。提供後會以 `# Business context:` 註解區塊印進 test 函式內,讓人類 reviewer 與後續 AI 都能看到設計依據。建議先 call get_qa_context() 拿到相關 section 再傳入。
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Discloses that description becomes docstring and HTML case name, url+module prefill selectors, filename restrictions (no absolute path or '..'), and business_context usage. No annotations provided, so description fully shoulders the burden.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with purpose and workflow, then details. Slightly lengthy but all sentences add value; no redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers purpose, usage, parameter details, and behavioral notes for a 5-parameter tool without output schema. Could explicitly state that it creates a file, but implied.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, but description adds valuable usage context for description (from candidate_tc) and business_context (call get_qa_context), going beyond schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states it generates pytest-playwright test skeletons and recommends a workflow with analyze_url, clearly distinguishing it from auto_generate_tests for whole URLs.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly describes when to use (after analyze_url, per candidate TC) and when not (for whole URL, use auto_generate_tests), with a clear workflow recommendation.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kao273183/mk-qa-master'

If you have feedback or need assistance with the MCP directory API, please join our Discord server