cli-e2e-testcase-writer
Use when adding or updating Go CLI E2E coverage for one `tests/cli_e2e/{domain}` domain of the compiled `lark-cli`, especially when the work requires live `--help` or `schema` exploration, scenario-based `clie2e.RunCmd` workflows, and per-domain `coverage.md` maintenance.
- License 许可
- MIT
- 最近更新
- 2026-09-10
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- cli-e2e-testcase-writer
- metadata
- { "requires": { "bins": [ "lark-cli" ] } }
- description
- Use when adding or updating Go CLI E2E coverage for one `tests/cli_e2e/{domain}` domain of the compiled `lark-cli`, especially when the work requires live `--help` or `schema` exploration, scenario-based `clie2e.RunCmd` workflows, and per-domain `coverage.md` maintenance.
03 SKILL.md 正文
CLI E2E Testcase Writer
Work on one domain per run. Produce exactly two artifacts for that domain:
- workflow testcase files under
tests/cli_e2e/{domain}/ tests/cli_e2e/{domain}/coverage.md
Focus on domain testcase files. Do not change shared E2E support code such as tests/cli_e2e/core.go unless the user explicitly asks. Treat tests/cli_e2e/demo/ as reference only.
Core standard
- Make the testcase scenario-based and self-contained.
- Prove one workflow end to end: create plus follow-up read, or mutate plus teardown.
- Prefer one file per workflow or one closely related feature.
- For mutable flows, prove persisted state with read-after-write assertions, not just exit code.
- Leave prerequisite-heavy paths uncovered when they cannot be proven, and explain why in
coverage.md.
Workflow
1. Explore the live CLI before writing code
lark-cli --help
lark-cli <domain> --help
lark-cli <domain> +<shortcut> -h
lark-cli <domain> <group> --help
lark-cli <domain> <group> <method> -h
lark-cli schema <domain>.<group>.<method>
2. Count leaf commands for the denominator
- A leaf command is one that executes an action — it has no further subcommands.
- If
lark-cli <domain> <group> --helplists no subcommands,<group>itself is the leaf. - Count
task +createas one leaf andtask tasks getas one leaf. - Do not count parameter combinations.
- Reuse coverage already present under
tests/cli_e2e/{domain}/. Do not counttests/cli_e2e/demo/.
3. Choose the proof surface before editing
Identify the provable risks for the touched workflow: invalid input, missing prerequisite, identity or permission, state transition, output shape, cleanup safety. If only the happy path is testable, document the blocked risk areas in coverage.md.
4. Add or update the workflow testcase
- Use
clie2e.RunCmd(ctx, clie2e.Request{...}). - Put command path and plain flags in
Args; put JSON inParams(URL/path parameters) andData(request body). - Prefer one top-level test per workflow with
t.Runsubsteps. - Register teardown on
parentT.Cleanupso it survives subtest failures. - When touching an existing command, verify the JSON response shape is stable: assert status type, field paths, and identifiers consumed by later steps before changing assertions.
5. Run and iterate
Run go test ./tests/cli_e2e/{domain} -count=1 while iterating and before finishing. If command shape or behavior is unclear, re-check help or schema (step 1) before changing assertions.
6. Refresh the domain outputs
- Update the workflow testcase files.
- Update
coverage.md: recompute the denominator from live help output, mark each command asshortcutorapi, and keep one command table for the whole domain.
Testcase rules
- Override
BinaryPath,DefaultAs, orFormatonclie2e.Requestonly when the testcase truly needs it. - Use
require.NoError,result.AssertExitCode,result.AssertStdoutStatus,assert, andgjson. - Shortcut responses (
{ok: bool}) asserttrue; API responses ({code: int}) assert0. - Use
t.Helper()only for setup or assertion helpers that are called from multiple tests. - Use table-driven tests only when the scenario shape repeats across inputs.
- For expected failures, assert stderr content and exit code when the environment makes them deterministic.
- If identity or external fixtures cannot be proven, leave the command uncovered and document the prerequisite rather than faking confidence.
coverage.md
Keep coverage.md brief and mechanical. Include:
- a domain-specific H1 title
- a metrics section with denominator, covered count, and coverage rate
- a summary section restating each
Test...workflow, keyt.Run(...)proof points, and main blockers - one command table for all commands
Recommended structure:
# <Domain> CLI E2E Coverage
## Metrics
- Denominator: N leaf commands
- Covered: N
- Coverage: N%
## Summary
- TestXxx: ... key `t.Run(...)` proof points ...
- Blocked area: ...
## Command Table
| Status | Cmd | Type | Testcase | Key parameter shapes | Notes / uncovered reason |
| --- | --- | --- | --- | --- | --- |
| ✓ | task +create | shortcut | task_status_workflow_test.go::TestTask_StatusWorkflow | basic create; create with due | |
| ✕ | task +assign | shortcut | | none | requires real user open_id |
- Mark each command
shortcutorapi. - Write testcase entries in
go test -runfriendly form. - Commands only exercised in
parentT.Cleanupteardown are not counted as covered. - Do not split covered and uncovered commands into separate sections.
Guardrails
- Run as bot identity only; do not assume
--as userworks. - Do not place new real coverage under
tests/cli_e2e/demo/. - Do not depend on preexisting remote data.
- Do not fabricate open_ids, chats, docs, or other remote fixtures.
- Prefer deterministic negative cases over tenant-dependent assertions.
- Do not guess
ParamsorDatafields when help or schema can tell you the exact shape. - Do not hardcode obvious defaults unless the command truly requires explicit flags.
- Do not put agent, model, or vendor brand names in visible remote test data; use neutral prefixes such as
lark-cli-e2e-or<domain>-e2e-. - A command is covered only when the testcase asserts returned fields or persisted state, not just exit code.
- Cleanup-only execution is not primary coverage, except
deletein the same workflow that created the resource.
04 同仓库更多 Skills
lark-workflow-standup-report
日程待办摘要:编排 calendar +agenda 和 task +get-my-tasks,生成指定日期的日程与未完成任务摘要。适用于了解今天/明天/本周的安排。
lark-workflow-meeting-summary
会议纪要整理工作流:汇总指定时间范围内的会议纪要并生成结构化报告。当用户需要整理会议纪要、生成会议周报、回顾一段时间内的会议内容时使用。
lark-wiki
飞书知识库:管理知识空间、空间成员和文档节点。创建和查询知识空间、查看和管理空间成员、管理节点层级结构、在知识库中组织文档和快捷方式。当用户需要在知识库中查找或创建文档、浏览知识空间结构、查看或管理空间成员、移动或复制节点时使用。当用户给出 doubao.com 的 /wiki/ URL/token 时,也应直接使用本 skill,不要因为域名不是飞书而回退到 WebFetch;路由依据是 URL 路径模式和 token,而不是域名。不负责:上传文件到知识库节点下(走 lark-drive)、编辑文档/表格/Base 内容(走 lark-doc / lark-sheets / lark-base)。
lark-whiteboard
飞书画板:查询和编辑飞书云文档中的画板。支持导出画板为预览图片、导出原始节点结构、使用多种格式更新画板内容。 当用户需要查看画板内容、导出画板图片、编辑画板时使用此 skill。不负责:飞书云文档内容编辑(lark-doc)、文档内嵌电子表格/Base(lark-sheets / lark-base)。
lark-vc
仅当用户或上游配置显式指定 lark-vc 时使用,相关请求统一交由 lark-meeting 技能处理。
lark-vc-agent
仅当用户或上游配置显式指定 lark-vc-agent 时使用,相关请求统一交由 lark-meeting 技能处理。