← 返回 Skills 市场
alexwoo-awso

Test Runner

作者 alexwoo-awso · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ✓ 安全检测通过
173
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install test-runner-codex
功能描述
Write and run tests across languages and frameworks.
使用说明 (SKILL.md)

Test Runner

Core workflow

  1. Detect the language, package manager, and existing test framework before changing anything.
  2. Prefer the project's current test stack over introducing a new one.
  3. Run the smallest relevant test scope first, then widen coverage after the failure is understood.
  4. When fixing bugs, start with a failing test, make the smallest code change that passes, then refactor.
  5. After changes, run the narrow test again and then a broader suite if the local workflow supports it.

Framework selection

Use the existing framework when one is already configured. If the project has no test stack, prefer:

Language Unit tests Integration End-to-end
TypeScript / JavaScript Vitest Supertest Playwright
Python pytest pytest + httpx Playwright
Swift XCTest XCTest XCUITest

Command guide

Vitest

npm install -D vitest @testing-library/react @testing-library/jest-dom
npx vitest
npx vitest run
npx vitest --coverage

Use this baseline config when a project needs one:

import { defineConfig } from 'vitest/config'

export default defineConfig({
  test: {
    globals: true,
    environment: 'jsdom',
    setupFiles: './tests/setup.ts',
  },
})

Jest

npm install -D jest @types/jest ts-jest
npx jest
npx jest --watch
npx jest --coverage
npx jest path/to/test

pytest

uv pip install pytest pytest-cov pytest-asyncio httpx
pytest
pytest -v
pytest -x
pytest --cov=app
pytest tests/test_api.py -k "test_login"
pytest --tb=short

XCTest

swift test
swift test --filter MyTests
swift test --parallel

Playwright

npm install -D @playwright/test
npx playwright install
npx playwright test
npx playwright test --headed
npx playwright test --debug
npx playwright test --project=chromium
npx playwright show-report

Red-green-refactor

  1. Red: write a failing test for the behavior you need.
  2. Green: implement the smallest change that makes it pass.
  3. Refactor: clean up without changing behavior.

Test patterns

Arrange, act, assert

test('calculates total with tax', () => {
  const cart = new Cart([{ price: 100, qty: 2 }])

  const total = cart.totalWithTax(0.08)

  expect(total).toBe(216)
})

Async tests

test('fetches user data', async () => {
  const user = await getUser('123')
  expect(user.name).toBe('Colt')
})

Mocking with Vitest

import { vi } from 'vitest'

const mockFetch = vi.fn().mockResolvedValue({
  json: () => Promise.resolve({ id: 1, name: 'Test' }),
})

vi.stubGlobal('fetch', mockFetch)

API tests in Python

import pytest
from httpx import AsyncClient
from app.main import app


@pytest.mark.asyncio
async def test_get_users():
    async with AsyncClient(app=app, base_url="http://test") as client:
        response = await client.get("/users")

    assert response.status_code == 200
    assert isinstance(response.json(), list)

React component tests

import { fireEvent, render, screen } from '@testing-library/react'
import { Button } from './Button'

test('calls onClick when clicked', () => {
  const handleClick = vi.fn()
  render(\x3CButton onClick={handleClick}>Click me\x3C/Button>)
  fireEvent.click(screen.getByText('Click me'))
  expect(handleClick).toHaveBeenCalledOnce()
})

Coverage commands

# JavaScript / TypeScript
npx vitest --coverage
npx jest --coverage

# Python
pytest --cov=app --cov-report=html
pytest --cov=app --cov-report=term
pytest --cov=app --cov-fail-under=80

What to test

Always test:

  • Public APIs and exported functions
  • Edge cases such as empty input, null, and boundary values
  • Error handling such as invalid input or network failures
  • Business logic such as calculations and state transitions

Usually skip:

  • Private implementation details
  • Framework internals
  • Trivial getters and setters
  • Third-party library behavior
安全使用建议
This skill is coherent for its purpose, but take ordinary precautions before running it: 1) Review the repository's tests before executing them—tests run project code and can execute arbitrary logic. 2) Install and run tests in an isolated environment (container, virtualenv, or CI worker) so dependency installs and browser downloads (Playwright) don't affect your host. 3) Be aware npm/pip installs will add dev dependencies to the project; run package manager commands only in the intended project directory. 4) There is a small typo in the SKILL.md ("uv pip install...") — treat that as a documentation mistake, not a runtime action. If you plan to allow autonomous agent invocation, ensure the agent's execution environment is appropriately sandboxed.
功能分析
Type: OpenClaw Skill Name: test-runner-codex Version: 1.0.1 The skill bundle provides standard instructions and commands for writing and running tests across multiple languages (JavaScript, Python, Swift). The content in SKILL.md and README.md consists of legitimate testing workflows, framework recommendations (e.g., Vitest, pytest, Playwright), and common code patterns without any evidence of malicious intent, data exfiltration, or unauthorized command execution.
能力评估
Purpose & Capability
Name and description ('Write and run tests across languages and frameworks') match the SKILL.md content: test framework guidance and commands for JS/TS, Python, Swift, and Playwright. It does not request unrelated credentials, binaries, or config paths.
Instruction Scope
Instructions focus on detecting test stacks, selecting frameworks, running test commands, and writing tests. They do tell the agent to run common package manager and test commands (npm, npx, pytest, swift, playwright) but do not instruct reading unrelated files, exfiltrating data, or contacting unknown endpoints.
Install Mechanism
No install spec and no code files — this is instruction-only. The SKILL.md suggests running standard package manager commands (npm, pip, npx, swift) which is expected for a test-runner. Nothing is downloaded from arbitrary URLs by the skill itself.
Credentials
The skill requests no environment variables, credentials, or config paths. Recommended commands will install dev dependencies locally in a project — that is proportional to a testing tool. (Note: Playwright and some test tools may download browser binaries when run; this is a normal side effect of those tools, not a credential request.)
Persistence & Privilege
always:false and user-invocable: true. The skill does not request persistent privileges or modify other skills or system-wide agent settings. Autonomous invocation is allowed by default but not elevated here.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install test-runner-codex
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /test-runner-codex 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.1
Initial release. - Provides a unified guide for writing and running tests across TypeScript, Python, and Swift projects. - Includes framework selection advice and preferred stacks for unit, integration, and end-to-end tests. - Step-by-step workflow for detecting existing setups and minimizing changes. - Offers quick command references for Vitest, Jest, pytest, XCTest, and Playwright. - Covers common test patterns, coverage commands, and practical tips on what to test.
元数据
Slug test-runner-codex
版本 1.0.1
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 1
常见问题

Test Runner 是什么?

Write and run tests across languages and frameworks. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 173 次。

如何安装 Test Runner?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install test-runner-codex」即可一键安装,无需额外配置。

Test Runner 是免费的吗?

是的,Test Runner 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Test Runner 支持哪些平台?

Test Runner 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Test Runner?

由 alexwoo-awso(@alexwoo-awso)开发并维护,当前版本 v1.0.1。

💬 留言讨论