Pre-release. Parity is not publicly available yet: the CLI, the GitHub Action and the hosted workspace open at launch. The demo runs on example data.

Skip to content

Quickstart

Compare two versions of the Shop API example, read the result, find the seeded regression and open the HTML report — in about five minutes.

This walk-through uses the Shop API example that ships in the repository: one small Node.js service that can start as a baseline or as a candidate with deliberately seeded differences. You will run both, compare them, and read what Parity reports.

You need a Rust toolchain (to build the CLI), Node.js 22 or newer (to run the example service), and three terminals.

#1. Build the CLI

There are no prebuilt binaries yet, so build from source:

bash
git clone https://github.com/x1991labs/parity && cd parity
cargo install --path crates/parity-cli

Check that it is on your PATH:

bash
parity --version
parity 0.1.0

See Installation if parity is not found.

#2. Start the two versions

From the repository root, start the baseline in one terminal:

bash
node examples/shop-api/server.mjs --variant baseline --port 8080

and the candidate in another:

bash
node examples/shop-api/server.mjs --variant candidate --port 8081

The candidate prints the differences it was started with:

shop-api (candidate) listening on http://127.0.0.1:8081
  seeded differences: price_as_string, cancel_returns_200, omit_null_phone, accept_zero_quantity, float_tax, duplicate_payments, discount_not_persisted, product_currency, random_ids

Both keep their state in memory. Restart them to get a clean slate.

#3. Check the configuration

The example has a ready-made parity.yaml. In a third terminal:

bash
cd examples/shop-api
parity validate
  ✓ configuration is valid
  ✓ openapi   openapi.yaml  82 scenarios
  ✓ workflow  tests/parity  5 scenarios
  ✓ request   tests/requests.yaml  2 scenarios

  89 scenarios selected (60 mutating) · seed 42 · sha256:ebc8d505a4c8

validate sends no requests. It parses the configuration, generates scenarios from the OpenAPI document, loads the workflows and the manual requests, and tells you how many scenarios a run will execute.

#4. Compare

bash
parity compare

Parity sends every scenario to both servers and prints one block per scenario that did not come out unchanged. This is the real output, with eleven of the fourteen changed scenarios cut for length:

  baseline   http://localhost:8080
  candidate  http://localhost:8081
  scenarios  89 from 3 sources · seed 42 · concurrency 8

  ✗ GET /products/{sku} · valid request  openapi · 2ms
      ~ `$.price` changed type from number to string (39.99 → "39.99").
      + `$.currency` was added ("EUR").

  ✗ Invoice totals  workflow · 2 steps · 2ms
      step 2 · Read the invoice · GET /orders/ord_1010/invoice
      ~ `$.tax` changed from 27.7 to 27.70008403361345 (Δ +0.00008403361345088).

  ✗ Order lifecycle with discount  workflow · 4 steps · 3ms
      step 4 · Retrieve the order · GET /orders/ord_1014
      ~ `$.discount` changed from {"code":"WELCOME10","percent":10} to null.
      ~ `$.total` changed from 57.59 to 63.99 (Δ +6.4).
      ~ Assertion `$.discount.code equals "WELCOME10"` holds in the baseline but fails in the candidate.

  ? GET /health · valid request
      Every difference also appears between two runs of the baseline, so it cannot be attributed to
      the candidate. Add ignore rules for: $.uptime_ms.

  89 scenarios  ·  73 unchanged  ·  14 changed  ·  2 inconclusive
  42 differences · 209 requests · 0.0s · seed 42

  ✗ Behaviour changed in 14 of 89 scenarios
    policy: 14 scenarios with behavioural changes → exit 1
    warning: 2 scenarios were inconclusive

  report   .parity/report.json
  view     parity report --open

The process exits with code 1 because behaviour changed and the policy for unexpected changes is fail.

Identifiers such as ord_1014 depend on what the baseline server has already created, and a second run against the same server processes can count slightly differently (a customer e-mail that was free the first time is taken the second time). Restart both servers to reproduce these numbers exactly.

#5. Read the output

  • ✗ marks a scenario whose behaviour changed. Under it, ~ is a changed value, + an addition and - a removal, each with its JSONPath.
  • ? marks an inconclusive scenario: Parity could not attribute the difference to the candidate. GET /health returns an uptime counter that differs on every call, in both versions; Parity noticed by calling the baseline twice.
  • ! would mark an environment error (a server that could not be reached). There are none here.

The three outcomes and every reason code are described in Comparison rules.

#6. Find the seeded regression

Look at Order lifecycle with discount. The workflow (tests/parity/order-lifecycle.yaml) creates a customer and an order, applies a discount code and reads the order back. These are its last three steps:

yaml
steps:
  - id: create_order
    name: Create an order for that customer
    request:
      method: POST
      path: /orders
      body:
        customer_id: "{{customer_id}}"
        items:
          - { sku: BOOK-001, quantity: 1 }
          - { sku: GAME-001, quantity: 1 }
    extract:
      order_id: $.id
    expect: { status: 201 }

  - id: apply_discount
    name: Apply a discount
    request:
      method: POST
      path: /orders/{{order_id}}/discount
      body: { code: WELCOME10 }
    expect: { status: 200 }

  - id: read_order
    name: Retrieve the order
    request: GET /orders/{{order_id}}
    assert:
      - path: $.discount.code
        equals: WELCOME10

Steps 1 to 3 are not in the output: both versions answered them identically. The candidate even answers the discount request with the same 200 and the same body — it just never saves the discount. Only step 4, the read-back, shows that the two versions ended up in different states.

Two things made that visible:

  • Each environment has its own order_id. The baseline's ord_1014 was never sent to the candidate, and the two different IDs were not reported as a difference.
  • The workflow reads state back after its last mutation. A test that stopped at step 3 would have passed.

#7. Open the report

compare wrote a JSON report to .parity/report.json. Turn it into a self-contained HTML page and open it:

bash
parity report --open
  html .parity/report.html

The HTML file has no external dependencies; you can attach it to a pull request or send it to a colleague.

#Next

    Loading the index…