Skip to main content

Run hurl test files in dependency order using frontmatter metadata

Project description

Hurl Orchestrator

A dependency-aware task runner for Hurl. It allows you to treat API requests as a Directed Acyclic Graph (DAG), managing complex authentication flows and resource creation without redundant executions or manual variable passing.

Core Philosophy

  • Explicit over Implicit: Every dependency must be declared. This ensures that if a test fails, you know exactly which parent requirement was not met.
  • Namespaced Variables: Outputs are tied to the ID of the node that produced them (auth_token), preventing variable collisions in large suites.
  • Reusable Logic: Run the same Hurl file multiple times with different identities (e.g., admin_login vs user_login) using the alias syntax.

1. Setup

Requirements

  • Python 3.11+
  • Hurl installed and available on your PATH

Install

pip install hurl-orchestra

Project Structure

Place your .hurl files in a directory. You can optionally include a .env file for global variables.

tests/
├── .env                # Global variables (base_url, etc.)
├── auth.hurl           # Reusable auth logic
└── create_user.hurl    # Depends on auth

2. Defining Hurl Files

Each .hurl file uses YAML frontmatter to define its place in the graph.

The Producer (auth.hurl)

Define an id and a list of outputs you want to share with other tests.

---
id: auth
outputs: [token]
---
POST https://api.com/login
[Captures]
token: jsonpath "$.token"
HTTP 200

The Consumer (profile.hurl)

List the id of the producer in deps. Access the variable using the {id}_{variable} syntax.

---
id: get_profile
deps: [auth]
---
GET https://api.com/profile
Authorization: Bearer {{auth_token}}
HTTP 200

3. Running

hurl-orchestra                          # runs against the current directory
hurl-orchestra ./tests                  # runs against a specific directory
hurl-orchestra auth.hurl profile.hurl   # run specific files only

Passing Hurl Flags

Any flag that Hurl itself accepts can be passed directly and it will be forwarded to every invocation:

hurl-orchestra ./tests --verbose
hurl-orchestra ./tests --variable host=localhost --retry 3
hurl-orchestra auth.hurl profile.hurl --variable env=staging

This works the same as calling hurl with those flags — the orchestrator passes them through verbatim.

Running Specific Files

When you pass .hurl files directly, the orchestrator still respects their deps, outputs, and all other frontmatter — only the file discovery step changes. Files you list are the only ones loaded as templates, so any deps they declare must also be among the files you pass.

# Runs auth.hurl first (because profile.hurl depends on it), then profile.hurl
hurl-orchestra auth.hurl profile.hurl

Reports

After every run, the orchestrator writes a zip archive containing the raw hurl JSON reports for every node that executed. Each node gets its own subdirectory inside the zip, named after its ID.

report.zip
├── auth/
│   ├── report.json
│   └── store/
└── create_user/
    ├── report.json
    └── store/

The zip is written even if the run fails, so partial results are preserved for debugging. Use --report-zip to change the output filename:

hurl-orchestra ./tests --report-zip ci-run.zip

4. Advanced Features

Rerunning Dependencies (Aliasing)

If you need to run the same logic twice (e.g., to get two different tokens), use the template: alias syntax in your deps.

---
id: admin_test
deps:
  - auth: admin_login  # Runs auth.hurl as "admin_login"
  - auth: user_login   # Runs auth.hurl as "user_login"
---
GET /admin
Authorization: {{admin_login_token}}

Execution Priority

By default, nodes at the same dependency level run in an unspecified order. Use priority to control that order without adding artificial dependencies.

Value Effect
positive (e.g. 2) runs earlier than nodes with lower or no priority
0 (default) neutral
negative (e.g. -1) runs later than neutral nodes

Example: you have a create, a search, and a delete that are all independent. Without priority they could run in any order — if delete runs first it breaks search.

---
id: create
priority: 1   # runs first
---
---
id: search
# priority defaults to 0
---
---
id: delete
priority: -1  # runs last
---

Priority only affects ordering within the same wave. It never overrides actual deps — a node always waits for its dependencies regardless of its priority value.

Global Environment (.env)

The orchestrator automatically detects a .env file in the test directory. Variables defined here are available to all Hurl files without being declared in the frontmatter.

# .env
base_url=https://staging.api.com

5. Execution Flow

When you run hurl-orchestra, the tool performs the following steps:

  1. Discovery: Scans for all .hurl files and reads their metadata.
  2. Graph Construction: Builds an execution map. If you used an alias, it "clones" that template into a unique node.
  3. Validation: Ensures there are no circular dependencies (e.g., A depends on B, and B depends on A).
  4. Execution:
    • Processes nodes wave by wave — each wave contains all nodes whose dependencies are satisfied.
    • Within each wave, nodes are sorted by priority (highest first).
    • Captures output variables into a shared pool.
    • Injects required variables into downstream tests via Hurl's --variable flag.
    • Stops immediately if any test fails to prevent cascade failures.

6. Troubleshooting

"Circular dependency detected"

Your deps create an infinite loop. Check your frontmatter to ensure you aren't accidentally requiring a file that eventually requires the current file.

"FAILED: node_id"

The orchestrator will output the stderr from the Hurl binary. This usually means an assertion failed within the .hurl file itself or a network error occurred.

"Node depends on missing node"

Ensure the id in your deps matches the id defined in the target Hurl file's frontmatter (or its filename stem if no id is provided).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hurl_orchestra-0.4.1.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hurl_orchestra-0.4.1-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file hurl_orchestra-0.4.1.tar.gz.

File metadata

  • Download URL: hurl_orchestra-0.4.1.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for hurl_orchestra-0.4.1.tar.gz
Algorithm Hash digest
SHA256 4a5ba66a6a4c9eb93f0728c894d7fb81cc1d2ba252316d622e8ceb805160d576
MD5 1125d36a092a748a395ec830217670aa
BLAKE2b-256 31dbcbfbe17b4a934d7b508dbd0f4d04c0e7fc106dcd6381f1a8c1efca47d2f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for hurl_orchestra-0.4.1.tar.gz:

Publisher: publish.yml on klaygomes/hurl-orchestra

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hurl_orchestra-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: hurl_orchestra-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for hurl_orchestra-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4abf433c4ae048dd01078cf0156d25a21cc057f14592573e3d14452e86e7f8c5
MD5 1a21ab98903c28e41ec156dc69626688
BLAKE2b-256 3b44bceeea467e9d3fae1fb243206e09e6a67cd9488cc5ccad1ee6e33f7daa20

See more details on using hashes here.

Provenance

The following attestation bundles were made for hurl_orchestra-0.4.1-py3-none-any.whl:

Publisher: publish.yml on klaygomes/hurl-orchestra

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page