flow-test-engine
v2.0.1
Published
A comprehensive API testing engine with directory-based execution, global variables, and priority-driven test management.
Maintainers
Readme
Flow Test Engine
A TypeScript-based API testing engine for writing rich, declarative flows in YAML. It supports request chaining, variable interpolation, flexible assertions, conditional scenarios, and clean reports in JSON and HTML.
Flow Test Engine is a language-agnostic runner for API suites written in YAML. You can bolt it onto any repository—regardless of the tech stack—to manage HTTP flows, capture variables, and publish reports.
1. Requirements
- Node.js 16 or newer (runtime used by Flow Test Engine)
- npm 8 or newer (ships with Node.js)
- Docker Desktop (optional, only if you want the bundled httpbin mock server)
📌 Install Node.js even if your application is written in another language—Flow Test Engine runs beside your project and never touches your runtime code.
2. Quick Start with npx (no install required)
Use npx to try the engine without adding dependencies:
# Initialise configuration and sample suites in the current directory
npx --yes flow-test-engine init
# or using the short form:
npx --yes fest init
# Execute all discovered suites using the generated config
npx --yes flow-test-engine --config flow-test.config.yml
# or using the short form:
npx --yes fest --config flow-test.config.ymlThe wizard creates:
flow-test.config.ymlwith discovery rules, retries, and reporting options.tests/containing starter YAML suites you can edit or replace.results/where execution artifacts are stored (results/latest.json).
3. Make Flow Test Part of Your Repository
For long-term use, keep Flow Test assets in their own workspace so teammates and CI can run them consistently.
mkdir flow-tests
cd flow-tests
npm init -y
npm install --save-dev flow-test-engine
npx flow-test-engine init
# or using the short form:
npx fest initThis produces a flow-tests/package.json similar to:
{
"name": "flow-tests",
"private": true,
"scripts": {
"flow-test": "fest --config flow-test.config.yml",
"flow-test:verbose": "fest --config flow-test.config.yml --verbose"
},
"devDependencies": {
"flow-test-engine": "^1.0.2"
}
}A minimal suite (flow-tests/tests/my-first-test.yaml) might look like:
suite_name: "Payment API Smoke"
base_url: "https://sandbox.my-api.com"
auth:
type: "bearer"
token: "{{$env.API_TOKEN}}"
steps:
- name: "Get payment"
request:
method: "GET"
url: "/payments/{{payment_id}}"
assert:
status_code: 200
body:
id: { equals: "{{payment_id}}" }
status: { in: ["CREATED", "CONFIRMED"] }Run it from anywhere in your repo:
npm --prefix flow-tests run flow-test
# or, with npx
npx --yes --package flow-test-engine flow-test-engine --config flow-tests/flow-test.config.yml
# or using the short form:
npx --yes --package flow-test-engine fest --config flow-tests/flow-test.config.ymlCross-suite step calls (call)
Need to reuse an existing step that already lives in another YAML suite? Add a call block to the step instead of duplicating the HTTP definition:
steps:
- name: "Seed reusable user"
call:
test: "../shared/setup-user.yaml" # always relative to the current file
step: "create-user" # matches step_id or name from the target suite
variables:
role: "admin" # optional values injected into the called step
isolate_context: true # default; restore local variables after the call
on_error: "warn" # fail | warn | continue (continue marks the step as skipped)- Paths are sandboxed to the configured
test_directory; absolute paths or..escapes are rejected. isolate_contextdefaults totrue. When enabled, captured variables from the remote suite are returned with thenode_id.variablenamespace so you can safely consume them without leaking the called suite's runtime state.- Set
isolate_context: falseif you want the called step to mutate the current variable scope in place. callsteps cannot definerequest,iterate,inputorscenarios—they delegate entirely to the target step.- Recursive chains are blocked (max depth
10) so you get a friendly error instead of an infinite loop.
4. Everyday CLI Patterns
fest --dry-run --detailed # Discover tests and show plan
fest --suite auth,checkout # Run specific suites
fest --priority critical,high # Focus on high-impact scenarios
fest --tag smoke # Filter by YAML tags
fest --config ./flow-tests/staging.yml # Point to another config file
fest --report json,csv # Produce multiple report formats
fest graph mermaid --output discovery.mmd # Generate Mermaid discovery graph file
fest graph --direction LR --no-orphans # Print graph left-to-right skipping orphans
fest schema --format json # Export engine schema for IDE extensionsSchema Export for IDE Extensions
The Flow Test Engine exposes a complete schema catalog that IDE extensions can use to provide rich autocomplete, validation, and documentation:
# Export schema to file
fest schema --format json > flow-test-engine.schema.json
# Inspect specific structures
fest schema --format json | jq '.structures.TestSuite'
# View available examples
fest schema --format json | jq '.examples[].name'The schema includes:
- ✅ Complete structure definitions (TestSuite, TestStep, Assertions, etc.)
- ✅ All supported properties with types, descriptions, and examples
- ✅ Interpolation patterns (Faker, JavaScript, environment variables)
- ✅ Complete YAML examples categorized by complexity
- ✅ CLI documentation (commands, flags, usage)
For extension developers: See guides/12.schema-catalog-guide.md for detailed integration examples.
5. Integration Recipes by Ecosystem
The commands below assume you created the dedicated flow-tests/ workspace.
Node.js / TypeScript projects
- Install the engine next to your source:
npm install --save-dev flow-test-engine npx flow-test-engine init # or using the short form: npx fest init - Add scripts to
package.json:{ "scripts": { "flow-test": "fest --config flow-test.config.yml", "flow-test:ci": "fest --config flow-test.config.yml --report json" } } - Run locally or in CI:
npm run flow-test npm run flow-test:ci
PHP / Laravel (Composer)
- Keep Flow Test files under
flow-tests/as described earlier. - Reference that workspace from
composer.json:{ "scripts": { "flow-test": "npm --prefix flow-tests run flow-test", "flow-test:ci": "npm --prefix flow-tests run flow-test -- --report=json" } } - Execute with Composer:
composer run flow-test composer run flow-test:ci - In CI (GitHub Actions example):
- uses: actions/setup-node@v4 with: node-version: '18' - run: npm ci --prefix flow-tests - run: composer run flow-test:ci
Java / Spring (Maven)
- Ensure Node.js is available on the build agent.
- Add a Maven execution in
pom.xml:<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>3.1.0</version> <executions> <execution> <id>flow-tests</id> <phase>verify</phase> <goals><goal>exec</goal></goals> <configuration> <workingDirectory>${project.basedir}/flow-tests</workingDirectory> <executable>npx</executable> <arguments> <argument>fest</argument> <argument>--config</argument> <argument>flow-test.config.yml</argument> </arguments> </configuration> </execution> </executions> </plugin> - Run with Maven:
mvn verify
Python / Django
Add a Makefile (or extend an existing one) so everyone runs the same command:
# Makefile
flow-test:
@npm --prefix flow-tests run flow-test
flow-test-ci:
@npm --prefix flow-tests run flow-test -- --report=jsonUsage:
make flow-test
make flow-test-ciIn a tox.ini you can also add:
[testenv:flow-tests]
commands = npm --prefix {toxinidir}/flow-tests run flow-testDart / Flutter
Create tool/flow_test.dart to bridge into Node.js:
import 'dart:io';
Future<void> main() async {
final result = await Process.start(
'npx',
['--yes', 'fest', '--config', 'flow-tests/flow-test.config.yml'],
mode: ProcessStartMode.inheritStdio,
);
final exitCode = await result.exitCode;
if (exitCode != 0) {
exit(exitCode);
}
}Add a script to pubspec.yaml (if you use melos or simple make targets):
# pubspec.yaml
scripts:
flow-test: dart run tool/flow_test.dartRun:
dart run tool/flow_test.dart
# or with the scripts plugin
dart run flow-testPure Terminal / CI Pipelines
If your project has no build tool, keep it simple:
npm ci --prefix flow-tests # install once in CI
npm --prefix flow-tests run flow-test # execute suitesOr run ad hoc:
npx --yes flow-test-engine --config flow-tests/flow-test.config.yml
# or using the short form:
npx --yes fest --config flow-tests/flow-test.config.ymlIf you rely on Docker for dependent services, start them before running Flow Test. The sample docker-compose.yml in the Flow Test repository spins up httpbin:
docker compose up -d httpbin
npm --prefix flow-tests run flow-test
docker compose down -v6. Reporting and Dashboards
Every execution writes a JSON artifact at flow-tests/results/latest.json. When you need a shareable visualization, enable HTML output with the --html-output flag (optionally pass a subdirectory name) or by adding html to reporting.formats in flow-test.config.yml. The engine now emits a Postman-inspired HTML experience alongside the JSON, and the Astro dashboard packaged with this repository reads the same data, so keep it in sync before starting the UI.
- Copy (or symlink) the latest results into the dashboard data folder:
The dashboard looks for the browser-facing file atmkdir -p report-dashboard/src/data cp flow-tests/results/latest.json report-dashboard/src/data/latest.json # or keep it synced: ln -sf ../flow-tests/results/latest.json report-dashboard/src/data/latest.jsonreport-dashboard/src/data/latest.json, while server-side rendering also checks../results/latest.json. If neither is present it automatically readsreporting.output_dirfrom yourflow-test.config.*file to locate the latest report. Either path can be kept fresh in CI. - Launch the dashboard:
Opennpm install --prefix report-dashboard # first run only npm run --prefix report-dashboard devhttp://localhost:4321/flow-test/(Astro’s default port). The UI reloads automatically whensrc/data/latest.jsonchanges.- Prefer to serve it at the root path during local development? Run the command with
PUBLIC_BASE_URL=/ npm run --prefix report-dashboard devand openhttp://localhost:4321/instead.
- Prefer to serve it at the root path during local development? Run the command with
- Generate a static bundle when you need to publish the report:
The build lands innpm run --prefix report-dashboard buildreport-dashboard/dist/. Deploy that folder and ship the matchingsrc/data/latest.json(or automate a copy step) so the hosted dashboard can load the latest results.
Example CI step (GitHub Actions):
- run: npm ci --prefix flow-tests
- run: npm --prefix flow-tests run flow-test
- run: npm ci --prefix report-dashboard
- run: cp flow-tests/results/latest.json report-dashboard/src/data/latest.json
- run: npm run --prefix report-dashboard buildLicense
MIT – see package.json for details.
