AgentSkillsCN

scenario-authoring

以“邪恶场景”格式撰写端到端测试场景的指南。涵盖场景结构、前言字段、步骤格式,以及最佳实践。 适用场景如下: - 创建新的测试场景 - 理解场景的格式 - 为某一测试类别选择合适的CLI工具

SKILL.md
--- frontmatter
name: scenario-authoring
description: |
  Guide for writing E2E test scenarios in the wicked-scenarios format.
  Covers scenario structure, frontmatter fields, step format, and best practices.

  Use when:
  - Creating new test scenarios
  - Understanding the scenario format
  - Choosing the right CLI tool for a test category

Scenario Authoring Guide

Write E2E test scenarios as markdown files that both humans and AI agents can execute.

Quick Start

Create a .md file in the scenarios/ directory with this structure:

yaml
---
name: my-scenario
description: What this scenario tests
category: api          # api|browser|perf|infra|security|a11y
tools:
  required: [curl]     # Must be installed to run
  optional: [hurl]     # Used if available, skipped if not
difficulty: basic      # basic|intermediate|advanced
timeout: 60            # Max seconds
---

Then write steps in the markdown body:

markdown
## Steps

### Step 1: Description (cli-name)

\`\`\`bash
curl -sf https://example.com/api/health
\`\`\`

**Expect**: Exit code 0, healthy response

Categories and Tools

CategoryToolsWhat to Test
apicurl, hurlHealth checks, API contracts, response validation
browserplaywright, agent-browserPage load, interactions, content verification
perfk6, heyLoad testing, response time thresholds
infratrivyContainer scanning, IaC security
securitysemgrepSAST, code security patterns
a11ypa11yWCAG compliance, accessibility issues

Key Rules

  1. Exit code = pass/fail — exit 0 is PASS, non-zero is FAIL
  2. One CLI per step — identify it in the step header parenthetical
  3. Fenced code blocks — use appropriate language hint (bash, hurl, javascript)
  4. Headless flags — browser/a11y tools must include headless configuration
  5. Cleanup section — remove temp files created during execution

References