home / skills / doanchienthangdev / omgkit / comprehensive-testing

comprehensive-testing skill

/plugin/skills/testing/comprehensive-testing

This skill guides comprehensive 4D testing across accuracy, performance, security, and accessibility to ensure production-ready quality.

npx playbooks add skill doanchienthangdev/omgkit --skill comprehensive-testing

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
7.1 KB
---
name: testing/comprehensive-testing
description: Comprehensive 4D testing methodology covering Accuracy, Performance, Security, and Accessibility for production-ready quality assurance
category: testing
tags:
  - testing
  - quality
  - omega
  - comprehensive
  - methodology
related_skills:
  - testing/vitest
  - testing/property-testing
  - testing/security-testing
  - testing/performance-testing
  - methodology/omega
---

# Omega Testing

Comprehensive 4-Dimensional testing methodology for production-ready quality assurance.

## Quick Start

```javascript
// Run comprehensive Omega tests
npm run test:omega

// Or run individual dimensions
npm run test:accuracy     // Unit, integration, E2E
npm run test:performance  // Load, stress, benchmarks
npm run test:security     // Vulnerability, injection, auth
npm run test:a11y         // WCAG, keyboard, screen reader
```

## The 4 Dimensions

### 1. Accuracy Testing
Ensures correctness of functionality.

```javascript
// Unit Tests - Isolated function testing
describe('calculateTotal', () => {
  it('calculates sum correctly', () => {
    expect(calculateTotal([10, 20, 30])).toBe(60);
  });

  it('handles empty array', () => {
    expect(calculateTotal([])).toBe(0);
  });

  it('handles negative numbers', () => {
    expect(calculateTotal([-10, 20])).toBe(10);
  });
});

// Integration Tests - Component interaction
describe('OrderService', () => {
  it('creates order with payment', async () => {
    const order = await orderService.create(cart, payment);
    expect(order.status).toBe('confirmed');
    expect(paymentService.charge).toHaveBeenCalled();
  });
});

// E2E Tests - Full user flows
test('user can complete checkout', async ({ page }) => {
  await page.goto('/products');
  await page.click('[data-testid="add-to-cart"]');
  await page.click('[data-testid="checkout"]');
  await page.fill('#email', '[email protected]');
  await page.click('[data-testid="place-order"]');
  await expect(page.locator('.order-confirmation')).toBeVisible();
});
```

### 2. Performance Testing
Ensures speed and resource efficiency.

```javascript
// Benchmark Tests
describe('Performance Benchmarks', () => {
  it('responds under 100ms', async () => {
    const start = performance.now();
    await api.fetch('/users');
    const duration = performance.now() - start;
    expect(duration).toBeLessThan(100);
  });

  it('handles 1000 concurrent requests', async () => {
    const requests = Array(1000).fill().map(() => api.fetch('/users'));
    const results = await Promise.all(requests);
    expect(results.every(r => r.status === 200)).toBe(true);
  });
});

// Memory Tests
it('does not leak memory', async () => {
  const before = process.memoryUsage().heapUsed;
  for (let i = 0; i < 1000; i++) {
    await processData(largeDataset);
  }
  global.gc();
  const after = process.memoryUsage().heapUsed;
  expect(after - before).toBeLessThan(10 * 1024 * 1024); // 10MB
});
```

### 3. Security Testing
Ensures protection against vulnerabilities.

```javascript
// Injection Tests
describe('SQL Injection Prevention', () => {
  const maliciousInputs = [
    "'; DROP TABLE users; --",
    "1' OR '1'='1",
    "admin'--",
  ];

  maliciousInputs.forEach(input => {
    it(`blocks injection: ${input.slice(0, 20)}...`, async () => {
      const result = await db.query(
        'SELECT * FROM users WHERE name = ?',
        [input]
      );
      expect(result).toEqual([]);
    });
  });
});

// Authentication Tests
describe('Authentication', () => {
  it('rejects expired tokens', async () => {
    const expiredToken = generateToken({ exp: Date.now() - 1000 });
    const response = await api.get('/protected', {
      headers: { Authorization: `Bearer ${expiredToken}` },
    });
    expect(response.status).toBe(401);
  });

  it('prevents brute force', async () => {
    for (let i = 0; i < 10; i++) {
      await api.post('/login', { password: 'wrong' });
    }
    const response = await api.post('/login', { password: 'correct' });
    expect(response.status).toBe(429); // Rate limited
  });
});
```

### 4. Accessibility Testing
Ensures usability for all users.

