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

https://github.com/infinilabs/loadgen-dsl

๐Ÿงจ A easy to use and human-friendly DSL for conducting test assessments with INFINI Loadgen.
https://github.com/infinilabs/loadgen-dsl

asset dsl loadgen testing

Last synced: over 1 year ago
JSON representation

๐Ÿงจ A easy to use and human-friendly DSL for conducting test assessments with INFINI Loadgen.

Awesome Lists containing this project

README

          

# ๐Ÿš€ Loadgen DSL

The assertion DSL for Loadgen.

## โœ๏ธ Example

`loadgen-dsl` compiles a little DSL to the yaml configuration of Loadgen.

```sh
# Build WASM module and run it from Golang
just run examples/example.dsl
```

Output:

```txt
and:
- equals:
_ctx.response.body_json.name: lchynn
- range:
_ctx.response.body_json.age:
gte: -22.0
- equals:
_ctx.response.body_json.com: infini
- or:
- regexp:
_ctx.response.body_json.team: dev.*
- regexp:
_ctx.response.body_json.team: doc.*
- and:
- equals:
_ctx.response.body_json.todo.pizza: inprogress
- equals:
_ctx.response.body_json.todo.dsl: inprogress
- and:
- equals:
_ctx.response.body_json.likes.0: anime
- equals:
_ctx.response.body_json.likes.1: sports
```

## ๐ŸŒฒ Grammer

```bnf
grammer ::= brief | full
brief ::= status? object EOF
full ::= fields EOF
status ::= integer
expr ::= expr1 (infixop expr1)*
expr1 ::= literal
| array
| object
| funcall
| prefixop expr1
| '(' exprlist ')'
exprlist ::= (expr (',' expr)* ','?)?
object ::= '{' fields '}'
fields ::= (pair (',' pair)* ','?)?
pair ::= path ':' expr
path ::= key ('.' key)*
key ::= name | string | integer
array ::= '[' exprlist ']'
funcall ::= name '(' exprlist ')'
literal ::= null
| boolean
| integer
| float
| regex
| string
ignore ::= whitespace
| comment
/* ws: definition */

comment ::= '//' char*
name ::= ident - keyword
keyword ::= 'null'
| 'true'
| 'false'
| 'not'
| 'and'
| 'or'
ident ::= id_start (id_start | '-' | digit)*
id_start ::= [_a-zA-Z]
prefixop ::= '-'
| '>'
| '<'
| '>='
| '<='
| '=='
| 'not'
infixop ::= 'and' | 'or'
null ::= 'null'
boolean ::= 'true' | 'false'
integer ::= digit+
exponent ::= ('e' | 'E') ('+' | '-')? integer
float ::= integer exponent
| integer '.' integer exponent?
digit ::= [0-9]
regex ::= '/' ('\/' | char - '/')+ '/'
string ::= '"' (escape | char - '"')* '"'
| "'" (escape | char - "'")* "'"
escape ::= '\b'
| '\f'
| '\n'
| '\r'
| '\t'
| "\'"
| '\"'
| '\\'
| '\/'
char ::= #x9
| [#x20-#xD7FF]
| [#xE000-#xFFFD]
| [#x10000-#x10FFFF]
whitespace ::= [#x9#xA#xD#x20]+
EOF ::= $
```

### References:

- [W3C EBNF Notation](https://www.w3.org/TR/2008/REC-xml-20081126/#sec-notation)
- [REx Parser Generator](https://bottlecaps.de/rex/)

## โš–๏ธ License

Licensed under either of

- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or
)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or
)

at your option.