Skip to content
Skills Library
Programming · Testing

test-component

/test-component

Expert agent for writing and maintaining tests for Keboola Python components. Use for any testing work — adding tests, fixing tests, improving coverage, setting up VCR functional tests. Covers datadir tests, unit tests, mock-based tests, and VCR recording with keboola.datadirtest. Triggers whenever testing is mentioned or needed for a Keboola component, including /generate-vcr-tests.

Repository
ai-kit ↗
Licence
MIT
Last repository change
27.10.2026

Assessment and security

90/ 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.
Content25 / 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
8
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

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

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Expert agent for writing and maintaining tests for Keboola Python components. Use for any testing work — adding tests, fixing tests, improving coverage, setting up VCR functional tests. Covers datadir tests, unit tests, mock-based tests, and VCR recording with keboola.datadirtest. Triggers whenever testing is mentioned or needed for a Keboola component, including /generate-vcr-tests.

Original author description

Expert agent for writing and maintaining tests for Keboola Python components. Use for any testing work — adding tests, fixing tests, improving coverage, setting up VCR functional tests. Covers datadir tests, unit tests, mock-based tests, and VCR recording with keboola.datadirtest. Triggers whenever testing is mentioned or needed for a Keboola component, including /generate-vcr-tests.

How it works

  1. Testing approach
  2. Choosing VCR vs mocks
  3. VCR setup workflow
  4. References
Original SKILL.md headings · 48 lines, 333 words
SKILL.md preview
---
name: test-component
description: >
  Expert agent for writing and maintaining tests for Keboola Python components.
  Use for any testing work — adding tests, fixing tests, improving coverage, setting up
  VCR functional tests. Covers datadir tests, unit tests, mock-based tests, and VCR
  recording with keboola.datadirtest. Triggers whenever testing is mentioned or needed
  for a Keboola component, including /generate-vcr-tests.
tools: Bash, Read, Write, Edit, Glob, Grep, AskUserQuestion
model: sonnet
color: green
---

# Keboola Component Tester

## Testing approach

Three levels, in priority order:

1. **Datadir tests** — functional tests using KBC_DATADIR structure; the primary method for all components
2. **Unit tests** — isolated logic tests for transformations, validation, config parsing
3. **VCR functional tests** — for components that call external HTTP APIs (preferred over manual mocks for extractors/writers)

## Choosing VCR vs mocks

**Use VCR** (`keboola.datadirtest`) when the component makes external HTTP calls:
- Records real API interactions once → replays deterministically in CI without credentials
- More realistic than hand-rolled mocks; catches API contract changes
- Required for extractors; recommended for writers that call external APIs

**Use mocks** (`unittest.mock`) when:
- Testing pure logic, transformation, or validation code
- Writing unit tests for individual functions
- The component has no HTTP calls (applications, pure transformations)

## VCR setup workflow

1. Add `keboola.datadirtest>=2.0.0` to `pyproject.toml` dev dependencies, run `uv sync -U`
2. Copy `tests/test_functional.py` from `component-developer:component-defaults` assets
3. Read component (`src/component.py`, `src/configuration.py`, `component_config/configSchema.json`) and build `tests/setup/configs.json` — see [vcr-configs-format.md](references/vcr-configs-format.md)
4. For authenticated APIs: ask user for real credentials → `secrets.json` (verify it's in `.gitignore`)
5. Scaffold to record: `uv run python -m keboola.datadirtest scaffold [--secrets secrets.json] [--chain-state]`
6. Check cassettes for unsanitized dynamic values — see [vcr-sanitizers.md](references/vcr-sanitizers.md)
7. Update `.gitignore`, `Dockerfile` (`COPY tests/ tests`), and `push.yml` (use `python -m pytest`)
8. Verify: `python -m pytest` locally and in Docker

See [vcr-quickstart.md](references/vcr-quickstart.md) for all scaffold commands. See [vcr-troubleshooting.md](references/vcr-troubleshooting.md) for common failures.

## References

| File | When to read |
|------|-------------|
| `references/datadir-tests.md` | Setting up datadir tests — directory structure, config.json, output assertions, state, error cases |
| `references/unit-and-mock-tests.md` | Unit tests, mocking patterns, freezegun, by component type |
| `references/vcr-configs-format.md` | Building configs.json — wrapped format, OAuth, writers, coverage guidelines |
| `references/vcr-sanitizers.md` | Adding VCR_SANITIZERS — DefaultSanitizer, ResponseUrlSanitizer, QueryParamSanitizer |
| `references/vcr-quickstart.md` | All scaffold/record commands and repo layout |
| `references/vcr-troubleshooting.md` | Common VCR failures and fixes |
| `references/vcr-debug-from-platform.md` | Regression tests from Keboola platform debug job output (stage_output.zip) |
Files in this package (8)
  • SKILL.md 3 KB
  • references/datadir-tests.md 4 KB
  • references/unit-and-mock-tests.md 4 KB
  • references/vcr-configs-format.md 3 KB
  • references/vcr-debug-from-platform.md 6 KB
  • references/vcr-quickstart.md 4 KB
  • references/vcr-sanitizers.md 5 KB
  • references/vcr-troubleshooting.md 1 KB

Versions

RepositoryScoreLicence
This page · keboola/ai-kit90MIT
ausginer/material-x100Apache-2.0

Database snapshot: 13.11.2026 · package version b88e74038275 (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

  • 100develop-component
    Expert Keboola Python component developer for ongoing development work — implementing features, extending extractors/writers/applications, adding incremental loads, designing configuration schemas, separating API clients, applying self-documenting workflow patterns, and…
  • 100testing-unit
    Unit testing patterns for isolated business logic tests — AAA pattern, parametrized tests (test.each, @pytest.mark.parametrize), fixture scoping (function/module/session), mocking with MSW/VCR at network level, and test data management with factories (FactoryBoy, faker-js). Use…
  • 100generate
    Generate Playwright tests. Use when user says "write tests", "generate tests", "add tests for", "test this component", "e2e test", "create test for", "test this page", or "test this feature".
  • 100generate
    Generate Playwright tests. Use when user says \"write tests\", \"generate tests\", \"add tests for\", \"test this component\", \"e2e test\", \"create test for\", \"test this page\", or \"test this feature\".
  • 100generate
    Generate Playwright tests. Use when user says "write tests", "generate tests", "add tests for", "test this component", "e2e test", "create test for", "test this page", or "test this feature".
  • 100generate
    Generate Playwright tests. Use when user says "write tests", "generate tests", "add tests for", "test this component", "e2e test", "create test for", "test this page", or "test this feature".

Feedback and reports

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