Skip to content
cccskills
FreePublished on GitHub

testing-strategist

Comprehensive testing strategies including unit tests, integration tests, E2E tests, property-based testing, visual regression, and test automation. Use when writing tests, setting up testing frameworks, or designing test coverage strategies.

The English summary is being prepared. Showing the original description.

Works withPlaywright
See how to install

Files included (1)

  • SKILL.md4.5 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Testing Strategist

Testing Pyramid

    /\
   /  \  E2E Tests (Playwright) - 10%
  /____\
 /      \ Integration Tests - 30%
/________\
Unit Tests (Jest/Vitest) - 60%

Unit Testing

Component Tests

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

describe('UserProfile', () => {
  it('renders user information', () => {
    const user = { name: 'John', email: 'john@example.com' };
    render(<UserProfile user={user} />);
    
    expect(screen.getByText('John')).toBeInTheDocument();
    expect(screen.getByText('john@example.com')).toBeInTheDocument();
  });
  
  it('handles edit action', () => {
    const onEdit = vi.fn();
    render(<UserProfile user={user} onEdit={onEdit} />);
    
    fireEvent.click(screen.getByText('Edit'));
    expect(onEdit).toHaveBeenCalled();
  });
});

Custom Hook Tests

import { renderHook, act } from '@testing-library/react';
import { useCounter } from './useCounter';

describe('useCounter', () => {
  it('increments counter', () => {
    const { result } = renderHook(() => useCounter(0));
    
    act(() => {
      result.current.increment();
    });
    
    expect(result.current.count).toBe(1);
  });
});

Integration Testing

API Route Tests

import { createTestServer } from '@/test/utils';

describe('POST /api/users', () => {
  const server = createTestServer();
  
  it('creates user with valid data', async () => {
    const response = await server
      .post('/api/users')
      .send({ email: 'test@example.com', password: 'Secure123!' })
      .expect(201);
    
    expect(response.body.data.email).toBe('test@example.com');
  });
  
  it('rejects invalid email', async () => {
    await server
      .post('/api/users')
      .send({ email: 'invalid', password: 'pass' })
      .expect(400);
  });
});

Database Integration

describe('UserRepository', () => {
  beforeEach(async () => {
    await db.delete(users);
  });
  
  it('creates and retrieves user', async () => {
    const user = await userRepo.create({
      email: 'test@example.com',
      name: 'Test User'
    });
    
    const retrieved = await userRepo.findById(user.id);
    expect(retrieved?.email).toBe('test@example.com');
  });
});

E2E Testing (Playwright)

import { test, expect } from '@playwright/test';

test.describe('Authentication Flow', () => {
  test('user can log in', async ({ page }) => {
    await page.goto('/login');
    
    await page.fill('[name="email"]', 'user@example.com');
    await page.fill('[name="password"]', 'password123');
    await page.click('button[type="submit"]');
    
    await expect(page).toHaveURL('/dashboard');
    await expect(page.locator('h1')).toContainText('Dashboard');
  });
  
  test('shows error for invalid credentials', async ({ page }) => {
    await page.goto('/login');
    
    await page.fill('[name="email"]', 'wrong@example.com');
    await page.fill('[name="password"]', 'wrong');
    await page.click('button[type="submit"]');
    
    await expect(page.locator('.error')).toContainText('Invalid credentials');
  });
});

Property-Based Testing

import { fc, test } from '@fast-check/vitest';

test.prop([fc.array(fc.integer())])('sort is idempotent', (arr) => {
  const sorted = [...arr].sort((a, b) => a - b);
  const sortedAgain = [...sorted].sort((a, b) => a - b);
  expect(sorted).toEqual(sortedAgain);
});

Test Coverage Strategy

// vitest.config.ts
export default defineConfig({
  test: {
    coverage: {
      provider: 'v8',
      reporter: ['text', 'json', 'html'],
      thresholds: {
        lines: 80,
        functions: 80,
        branches: 70,
        statements: 80
      },
      exclude: [
        '**/*.config.*',
        '**/node_modules/**',
        '**/__tests__/**'
      ]
    }
  }
});

Mocking Patterns

// Mock external services
vi.mock('@/integrations/stripe', () => ({
  createPaymentIntent: vi.fn().mockResolvedValue({
    clientSecret: 'secret_123'
  })
}));

// Mock database
vi.mock('@/db', () => ({
  db: {
    query: {
      users: {
        findFirst: vi.fn()
      }
    }
  }
}));

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

ai-sdk

Free

Vercel AI SDK expert guidance. Use when building AI-powered features — chat interfaces, text generation, structured output, tool calling, agents, MCP integration, streaming, embeddings, reranking, image generation, or working with any LLM provider.

The English summary is being prepared. Showing the original description.

garochee33/DSH4Updated Oct 19, 2026

Algorithm design and analysis skill for DSH; use when working on optimization, data structures, or computational procedures.

The English summary is being prepared. Showing the original description.

garochee33/DSH4Updated Oct 19, 2026

Design and implement scalable API gateways, RESTful APIs, GraphQL endpoints, WebSocket handlers, and microservice communication patterns. Use when creating API routes, designing endpoints, implementing middleware, or setting up service mesh architectures.

The English summary is being prepared. Showing the original description.

garochee33/DSH4Updated Oct 19, 2026

Implement a task N ways in parallel and pick the best. Spawns multiple subagents in isolated worktrees, evaluates all candidates, and applies the winner. Use when asked to "best of n", "try multiple approaches", "parallel implementations", "/best-of-n", or "/bon".

The English summary is being prepared. Showing the original description.

garochee33/DSH4Updated Oct 19, 2026

check

Free

Check your work with a verification subagent. Spawns a verifier that reviews diffs, runs builds and tests, and evaluates correctness. Use when asked to "check work", "verify changes", "self-verify", "/check", "/verify", "/check-work", or "/self-verify".

The English summary is being prepared. Showing the original description.

garochee33/DSH4Updated Oct 19, 2026

CI/CD pipeline design, GitHub Actions workflows, deployment automation, infrastructure as code, and release management. Use when setting up CI/CD, automating deployments, configuring build pipelines, or managing releases.

The English summary is being prepared. Showing the original description.

garochee33/DSH4Updated Oct 19, 2026

See all skills by garochee33

Report a problem with this skill