lunjon / blast

Load testing framework for HTTP APIs, powered by Elixir.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Blast

Load test framework, written in Elixir, that targets HTTP APIs.

It is currently only able to run from the command line, but I have plans to integrate it into a web-based interface built in Phoenix (inspired by Locust).

Installation

Script

If you have Elixir 1.15+ installed you can install blast as an escript:

$ mix do escript.build + escript.install

Nix

If you're using nix checkout the flake!

Running

As mentiod above, it is currently only supported running from your shell.

When started a simple non-interactive TUI will appear that renders the status of the application: requests per second, which requests are sent, etc.

However, to be able to start blast you need a spec file.

Spec file

The spec file defines which requests to send and is written in YAML. By default blast will lock for blast.y[a]ml in the current working directory, but you can point to another file with the --specfile option.

Example:

base-url: http://localhost:8080
requests:
  - path: "/test"
  - path: "/withbody"
    method: post
    body: "{\"test\": true}"
    headers:
      - name: content-type
        value: application/json

You can read more about it in the docs.

Hooks

Blast support hooks via external Elixir modules using the --hooks FILEPATH option.

This will load a filepath as an elixir file, expecting a single module that exports zero or more hooks.

You can read more about it in the docs.

Development

I recommend using the nix flake, like so:

$ nix develop # It takes a while the first time
...
$ mix deps.get # Fetch dependencies

Running as application

You can start blast using:

$ mix run --no-halt main.exs [ARGS]

About

Load testing framework for HTTP APIs, powered by Elixir.

License:MIT License


Languages

Language:Elixir 96.4%Language:Nix 2.7%Language:Just 0.8%