```javascript
// WCAG Compliance
describe('Accessibility', () => {
  it('has proper heading hierarchy', async () => {
    const headings = await page.$$eval('h1, h2, h3, h4, h5, h6', els =>
      els.map(el => ({ level: parseInt(el.tagName[1]), text: el.textContent }))
    );

    for (let i = 1; i < headings.length; i++) {
      const skip = headings[i].level - headings[i-1].level;
      expect(skip).toBeLessThanOrEqual(1);
    }
  });

  it('images have alt text', async () => {
    const images = await page.$$('img');
    for (const img of images) {
      const alt = await img.getAttribute('alt');
      expect(alt).toBeTruthy();
    }
  });

  it('is keyboard navigable', async () => {
    await page.keyboard.press('Tab');
    const focused = await page.evaluate(() => document.activeElement.tagName);
    expect(['A', 'BUTTON', 'INPUT']).toContain(focused);
  });
});

// Screen Reader Testing
it('announces dynamic content', async () => {
  await page.click('#load-more');
  const liveRegion = await page.$('[aria-live="polite"]');
  expect(await liveRegion.textContent()).toContain('Loaded');
});
```

## Coverage Requirements

| Dimension | Minimum | Target | Excellent |
|-----------|---------|--------|-----------|
| Accuracy (Unit) | 80% | 90% | 95% |
| Accuracy (Integration) | 60% | 75% | 85% |
| Performance | Pass SLAs | <100ms p95 | <50ms p95 |
| Security | No critical | No high | No medium |
| Accessibility | AA | AAA | Full AAA |

## Test Organization

```
tests/
├── accuracy/
│   ├── unit/           # Isolated unit tests
│   ├── integration/    # Component integration
│   └── e2e/            # End-to-end flows
├── performance/
│   ├── benchmarks/     # Speed benchmarks
│   ├── load/           # Load testing
│   └── stress/         # Stress testing
├── security/
│   ├── injection/      # Injection tests
│   ├── auth/           # Authentication
│   └── vulnerabilities/# Known vulns
└── accessibility/
    ├── wcag/           # WCAG compliance
    ├── keyboard/       # Keyboard nav
    └── screen-reader/  # SR compatibility
```

## F.I.R.S.T. Principles

- **Fast**: Tests run quickly (< 1ms for unit, < 100ms for integration)
- **Independent**: Tests don't depend on each other
- **Repeatable**: Same results every time
- **Self-Validating**: Pass or fail, no manual inspection
- **Timely**: Write tests before or with code

## Anti-Patterns to Avoid

1. **Testing Implementation**: Test behavior, not internals
2. **Flaky Tests**: Eliminate randomness and timing issues
3. **Over-Mocking**: Don't mock everything
4. **Ignoring Edge Cases**: Test boundaries and errors
5. **Copy-Paste Tests**: Use parameterized tests
6. **No Assertions**: Every test must assert something
7. **Testing Third-Party Code**: Focus on your code

## When to Use

- Starting a new project with quality focus
- Improving existing test coverage
- Preparing for production deployment
- Meeting compliance requirements (SOC2, GDPR)
- Building critical infrastructure

Overview

This skill provides a comprehensive 4-dimensional testing methodology—Accuracy, Performance, Security, and Accessibility—designed to validate production readiness. It bundles guidance, coverage targets, and an organized test structure to help teams build reliable, performant, secure, and inclusive applications. The approach is language-agnostic but includes practical JavaScript-focused examples and commands for integration into CI pipelines.

How this skill works

The skill inspects application behavior across four explicit dimensions: unit/integration/E2E for correctness; benchmarks, load and memory tests for performance; injection and auth scenarios for security; and WCAG, keyboard, and screen reader checks for accessibility. It defines pass criteria, coverage targets, and test organization so teams can run the full suite or individual dimensions during development and CI. Results are self-validating and intended to be fast, independent, and repeatable to avoid flakiness.

When to use it

  • Starting a new project with a quality-first discipline
  • Raising or measuring test coverage before a release
  • Validating performance SLAs and memory behavior under load
  • Assessing security posture against injections, auth failures, and rate limits
  • Ensuring accessibility compliance (WCAG AA/AAA) before deployment
  • Meeting compliance or audit requirements for production systems

Best practices

  • Follow F.I.R.S.T. principles: Fast, Independent, Repeatable, Self-validating, Timely
  • Organize tests by dimension and type (unit, integration, e2e, benchmarks, load, security, a11y)
  • Aim for defined coverage targets and measurable SLAs; track progress vs Minimum/Target/Excellent
  • Avoid anti-patterns: don’t test internals, eliminate flakiness, and avoid over-mocking
  • Automate dimension runs in CI with gates for critical failures and performance regressions

Example use cases

  • Run the full 4D suite in CI pre-release to block regressions and catch regressions early
  • Add performance benchmarks and memory checks to detect leaks after major refactors
  • Create injection and auth tests to harden APIs before public launch
  • Integrate WCAG checks and keyboard/screen-reader tests as part of UI acceptance criteria
  • Use dimension-specific scripts to triage issues quickly during incident response

FAQ

Can I run only part of the suite?

Yes. The methodology supports running individual dimensions so teams can focus on accuracy, performance, security, or accessibility independently.

What coverage and SLA targets should I aim for?

Use the provided Minimum/Target/Excellent thresholds: e.g., unit coverage 80/90/95%, integration 60/75/85%, and performance p95 <100ms (target) with <50ms for excellent.