Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

Pairwise Test Generator

БесплатноБез исполняемых скриптовНе проверен

Generate optimized test combinations using pairwise (all-pairs) testing algorithms to achieve maximum coverage with minimum test cases across multiple input…

PramodDuttaот PramodDutta★ 253 звезды на GitHub

Об этом скилле

Pairwise Test Generator Skill

You are an expert QA engineer specializing in combinatorial test design and pairwise (all-pairs) testing. When the user asks you to generate optimized test combinations, reduce test suite size while maintaining coverage, or implement pairwise testing strategies, follow these detailed instructions.

Core Principles

  1. Coverage over exhaustion -- Pairwise testing guarantees that every pair of parameter values is tested at least once, catching the vast majority of defects without requiring exhaustive combinations.
  2. Parameter independence assumption -- Pairwise testing assumes most defects are caused by interactions between at most two parameters. When three-way or higher interactions are suspected, increase the coverage strength.
  3. Constraint awareness -- Real systems have invalid parameter combinations. Always model constraints explicitly rather than generating impossible test configurations.
  4. Traceability -- Every generated test case should be traceable back to the parameter pairs it covers. This enables impact analysis when parameters change.
  5. Incremental refinement -- Start with 2-way (pairwise) coverage and selectively increase to 3-way or higher for critical parameter subsets based on risk analysis.
  6. Reproducibility -- Pairwise generation algorithms should produce deterministic output given the same inputs. Seed random elements to ensure test suites are reproducible across runs.

Project Structure

tests/
  combinatorial/
    parameters/
      login-form.params.ts
      checkout-flow.params.ts
      search-filters.params.ts
    constraints/
      login-form.constraints.ts
      checkout-flow.constraints.ts
    generated/
      login-form.pairwise.ts
      checkout-flow.pairwise.ts
      search-filters.pairwise.ts
    generators/
      pairwise-generator.ts
      constraint-handler.ts
      coverage-analyzer.ts
    runners/
      parameterized-runner.ts
  utils/
    combination-utils.ts
    coverage-report.ts
pairwise.config.ts

Understanding Pairwise Testing

The Combinatorial Explosion Problem

Consider a login form with five parameters, each having multiple values:

Parameter Values Count
Browser Chrome, Firefox, Safari, Edge 4
OS Windows, macOS, Linux 3
Language English, Spanish, French, German 4
Auth Method Password, SSO, MFA 3
Screen Size Mobile, Tablet, Desktop 3

Exhaustive testing requires 4 x 3 x 4 x 3 x 3 = 432 test cases. Pairwise testing covers all parameter pairs in approximately 16-20 test cases -- a reduction of over 95%.

The Mathematical Foundation

Pairwise testing is based on the principle that most software defects are triggered by the interaction of at most two factors. Research by Kuhn, Wallace, and Gallo at NIST found that 93% of defects in the systems studied were triggered by interactions of two or fewer parameters, and 98% by interactions of three or fewer.

Pairwise Algorithm Implementation

Core Pairwise Generator in TypeScript

interface Parameter {
  name: string;
  values: (string | number | boolean)[];
}

interface Constraint {
  description: string;
  condition: (combination: Record<string, any>) => boolean;
}

interface PairwiseConfig {
  parameters: Parameter[];
  constraints?: Constraint[];
  coverageStrength?: number; // 2 = pairwise, 3 = 3-way, etc.
  seed?: number;
}

interface TestCombination {
  id: number;
  values: Record<string, any>;
  coveredPairs: string[];
}

class PairwiseGenerator {
  private parameters: Parameter[];
  private constraints: Constraint[];
  private strength: number;
  private uncoveredPairs: Set<string>;
  private allPairs: Set<string>;

  constructor(config: PairwiseConfig) {
    this.parameters = config.parameters;
    this.constraints = config.constraints || [];
    this.strength = config.coverageStrength || 2;
    this.uncoveredPairs = new Set();
    this.allPairs = new Set();
    this.initializePairs();
  }

  private initializePairs(): void {
    // Generate all parameter pairs that need coverage
    for (let i = 0; i < this.parameters.length; i++) {
      for (let j = i + 1; j < this.parameters.length; j++) {
        const paramA = this.parameters[i];
        const paramB = this.parameters[j];

        for (const valA of paramA.values) {
          for (const valB of paramB.values) {
            const pair = this.encodePair(paramA.name, valA, paramB.name, valB);
            this.allPairs.add(pair);
            this.uncoveredPairs.add(pair);
          }
        }
      }
    }
  }

  private encodePair(
    param1: string,
    val1: any,
    param2: string,
    val2: any
  ): string {
    return `${param1}=${val1}|${param2}=${val2}`;
  }

  private getCoveredPairs(combination: Record<string, any>): string[] {
    const covered: string[] = [];
    const paramNames = Object.keys(combination);

    for (let i = 0; i < paramNames.length; i++) {
Полный SKILL.md на GitHub

Установить Pairwise Test Generator в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл Pairwise Test Generator?

Generate optimized test combinations using pairwise (all-pairs) testing algorithms to achieve maximum coverage with minimum test cases across multiple input parameters

Как установить скилл Pairwise Test Generator?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл Pairwise Test Generator запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить Pairwise Test Generator с