Skip to content
Skills Library
Programming · Testing

testing-patterns

/testing-patterns

pytest with moto, Jest/Vitest with React Testing Library, Playwright E2E patterns. Use when writing or reviewing tests, setting up test infrastructure, or debugging test failures.

Repository
kiro-config ↗
Licence
Apache-2.0
Last repository change
26.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 26.10.2026, without references to retired models or APIs.

Licence

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

What it does and when to use it

pytest with moto, Jest/Vitest with React Testing Library, Playwright E2E patterns. Use when writing or reviewing tests, setting up test infrastructure, or debugging test failures.

Original author description

pytest with moto, Jest/Vitest with React Testing Library, Playwright E2E patterns. Use when writing or reviewing tests, setting up test infrastructure, or debugging test failures.

How it works

  1. Python Lambda Test (pytest + moto)
  2. React Component Test (Vitest + RTL)
  3. Coverage Commands
  4. Playwright Quick Reference
Original SKILL.md headings · 69 lines, 244 words
SKILL.md preview
---
name: testing-patterns
description: pytest with moto, Jest/Vitest with React Testing Library, Playwright E2E patterns. Use when writing or reviewing tests, setting up test infrastructure, or debugging test failures.
---

# Testing Patterns

## Python Lambda Test (pytest + moto)

```python
import pytest
from moto import mock_aws
import boto3, os

@pytest.fixture
def dynamodb_table():
    with mock_aws():
        os.environ["TABLE_NAME"] = "test-table"
        client = boto3.client("dynamodb", region_name="us-east-1")
        client.create_table(
            TableName="test-table",
            KeySchema=[{"AttributeName": "PK", "KeyType": "HASH"}, {"AttributeName": "SK", "KeyType": "RANGE"}],
            AttributeDefinitions=[{"AttributeName": "PK", "AttributeType": "S"}, {"AttributeName": "SK", "AttributeType": "S"}],
            BillingMode="PAY_PER_REQUEST",
        )
        yield client

def test_handler_success(dynamodb_table):
    from my_function import lambda_handler
    result = lambda_handler({"body": '{"name": "test"}'}, MockContext())
    assert result["statusCode"] == 200

def test_handler_validation_error(dynamodb_table):
    from my_function import lambda_handler
    result = lambda_handler({"body": '{}'}, MockContext())
    assert result["statusCode"] == 400
```

## React Component Test (Vitest + RTL)

```tsx
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { axe } from 'jest-axe';

test('submits form with valid data', async () => {
  const onSubmit = vi.fn();
  render(<InvoiceForm onSubmit={onSubmit} />);
  await userEvent.type(screen.getByLabelText('Amount'), '100');
  await userEvent.click(screen.getByRole('button', { name: 'Submit' }));
  expect(onSubmit).toHaveBeenCalledWith(expect.objectContaining({ amount: 100 }));
});

test('has no accessibility violations', async () => {
  const { container } = render(<InvoiceForm />);
  expect(await axe(container)).toHaveNoViolations();
});
```

## Coverage Commands

- Python: `pytest --cov --cov-report=term-missing --cov-fail-under=90`
- React: `npx vitest --coverage`
- Playwright: `npx playwright test` with `playwright-coverage` or `monocart-coverage-reports`
- Target: 100%. Never settle below 90%.

## Playwright Quick Reference

- Selectors: `page.getByTestId("...")` (uses `data-testid` attribute) — never class/id/tag
- Auth: `storageState` set up once in a setup project, never a UI login flow per test (see `development-quality-gates.md` → "Playwright E2E Standards")
- Waiting: `page.waitForResponse()` / `page.route()` to intercept and wait on network calls, never `page.waitForTimeout(ms)`
- Structure: `tests/e2e/*.spec.ts`, `tests/e2e/pages/*.ts`

Versions

RepositoryScoreLicence
This page · seandkendall/kiro-config100Apache-2.0
Reprograme/redevkit100MIT
piomin/claude-ai-spring-boot100Apache-2.0
FrancoStino/opencode-skills-collection100MIT
rootcastleco/rei-skills100MIT
davila7/claude-code-templates100MIT
svngoku/coding-agents-skills100MIT
organvm-iv-taxis/a-i--skills100Apache-2.0
leather-io/mono100MIT

Database snapshot: 13.11.2026 · package version da6a71b20543 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100react-testing
    Test React components with RTL and Jest/Vitest. Use when writing React component tests with React Testing Library, Jest, or Vitest.
  • 100react-testing
    React component testing patterns including components, hooks, context, and forms. Covers Vitest Browser Mode with vitest-browser-react and @testing-library/react. Use when testing React applications. For general UI testing patterns, see the front-end-testing skill.
  • 90js-testing-patterns
    Use when writing or reviewing JavaScript/TypeScript tests - Jest/Vitest assertions, React Testing Library queries, module mocking, async patterns, and snapshot discipline.
  • 100testing-react
    Writes React/TypeScript tests using Vitest and React Testing Library. Use when "write react tests", "vitest", "component test", "hook test", "RTL", "testing library", "snapshot test", or testing React components, hooks, and utilities.
  • 100nextjs-testing
    Write Jest or Vitest unit tests with React Testing Library and Playwright E2E tests for Next.js projects. Use when testing components with RTL, mocking APIs with MSW, or creating Playwright user flow tests.
  • 100testing
    Unit, integration, E2E, load, and a11y tests: pytest, vitest/jest, Playwright, fixtures, mocks, coverage. Use for adding tests or fixing flaky suites.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.