Skip to content
Back to skills

Write Tests

ASecurity

Write Heinzelmännchen tests at the right level - unit, integration or e2e, as defined in the coding standards (a public SDK's taxonomy). Use whenever adding or changing behaviour, or when asked to improve coverage.

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 6, 2026
developmentgotesting

Works with

  • cli

Security analysis

A100/100

Scanned November 6, 2026

npx -y skills add helmut-hoffer-von-ankershoffen/heinzel --skill write-tests --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Write Tests?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Write Tests
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/helmut-hoffer-von-ankershoffen-write-tests/badge)](https://www.skillsdirectory.com/skills/helmut-hoffer-von-ankershoffen-write-tests)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: write-tests
description: Write Heinzelmännchen tests at the right level - unit, integration or e2e, as defined in the coding standards (a public SDK's taxonomy). Use whenever adding or changing behaviour, or when asked to improve coverage.
---

# Write tests

## Pick the level

| If the test… | Marker |
| --- | --- |
| checks one class or function with collaborators faked, offline | `unit` |
| goes through several layers (CLI head → kernel → module → service), uses real files or subprocesses, offline | `integration` |
| installs Heinzelmännchen for real, uses the network or a real external service | `e2e` (set an explicit timeout) |

Set it once per file: `pytestmark = pytest.mark.unit`. The suite refuses tests with zero or several categories.

## Patterns

- Kernel with test modules: `make_kernel(builtins=True, example=module, example__sub=submodule)` (`__` → `.`);
  in plugins, `boot()` gives the kernel with the built-ins and every installed plugin.
- CLI: `CliRunner().invoke(build(kernel), ["example", "op", "--json"])`, then `json.loads(result.output)`.
- Services: construct directly, pass fakes as constructor arguments (e.g. `runner=` for subprocesses).
- Files: `tmp_path`; environment: `monkeypatch.setenv`. The `heinzel.testing` pytest plugin isolates
  `HZ_CONFIG_HOME`, `HZ_DATA_DIR` and `HZ_CACHE_DIR` and gives each test its level's timeout; never touch the real
  user configuration.

## Verification

- [ ] The test fails if you break the behaviour (try it once)
- [ ] `make test` passes with coverage ≥ 90 %
- [ ] Name states the behaviour; one behaviour per test

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.