From harness-claude
Guides test layer selection (unit/integration/E2E) via test trophy, prevents CI flakiness with deterministic design and retries, structures fast parallel runs. Use for new projects, flakiness, or coverage balancing.
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeThis skill uses the workspace's default tool permissions.
> Choose the right test layer (unit/integration/E2E) and prevent flaky tests in CI
Provides test automation strategies for unit, integration, and e2e tests; fixes flaky tests breaking CI/CD; enforces pyramid, determinism, and minimal mocks.
Provides language-agnostic test strategy guidelines: test pyramid (unit/integration/E2E), descriptive naming, mocking, flaky test policies. For writing tests, strategy design, coverage review.
Designs testing strategies, selects frameworks, and provides templates for unit, integration, and E2E tests in JS/TS (Vitest, Jest, Playwright), Python (pytest), and Go codebases.
Share bugs, ideas, or general feedback.
Choose the right test layer (unit/integration/E2E) and prevent flaky tests in CI
/ E2E \ — Few: critical user journeys
/ Integration \ — Many: service + database tests
/ Unit Tests \ — Some: pure logic, algorithms
/ Static Analysis \ — Always: TypeScript, ESLint
Choose the right layer:
Write E2E tests for critical paths only:
// Good E2E candidates:
// - User registration and login
// - Checkout and payment flow
// - Core feature happy path
// Bad E2E candidates:
// - Input validation (unit test)
// - API error handling (integration test)
// - Conditional rendering (component test)
// Bad: depends on timing
await page.click('#submit');
await new Promise((r) => setTimeout(r, 2000));
expect(page.getByText('Success')).toBeVisible();
// Good: waits for specific condition
await page.click('#submit');
await expect(page.getByText('Success')).toBeVisible({ timeout: 10000 });
test('user can update their profile', async ({ page }) => {
// Create unique test user — no shared state with other tests
const user = await createTestUser();
await loginAs(page, user);
// ... test continues
});
# .github/workflows/test.yml
jobs:
static:
steps: [typecheck, lint] # 30 seconds
unit:
steps: [vitest --run] # 1-2 minutes
integration:
steps: [vitest --config vitest.integration.ts] # 2-5 minutes
e2e:
steps: [playwright test] # 5-15 minutes
Handle flaky tests:
retries: 2 in CI configtest.fixme() or a tracking issueCoverage targets by layer:
A test strategy defines which behaviors are tested at which layer. The goal is maximum confidence with minimum execution time.
Test trophy vs test pyramid: The traditional test pyramid (many unit, few integration, fewer E2E) optimizes for speed but misses integration bugs. The test trophy (coined by Kent C. Dodds) prioritizes integration tests because they catch the most bugs per test.
Cost of flaky tests:
Common flakiness causes:
Flakiness detection:
--repeat=10 to find intermittent failures--bail=1 to stop at the first failure and investigateTrade-offs:
https://testing-library.com/docs/guiding-principles