Closed karrybit closed 3 weeks ago
@karrybit Thank you for your question.
json://
or yaml://
is currently only available at the first level of vars/params.
It is possible to use wildcards instead.
$ cat normal.yaml
desc: normal case
debug: true
runners:
api: http://localhost:8080
vars:
data: 'json://data/*.json'
steps:
request:
loop: len(vars.data)
dump: vars.data[i]
$ runn run normal.yaml
Run "dump" on "normal case".steps.request.loop[0]
{
"bar": 2,
"foo": "fuga"
}
Run "dump" on "normal case".steps.request.loop[1]
{
"bar": 1,
"foo": "hoge"
}
Run "dump" on "normal case".steps.request.loop[2]
{
"bar": 3,
"foo": "piyo"
}
.
1 scenario, 0 skipped, 0 failures
$
Thank you for your response.
I plan to prepare and execute a test data set that violates variations to test API validation. With your solution, I can meet my requirements by unifying the file names or creating a directory to consolidate the test data.
We are considering adopting runn as our API test tool. In our testing, we aim to keep the runbook simple and manage variations through input data. However, it does not work as expected when loading multiple JSON files into the vars array variable in runn.
In this case, instead of expanding the JSON's contents, it sends the string
"json://data/hoge.json"
as the request.I have also tried the following, but the result was the same.
Is there a way to load multiple JSON files at once? Here is the reproducible code.
Thanks.