Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/trsnium/indulgences

📚Distributed load test framework
https://github.com/trsnium/indulgences

distributed elixir load-testing

Last synced: 25 days ago
JSON representation

📚Distributed load test framework

Awesome Lists containing this project

README

        

# Indulgences
![badge](https://action-badges.now.sh/TrsNium/Indulgences?workflow=test)

### Work In Progress
- Output report in html format

## Usage

Basically you can use like following.
```elixir
Indulgences.Scenario.new("Test Scenario",
fn ->
Indulgences.Http.new("Test Local Request")
|> Indulgences.Http.get("http://localhost")
|> Indulgences.Http.set_header("header", "value")
|> Indulgences.Http.check(
fn(%HTTPoison.Response{}=response, %{}=state)->
Indulgences.Http.is_status(response, 200)
state
|> Map.put(:body, response.body)
end)
|> Indulgences.Http.new("Test Local Request2")
|> Indulgences.Http.get("http://localhost")
|> Indulgences.Http.set_header("set-header-body", fn(state)->Map.get(state, :body)end)
|> Indulgences.Http.check(
fn(%HTTPoison.Response{}=response)->
Indulgences.Http.is_status(response, 200)
end)
end)
|> Indulgences.Scenario.inject(
fn ->
Indulgences.Activation.constant_users_per_sec(100, 10)
end)
|> Indulgences.Simulation.start
```

When you wanna use indulgences on a module basis.
```elixir
defmodule Test do
use Indulgences

@scenario_title "Test Scenario"

@impl true
def scenario() do
Indulgences.Http.new("Test Local Request")
|> Indulgences.Http.get("https://localhost")
|> Indulgences.Http.set_header("hoge", "huga")
|> Indulgences.Http.check(
fn(%HTTPoison.Response{}=response)->
Indulgences.Http.is_status(response, 404)
end)
end

@impl true
def activation() do
Indulgences.Activation.constant_users_per_sec(100, 10)
end
end

Test.start
```

## Installation

If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `indulgences` to your list of dependencies in `mix.exs`:

```elixir
def deps do
[
{:indulgences, "~> 0.1.0"}
]
end
```

Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at [https://hexdocs.pm/indulgences](https://hexdocs.pm/indulgences).