# Rjv Test Types

Choose and write the test type that proves a change—end-to-end flow, property test, or differential test—so an agent cannot fool it. Use when selecting or writing tests for a feature, invariant, or rewrite/migration.

**Canonical URL:** https://skillshunter.net/skills/discovered-fbbcf5cb9fa51a0d9261db19b3b39eaf9f6e664fb6ec2cc8

**JSON URL:** https://skillshunter.net/api/public/v1/skills/discovered-fbbcf5cb9fa51a0d9261db19b3b39eaf9f6e664fb6ec2cc8

**Markdown URL:** https://skillshunter.net/skills/discovered-fbbcf5cb9fa51a0d9261db19b3b39eaf9f6e664fb6ec2cc8.md

**Instructions download URL:** https://skillshunter.net/skills/discovered-fbbcf5cb9fa51a0d9261db19b3b39eaf9f6e664fb6ec2cc8/download

**Category:** Software & Development

**Source URL:** https://github.com/rjvim/ai-skills/blob/9a942086adef21dbd0c061d9d9e8fd5f43328bf6/skills/rjv-test-types/SKILL.md

**Source commit:** 9a942086adef21dbd0c061d9d9e8fd5f43328bf6

**Listing approved at:** 2026-12-03

**Created at:** 2026-12-02T09:10:06.000000Z

**Updated at:** 2026-12-03T16:19:55.000000Z

## Catalog information

The following descriptions are catalog information. Listing approval does not mean the skill has been tested or is safe for every environment.

### Editor's note

Before writing tests, drive the running app through the repo's `verify` skill (`rjv-verify-skill`), a browser, a simulator, or an API harness. Ensure inputs come from a generator or a sample of real traffic, never hand-picked.

### When to use it

- Selecting the appropriate test type for a feature or invariant
- Writing end-to-end tests for user flows or API interactions
- Implementing property tests for invariants like money rules or parsing logic
- Running differential tests during rewrites, migrations, or framework swaps

## Skill instructions

---
name: rjv-test-types
description: "How-to: choose and write the test type that proves a change—end-to-end flow, property test or differential test—so an agent cannot fool it. Use when choosing or writing tests for a feature, invariant (money, balances, parsing, retries) or rewrite/migration. Verification phases live in rjv-verify; criterion mapping in rjv-spec-driven."
---

# Test types that keep agents honest

A test the agent wrote with the same blind spots as its code proves
little. Pick the type whose inputs or oracle the agent did not choose.

## Pick the type

```text
Does a user or caller go through a flow (pages, API calls, a job)?
├── Yes → end-to-end test, always
└── No
    Is there a rule that must hold for every input?
    ├── Yes → property test
    └── No
        Is an old system doing the same job?
        ├── Yes → differential test
        └── No → unit test on the public function, real inputs
```

More than one branch can apply. A money feature usually gets an
end-to-end flow and a property test for its invariant.

## End-to-end

Pick this first when you can only afford one type. Either the whole
feature works or it does not, and a failure shows what broke.

- Drive the running app through the repo's `verify` skill
  (`rjv-verify-skill`), a browser, a simulator or an API harness.
- Assert on what the user sees or the caller receives, never on
  internal calls.
- Use the repo's feature map as the rubric: each flow with its path,
  selectors and expected result.

## Property

Write a statement that must never fail and let a library generate
thousands of inputs against it: fast-check (JS/TS), Hypothesis
(Python), proptest (Rust), PHP's Eris or a seeded loop.

| Property | Example |
|---|---|
| round trip | decode(encode(x)) equals x; parse(format(x)) equals x |
| invariant | a balance never goes negative; units times NAV equals amount, within rounding |
| idempotency | running a migration, retry or webhook twice equals running it once |
| equivalence | the optimised function equals the naive one |

Use it for every money rule and every parser. It is also the proof to
use when a spec has drifted from production behaviour.

## Differential

Run the old and new system on the same inputs and compare. Use it for
rewrites, migrations and framework swaps that must not change
behaviour.

- Inputs come from a generator or a sample of real traffic, never
  hand-picked.
- Normalise what does not matter: whitespace, key order, timestamps,
  generated IDs.
- Keep an approved-differences list, one line per difference with its
  reason. Any other difference is a bug.

## Failure modes

- **Flaky** tests teach agents to rerun instead of fix. Root-cause or
  delete (`rjv-verify` phase 3).
- **Slow** tests get run less often, so a failure cannot be traced to
  one change. Keep the per-edit set under a minute; heavy suites run
  once before the commit.

Done when each promised behaviour has a test of the type the tree
picked, and the test fails when the behaviour is broken.

