Skip to main content
Glama

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

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 再傳入。
Behavior4/5

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

The description explains that description becomes the test function's docstring and appears in HTML reports, and that providing url+module pre-fills selectors. However, it does not mention disk write behavior or error handling, though for a generation tool this is acceptable.

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?

The description is front-loaded with purpose and then provides a structured workflow. It is concise yet informative, though it could slightly tighten the phrasing without losing clarity.

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?

Given the tool has 5 parameters and no output schema, the description covers all inputs, provides workflow context, references sibling tools, and explains output behavior (docstring, HTML report). It lacks details on file overwriting or error scenarios, but overall is comprehensive for a generation tool.

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 the description adds significant meaning by explaining how each parameter affects the output: description as docstring, filename determines extension, url pre-fills page.goto, module provides selectors, business_context is inserted as a comment. It also suggests calling 'get_qa_context' for business_context.

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 clearly states it 'generates pytest-playwright test skeletons' with specific verb and resource. It distinguishes itself from the sibling 'auto_generate_tests' by noting that tool handles whole URLs at once.

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?

The description explicitly provides a recommended workflow: call 'analyze_url' first, then for each candidate TC call 'generate_test' with the candidate_tc string as description. It also specifies when to use the alternative 'auto_generate_tests' for whole URL processing.

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