test-runner

Write and run tests across languages and frameworks.

3,891 stars

Best use case

test-runner is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Write and run tests across languages and frameworks.

Teams using test-runner should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/test-runner-codex/SKILL.md --create-dirs "https://raw.githubusercontent.com/openclaw/skills/main/skills/alexwoo-awso/test-runner-codex/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/test-runner-codex/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How test-runner Compares

Feature / Agenttest-runnerStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Write and run tests across languages and frameworks.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# 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

```bash
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:

```typescript
import { defineConfig } from 'vitest/config'

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

### Jest

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

### pytest

```bash
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

```bash
swift test
swift test --filter MyTests
swift test --parallel
```

### Playwright

```bash
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

```typescript
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

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

### Mocking with Vitest

```typescript
import { vi } from 'vitest'

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

vi.stubGlobal('fetch', mockFetch)
```

### API tests in Python

```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

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

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

## Coverage commands

```bash
# 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

Related Skills

backtester

3891
from openclaw/skills

Professional backtesting framework for trading strategies. Tests SMA crossover, RSI, MACD, Bollinger Bands, and custom strategies on historical data. Generates equity curves, drawdown analysis, and performance metrics.

Finance & Investing

pentest-c2-operator

3891
from openclaw/skills

Set up authorized C2 simulation workflows and measure defensive detection outcomes.

Security

pentest-auth-bypass

3891
from openclaw/skills

Test authentication and session management controls for bypass and account takeover scenarios.

Security

pentest-api-attacker

3891
from openclaw/skills

Test APIs against OWASP API Security Top 10 including discovery, auth abuse, and protocol-specific checks.

Security

pentest-active-directory

3891
from openclaw/skills

Assess Active Directory identity attack paths including roasting, relay, and delegation abuse.

Security

nmap-pentest-scans

3891
from openclaw/skills

Plan and orchestrate authorized Nmap host discovery, port and service enumeration, NSE profiling, and reporting artifacts for in-scope targets.

Security

subagent-testing

3891
from openclaw/skills

Test skills via RED/GREEN/REFACTOR TDD with fresh subagents

tracker-latest-run-monitor

3891
from openclaw/skills

Monitor the most recent run result of a configured OpenClaw cron job and send a compact Feishu private message with the latest execution time, status, and detail. Use when a user wants a standalone skill for latest-run monitoring, cron status notifications, daily status pings, or Feishu alerts for a tracker/scheduled job regardless of success or failure.

vue-latest-changelog

3891
from openclaw/skills

当用户要求查看和整理最新的Vue版本更新信息时,请遵循此规范获取相关内容。

rust-testing-code-review

3891
from openclaw/skills

Reviews Rust test code for unit test patterns, integration test structure, async testing, mocking approaches, and property-based testing. Use when reviewing _test.rs files,

skill-test-sandbox

3891
from openclaw/skills

将用户给出的任意非技术话题用三行打油诗(每行字数相近、押韵或顺口)进行趣味总结。不调用任何工具。 在用户要求测试 Skill、沙盒演示、打油诗总结、或明确说与充电业务无关的玩笑/练习时使用。

pytest-code-review

3891
from openclaw/skills

Reviews pytest test code for async patterns, fixtures, parametrize, and mocking. Use when reviewing test_*.py files, checking async test functions, fixture usage, or mock patterns.