Skip to content

atrahasisdev/github-action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Atrahasis CI

Run Atrahasis API tests, flows, and load tests inside any GitHub Actions workflow.

This action is a thin wrapper around the atra CLI. It runs your command through npx --yes @atrahasis/cli, so nothing is installed on the runner and there is no license key to configure. The CLI, its flow runner, and its load testing are free.

Whatever atra returns, the action returns. Exit code 0 passes, 1 fails, so your assertions gate the pipeline.

atra does three things, and this action exposes all three through a single args input:

  1. A terminal API client. Send requests from the shell with request tracing, assertions, and random data generation built in.
  2. A flow runner. Run the multi step flows you designed in the Atrahasis desktop app, unchanged.
  3. A load tester. Run the load specs you built in the app, with real traffic shapes and thresholds.

Quick start

- name: API health check
  uses: atrahasisdev/action@v1
  with:
    args: GET https://api.example.com -a "status eq 200" -a "response_time lt 2000"

The args input is passed to atra verbatim. Anything you can type after atra on your machine works here.

Inputs

Input Required Default Description
args yes Arguments passed verbatim to atra.
working-directory no . Directory to run atra in. Point it at the checked-out folder that holds your flow or spec groups.

The three ways to use atra

1. Single request

Send one request and assert on the result. No files needed.

- uses: atrahasisdev/action@v1
  with:
    args: GET https://api.example.com/health -a "status eq 200"

2. Flow runner

Run flows you designed in the Atrahasis desktop app. Flow groups are stored as .flow.json files and are version controlled on their own. Check that repository out first, then run.

- uses: actions/checkout@v4
- uses: atrahasisdev/action@v1
  with:
    args: run auth-flows -f logout-flow -p 2 -c

3. Load testing

Run load specs you built in the desktop app. Spec groups are stored as .spec.json files. Same idea: check them out, then run.

- uses: actions/checkout@v4
- uses: atrahasisdev/action@v1
  with:
    args: run user-specs -t stress

Assertions gate the build

Assertions are what turn a request into a test. When one fails, atra exits 1 and the job fails. Chain as many -a flags as you need.

- uses: atrahasisdev/action@v1
  with:
    args: >-
      GET https://api.example.com/users/1
      -a "status eq 200"
      -a "response_time lt 800"
      -a "$.user.id exists"
      -a "header Content-Type contains json"
Target Example
Status code -a "status eq 200"
Response time (ms) -a "response_time lt 800"
JSON path -a "$.user.id eq 42"
Body content -a "body contains success"
Header -a "header Content-Type contains json"

Operators come in short and long forms: eq/equals, lt/less_than, plus contains, exists, matches_regex, and more. See the full reference in the assertions guide.

Full workflow example

name: API tests

on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Health check
        uses: atrahasisdev/action@v1
        with:
          args: GET https://api.example.com/health -a "status eq 200"

      - name: Run flow
        uses: atrahasisdev/action@v1
        with:
          args: run auth-flows -f logout-flow -p 2 -c

      - name: Load test
        uses: atrahasisdev/action@v1
        with:
          args: run user-specs -t spike

Where do the flow and spec files come from?

You design and run flows and load tests in the Atrahasis desktop app. Each flow group and each spec group is version controlled independently through the app's built in Git, so they live in their own repository, separate from your application code.

To run them in CI, check that repository out with actions/checkout and point working-directory at the folder if it is not the repository root.

Notes

  • Runs on the GitHub hosted Linux, macOS, and Windows runners. Node.js ships with all of them, which is all npx needs.
  • Secrets never touch disk. Pass environment values through the shell as usual and reference them with {{variable}} in your flows and specs.

Learn more

About

Atrahasis GitHub Action to run Atrahasis CLI for API tests, flows, and load tests in CI. Assertions gate your pipeline via exit codes.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors