Quality Agents

QA Backend, QA Frontend, and QA Firmware - the testing layer

🎯 Key Opinion: Quality agents should run in parallel with implementation, not after. Write tests alongside code, not as an afterthought. This catches bugs earlier, reduces rework, and ensures tests actually match implementation intent.

Overview

Quality agents form the testing layer of your AI team. Each agent specializes in a different testing domain, from API contracts to visual regression. They ensure your code works correctly, performs well, and remains accessible.

AgentDomainTest Types
QA BackendServer-side testingUnit, integration, API, load, security
QA FrontendClient-side testingComponent, E2E, visual regression, a11y
QA FirmwareEmbedded testingHIL, protocol, timing, hardware validation

QA Backend

The QA Backend agent specializes in server-side testing. It writes comprehensive test suites covering unit tests, API integration tests, load tests, and security tests. It understands testing patterns for different backend architectures.

Responsibilities

Test TypePurposeWhen to Use
Unit TestsTest individual functions and classes in isolationEvery function with logic, especially edge cases
Integration TestsTest interactions between components and servicesDatabase queries, external APIs, message queues
API TestsTest HTTP endpoints for contract complianceEvery public API endpoint
Load TestsTest performance under expected and peak loadBefore launch, after significant changes
Security TestsTest for vulnerabilities and auth bypassAuth endpoints, data access, input handling

Technologies

  • Test Runners: Jest, Vitest, pytest, Go testing, JUnit
  • API Testing: Supertest, httpx, REST Client, Postman/Newman
  • Load Testing: k6, Artillery, Locust, Gatling
  • Mocking: MSW, nock, responses, WireMock, testcontainers
  • Security: OWASP ZAP, Burp Suite, SQLMap, Snyk

Invoking QA Backend

# Write unit tests
@qa-backend Write unit tests for src/services/order.service.ts
Cover: order creation, validation, price calculation, edge cases.
Target: 90% coverage. Use Jest with TypeScript.

# Write API integration tests
@qa-backend Create API tests for the /api/users endpoints:
- GET /api/users (list with pagination)
- GET /api/users/:id (single user)
- POST /api/users (create)
- PATCH /api/users/:id (update)
- DELETE /api/users/:id (soft delete)
Include auth scenarios and error cases.

# Write load tests
@qa-backend Create a k6 load test for the checkout flow:
- Ramp up: 0 to 100 users over 2 minutes
- Sustained: 100 users for 10 minutes
- Ramp down: 100 to 0 over 1 minute
Thresholds: p95 < 500ms, error rate < 1%

# Write security tests
@qa-backend Create security tests for authentication:
- SQL injection on login
- JWT tampering and expiration
- Rate limiting verification
- CORS policy enforcement

Test Organization Pattern

tests/
β”œβ”€β”€ unit/
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ order.service.test.ts
β”‚   β”‚   └── user.service.test.ts
β”‚   └── utils/
β”‚       └── validation.test.ts
β”œβ”€β”€ integration/
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   β”œβ”€β”€ orders.test.ts
β”‚   β”‚   └── users.test.ts
β”‚   └── database/
β”‚       └── repositories.test.ts
β”œβ”€β”€ load/
β”‚   β”œβ”€β”€ checkout-flow.k6.js
β”‚   └── api-stress.k6.js
└── security/
    β”œβ”€β”€ auth.security.test.ts
    └── injection.security.test.ts
πŸ“‹ Coverage Strategy: Aim for high coverage on business logic, lower coverage on glue code. 100% coverage isn't the goalβ€”meaningful coverage is.

QA Frontend

The QA Frontend agent specializes in client-side testing. It writes component tests, end-to-end tests, visual regression tests, and accessibility audits. It understands modern frontend testing best practices.

Responsibilities

Test TypePurposeWhen to Use
Component TestsTest UI components in isolation with various propsEvery reusable component
E2E TestsTest complete user flows through the applicationCritical paths: auth, checkout, core features
Visual RegressionDetect unintended visual changesDesign system components, landing pages
Accessibility TestsEnsure WCAG compliance and screen reader supportAll user-facing pages and components

Technologies

  • Component Testing: Testing Library, Storybook, Vitest
  • E2E: Playwright, Cypress, WebdriverIO
  • Visual Regression: Playwright screenshots, Percy, Chromatic
  • Accessibility: axe-core, Pa11y, Lighthouse, WAVE
  • Mocking: MSW (Mock Service Worker), Mirage JS

