automated-test-runner

by cmanfre7 · View original on ClawHub

Write and run tests across languages and frameworks. Covers Vitest, Jest, pytest, XCTest, and Playwright with TDD workflows, test patterns, mocking, coverage commands, and best practices for what to test.

Module AI Quality v1.0.0 Audited 2026-02-07
88 Trust

Permissions

File Read Can read project files
File Write Can write and modify files
Network No network access
Shell Can execute shell commands

Risk Assessment

Elevated Risk

This skill requests 3 of 4 possible permissions. Elevated scope — ensure each permission is justified. Consider running in a sandbox.

Shell access can execute arbitrary commands. Use a sandbox for extra safety.

SKILL.md

Write and run tests across languages and frameworks.

Framework Selection

Language Unit Tests Integration E2E
TypeScript/JS Vitest (preferred), Jest Supertest Playwright
Python pytest pytest + httpx Playwright
Swift XCTest XCTest XCUITest

Quick Start by Framework

Vitest (TypeScript / JavaScript)

npm install -D vitest @testing-library/react @testing-library/jest-dom
// vitest.config.ts
import { defineConfig } from 'vitest/config'
export default defineConfig({
  test: {
    globals: true,
    environment: 'jsdom',
    setupFiles: './tests/setup.ts',
  },
})
npx vitest              # Watch mode
npx vitest run          # Single run
npx vitest --coverage   # With coverage

Jest

npm install -D jest @types/jest ts-jest
npx jest                # Run all
npx jest --watch        # Watch mode
npx jest --coverage     # With coverage
npx jest path/to/test   # Single file

pytest (Python)

uv pip install pytest pytest-cov pytest-asyncio httpx
pytest                          # Run all
pytest -v                       # Verbose
pytest -x                       # Stop on first failure
pytest --cov=app                # With coverage
pytest tests/test_api.py -k "test_login"  # Specific test
pytest --tb=short               # Short tracebacks

XCTest (Swift)

swift test                      # Run all tests
swift test --filter MyTests     # Specific test suite
swift test --parallel           # Parallel execution

Playwright (E2E)

npm install -D @playwright/test
npx playwright install
npx playwright test                    # Run all
npx playwright test --headed           # With browser visible
npx playwright test --debug            # Debug mode
npx playwright test --project=chromium # Specific browser
npx playwright show-report             # View HTML report

TDD Workflow

  1. Red — Write a failing test that describes the desired behavior.
  2. Green — Write the minimum code to make the test pass.
  3. Refactor — Clean up the code while keeping tests green.
┌─────────┐     ┌─────────┐     ┌──────────┐
│  Write   │────▶│  Write  │────▶│ Refactor │──┐
│  Test    │     │  Code   │     │  Code    │  │
│  (Red)   │     │ (Green) │     │          │  │
└─────────┘     └─────────┘     └──────────┘  │
     ▲                                          │
     └──────────────────────────────────────────┘

Test Patterns

Arrange-Act-Assert

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

  // Act
  const total = cart.totalWithTax(0.08);

  // Assert
  expect(total).toBe(216);
});

Testing Async Code

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

Mocking

import { vi } from 'vitest';

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

Testing API Endpoints (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)

Testing React Components

import { render, screen, fireEvent } 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

# JavaScript/TypeScript
npx vitest --coverage          # Vitest (uses v8 or istanbul)
npx jest --coverage            # Jest

# Python
pytest --cov=app --cov-report=html    # HTML report
pytest --cov=app --cov-report=term    # Terminal output
pytest --cov=app --cov-fail-under=80  # Fail if < 80%

# View HTML coverage report
open coverage/index.html       # macOS
open htmlcov/index.html        # Python

What to Test

Always test:

  • Public API / exported functions
  • Edge cases: empty input, null, boundary values
  • Error handling: invalid input, network failures
  • Business logic: calculations, state transitions

Don't bother testing:

  • Private implementation details
  • Framework internals (React rendering, Express routing)
  • Trivial getters/setters
  • Third-party library behavior

Why You Need automated-test-runner

Writing and running tests is the single most effective way to prevent regressions, yet most developers skip it because setting up test frameworks, writing boilerplate, and interpreting output is tedious. The gap between "I should write tests" and actually having a passing test suite is where bugs slip through.

Automated Test Runner bridges that gap by generating tests and executing them across any language and framework. Describe what you want to test, and the skill writes the test file, runs it, and reports results — including stack traces and suggested fixes for failures. It supports Jest, pytest, Go testing, Mocha, RSpec, and dozens more.

Whether you are adding tests to a legacy codebase or practicing TDD on a new project, Automated Test Runner eliminates the boilerplate so you can focus on test logic.

Common Use Cases

  • Generate and run unit tests for a function across JavaScript, Python, Go, or Ruby
  • Add integration tests to an existing API endpoint with automatic assertion generation
  • Run a full test suite and get a summary with failing test details and suggested fixes
  • Practice TDD by describing expected behavior and letting the skill generate the test first
  • Validate a refactoring by running existing tests and comparing before/after results

Frequently Asked Questions

Which test frameworks does it support?

It supports all major frameworks: Jest, Mocha, Vitest (JavaScript/TypeScript), pytest, unittest (Python), go test (Go), RSpec (Ruby), JUnit (Java), and more. It auto-detects the framework from your project config.

Does it execute tests or just generate them?

Both. It writes the test file and immediately runs it using the appropriate test runner command. You see the full output including pass/fail status and stack traces.

Can it test code that requires a database or external service?

It can generate tests with mocks and stubs for external dependencies. For integration tests that need a real database, you will need the service running locally.

Related Guides