# SlopKit Hunt

## Test the product you actually deployed

Write what a user does as plain Scenarios, run them against your staging or production site, and see every screen they reach in one map. When the product allows it, Hunt also stubs the payment provider and jumps the clock past a trial, so the cases that are hard to reach become Scenarios too.

[Run your first Scenario](https://hunt.slopkit.dev/start/). Commands and the Step API are in the [docs](https://hunt.slopkit.dev/docs/). Hunt is early. It runs on your machine and in your CI. The code is in the [product repo](https://gitlab.techtailors.net/slopkit/hunt). Part of [SlopKit](https://slopkit.dev).

## What a team gets

- **Scenarios you can read.** Scenarios in `.feature` files, written as Given, When and Then lines, with Steps in TypeScript that run on Node, Bun or Deno.
- **The real, running product.** Runs against a deployed product: a browser, HTTP calls and read-only database checks.
- **A Baseline you review.** Screenshots and data kept as files you commit, so a change to how the product looks is a diff in a merge request.
- **An Experience Map.** For product and design: the screens users can reach, their states and the paths between them, built from recorded runs.
- **Room to grow in CI.** Parallel Workers, Cucumber Messages output and a GitLab CI component for a smoke set and a nightly full run.

## Words used here

Scenario
: A named, saved example of one behavior, written as Given, When and Then lines.

Step
: One reusable Given, When or Then line, backed by a browser or HTTP action or an assertion.

Step Host
: The process, in the JavaScript runtime you choose, where your Step definitions run.

Environment
: A deployed instance of the product under test, such as staging or production. You provision it. Hunt does not.

Observed Environment
: One Hunt can only reach from the outside, through a browser and HTTP.

Controlled Environment
: One that cooperates, so Scenarios can also use Stubs and Clock Shifts.

Stub
: A stand-in for a third-party service such as payments, email, SMS or OAuth. A Scenario registers it for that Scenario only.

Clock Shift
: A forward jump or freeze of the time seen by the whole Controlled Environment. It holds the Environment until it is reset, so a Scenario that uses it is tagged `@controlled` and runs alone.

Screen
: A named place in the product that a Step says it has reached. Screens are the nodes of the Experience Map.

Snapshot
: A recorded value that later runs must match: a Screen's screenshot, or data a Step asked to capture.

Baseline
: All of a product's Snapshots as committed on its main branch. A change to it is accepted by approving and merging the merge request that changes it.

Experience Map
: A browsable atlas of the product's user-facing journeys, compared against the Baseline.

Exploration
: An unsaved run of inline Steps, put together by an agent or a person during a working session. It never changes the Baseline and can be promoted into a Scenario.

Mapping Run
: A dedicated run that records which code each Step touched, so a code change can be traced to the Scenarios and Screens it affects.

## Why Hunt instead of a hosted browser-testing service

You can test cases a hosted browser can only watch from outside
: In a Controlled Environment a Scenario can register a Stub for the payment provider and shift the clock. The Stub and the shift end with the Scenario. In an Observed Environment you still get the browser, HTTP and read-only data checks.

The Baseline is files, not a vendor account
: Snapshots live in your repository in the Jest `__snapshots__` format. Hunt writes a new Snapshot the first time it sees one. After that a mismatch fails the run until someone accepts the update, and the update is reviewed in a merge request.

An agent can try a Step before you commit it
: `hunt explore` runs inline Steps against your real Step definitions and records nothing. When the Steps work, an Exploration can be promoted into a Scenario.

## Why Hunt instead of assembling your own runner

Clock Shifts, Stubs and code mapping come from sibling SlopKit products that Hunt drives from the same Step context, so you do not glue them together yourself. Hunt does not reimplement them.

- [Jetlag](https://jetlag.slopkit.dev) applies Clock Shifts to running processes. It is Hunt's main Clock Driver. A product can also supply its own time-setting Step as a Clock Driver.
- [Decoy](https://decoy.slopkit.dev) intercepts a process's DNS and HTTP(S) traffic and answers it from rules registered at runtime. Hunt's Stubs are Decoy rules.
- [Stalker](https://stalker.slopkit.dev) collects traces, logs, metrics, profiles and per-request function coverage from running software without instrumentation code, and sends them to [rat](https://rat.slopkit.dev) for storage. Hunt reads that data during Mapping Runs.

## A Scenario run, end to end

1. You tag a Scenario `@controlled` and write Steps that sign up, shift the clock past a trial, and upgrade with a declined card and then an accepted one.
2. Hunt runs it through your Step Host. Every Step sends trace context with the run, Scenario and Step ids.
3. Steps declare Screens. Hunt takes the screenshot Snapshots and compares them with the Baseline.
4. When the Scenario ends, Hunt removes its Stubs and resets the clock.

## Where to go next

- [Run your first Scenario](https://hunt.slopkit.dev/start/): build `hunt` from the 0.1.0 tag, write a Scenario and run it.
- [Docs](https://hunt.slopkit.dev/docs/): commands, `hunt.toml`, the Step API and the glossary.
- [Product repo](https://gitlab.techtailors.net/slopkit/hunt): source, decisions and issues.

Hunt 0.1.0 is published as a Linux binary and as the npm SDK `@slopkit/hunt`. The repo README lists both. Getting started builds from source with Nix.

## Limits today

- Without a `[server]` in `hunt.toml`, a changed screenshot whose Baseline image is not on this machine is reported as unverified and does not fail.
- One Browser Adapter (agent-browser) and one kind of Data Source (Postgres). A Clock Shift does not move the browser's clock.
- Jetlag, Decoy and Stalker have no published release yet. Their Kubernetes, Docker and kernel Sensor paths are not yet verified on real infrastructure.
- Function-level coverage in a Mapping Run works on Node and Rust. Bun has per-file coverage only.
- Native mobile apps, security testing and contract testing between a product's own services are out of scope.

## Check

- Getting started: https://hunt.slopkit.dev/start/
- Docs: https://hunt.slopkit.dev/docs/
- Product repo: https://gitlab.techtailors.net/slopkit/hunt
- SlopKit: https://slopkit.dev
- Site map: https://hunt.slopkit.dev/llms.txt