Invoking QA Frontend

# Write component tests
@qa-frontend Write tests for the DataTable component:
- Renders with data
- Handles empty state
- Sorting functionality
- Pagination controls
- Row selection
Use Testing Library with Vitest.

# Write E2E tests
@qa-frontend Create Playwright E2E tests for checkout:
1. Add items to cart
2. Proceed to checkout
3. Fill shipping info
4. Enter payment details
5. Complete order
6. Verify confirmation page
Include error scenarios and edge cases.

# Visual regression tests
@qa-frontend Set up visual regression for the design system:
- Button variants (primary, secondary, ghost)
- Form inputs (text, select, checkbox)
- Cards and modals
- Dark mode variants
Use Playwright screenshots with comparison.

# Accessibility audit
@qa-frontend Create accessibility tests for the main pages:
- Home page
- Product listing
- Product detail
- Checkout flow
Use axe-core integration with Playwright.
Flag any WCAG 2.1 AA violations.

E2E Test Structure

// tests/e2e/checkout.spec.ts
import { test, expect } from '@playwright/test';

test.describe('Checkout Flow', () => {
  test.beforeEach(async ({ page }) => {
    // Set up authenticated user with items in cart
    await page.goto('/');
    await loginAsTestUser(page);
    await addItemToCart(page, 'product-123');
  });

  test('completes checkout successfully', async ({ page }) => {
    await page.goto('/checkout');
    
    // Fill shipping
    await page.getByLabel('Address').fill('123 Test St');
    await page.getByLabel('City').fill('Test City');
    await page.getByRole('button', { name: 'Continue' }).click();
    
    // Fill payment
    await page.getByLabel('Card number').fill('4242424242424242');
    await page.getByRole('button', { name: 'Place Order' }).click();
    
    // Verify confirmation
    await expect(page.getByRole('heading', { name: 'Order Confirmed' }))
      .toBeVisible();
    await expect(page.getByText(/Order #/)).toBeVisible();
  });

  test('shows error for invalid card', async ({ page }) => {
    // ... test invalid payment scenario
  });
});
⚠️ Flaky Test Prevention: Always use proper waits and assertions. Never use sleep(). Use waitFor and expect with appropriate timeouts. Flaky tests erode confidence.

QA Firmware

The QA Firmware agent specializes in embedded systems testing. It designs Hardware-in-the-Loop (HIL) tests, protocol validation, timing verification, and hardware interface testing.

Responsibilities

Test TypePurposeWhen to Use
HIL TestingTest firmware with real or simulated hardwareIntegration with sensors, actuators, peripherals
Protocol ValidationVerify communication protocol complianceBLE, CAN, I2C, SPI, custom protocols
Timing VerificationEnsure real-time constraints are metRTOS tasks, interrupt latency, PWM accuracy
Power AnalysisMeasure and verify power consumptionBattery-powered devices, sleep mode testing

Technologies

  • HIL Frameworks: Robot Framework, pytest-embedded, Unity
  • Protocol Analyzers: Saleae Logic, Wireshark, BLE sniffers
  • Timing Tools: Logic analyzers, oscilloscopes, SEGGER SystemView
  • Power Analysis: Nordic PPK, Joulescope, multimeters
  • Simulation: Renode, QEMU, vendor simulators

Invoking QA Firmware

# HIL test setup
@qa-firmware Design HIL tests for the sensor module:
- BME280 temperature/humidity readings
- Accelerometer motion detection
- GPIO interrupt handling
Platform: STM32F4 with pytest-embedded.
Include mock sensor responses for CI.

# Protocol validation
@qa-firmware Create BLE protocol tests for the fitness tracker:
- GATT service discovery
- Heart rate characteristic notifications
- Battery level reads
- Connection/disconnection handling
Use nRF Connect SDK testing framework.

# Timing verification
@qa-firmware Verify timing constraints for motor control:
- PWM frequency: 20kHz Β± 1%
- Control loop: < 1ms worst case
- Interrupt latency: < 10ΞΌs
Document test methodology and acceptance criteria.

# Power analysis test
@qa-firmware Create power consumption test suite:
- Active mode: < 15mA
- Sleep mode: < 50ΞΌA
- Wake-up time: < 5ms
Include automated power profiling script.

HIL Test Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     Test Host (PC)                          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚   pytest    β”‚  β”‚   Robot     β”‚  β”‚    Test Results     β”‚ β”‚
β”‚  β”‚   runner    β”‚  β”‚  Framework  β”‚  β”‚    & Reports        β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚         β”‚                β”‚                                  β”‚
β”‚         β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜                                  β”‚
β”‚                  β”‚                                          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β”‚ USB/Serial/Debug
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  β–Ό           Device Under Test (DUT)        β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚                    Firmware                          β”‚   β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚   β”‚
β”‚  β”‚  β”‚ Sensors  β”‚  β”‚ Comms    β”‚  β”‚  Test Harness    β”‚  β”‚   β”‚
β”‚  β”‚  β”‚ Drivers  β”‚  β”‚ Stack    β”‚  β”‚  (embedded)      β”‚  β”‚   β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                                                             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚   Logic     β”‚  β”‚   Power     β”‚  β”‚    Mock Hardware    β”‚ β”‚
β”‚  β”‚   Analyzer  β”‚  β”‚   Monitor   β”‚  β”‚    (optional)       β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
πŸ“‹ CI Integration: HIL tests can run in CI with hardware emulators (Renode, QEMU) for fast feedback. Reserve real hardware tests for nightly builds or pre-release validation.

Test-First Development

Quality agents work best when engaged early. Here's how to integrate them into your development workflow:

Parallel Test Development

# When implementing a new feature, run tests in parallel
@work-orchestrator Coordinate feature implementation with tests:

Parallel Track A (Implementation):
  @backend-engineer: Implement order service
  @frontend-engineer: Build order form

Parallel Track B (Tests):
  @qa-backend: Write order service tests (based on spec)
  @qa-frontend: Write order form tests (based on spec)

Integration Point:
  Both tracks complete β†’ Run full test suite β†’ Fix any gaps

Test Coverage Strategy

# Define coverage requirements upfront
@qa-backend Review the order module and create test plan:

Coverage Requirements:
β”œβ”€β”€ Unit Tests
β”‚   β”œβ”€β”€ Business logic: 90%+
β”‚   β”œβ”€β”€ Utilities: 80%+
β”‚   └── Types/DTOs: skip (no logic)
β”‚
β”œβ”€β”€ Integration Tests
β”‚   β”œβ”€β”€ Database operations: all repositories
β”‚   β”œβ”€β”€ External APIs: all integrations
β”‚   └── Message queue: all publishers/consumers
β”‚
β”œβ”€β”€ API Tests
β”‚   β”œβ”€β”€ Happy paths: 100%
β”‚   β”œβ”€β”€ Error cases: all documented errors
β”‚   └── Edge cases: pagination, limits, auth
β”‚
└── Performance Tests
    β”œβ”€β”€ Baseline: establish current performance
    └── Regression: detect >10% slowdowns

Continuous Quality Checks

# CI pipeline integration
name: Quality Gates

on: [push, pull_request]

jobs:
  unit-tests:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm ci
      - run: npm run test:unit -- --coverage
      - run: npx coverage-check --lines 80

  integration-tests:
    runs-on: ubuntu-latest
    services:
      postgres:
        image: postgres:15
    steps:
      - uses: actions/checkout@v4
      - run: npm ci
      - run: npm run test:integration

  e2e-tests:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm ci
      - run: npx playwright install
      - run: npm run test:e2e

  accessibility:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm ci
      - run: npm run test:a11y
πŸ’‘ Pro Tip: Run quality agents with the same spec given to engineering agents. This ensures tests match implementation intent and catches spec ambiguities early.

Common Testing Patterns

Pattern: Contract Testing

# Ensure API contracts between services
@qa-backend Create contract tests for the order-to-payment integration:
- Define expected request/response schemas
- Generate consumer contract
- Verify provider satisfies contract
Use Pact or similar contract testing tool.

Pattern: Chaos Testing

# Test system resilience
@qa-backend Create chaos tests for the order service:
- Database connection failures
- External payment service timeouts
- Message queue unavailability
Verify graceful degradation and recovery.

Pattern: Mutation Testing

# Verify test quality
@qa-backend Run mutation testing on the pricing module:
- Use Stryker or similar mutation framework
- Target: 80% mutation score
- Identify weak tests that don't catch bugs