Templates¶
The templating logic is based on the same JSON Editor that has full semantic and syntax check so that it’s as easy as possible to define a template case through the Dashboard page.
This means that besides the saving and uploading data from your local system, you also have the possibility of:
saving your work remotely as a template
loading your work from a template
Templates can be used by any editor to launch tests.
Permissions¶
Member role vs API call |
List templates |
Add template |
Get template details |
Remove template |
---|---|---|---|---|
Reader |
True |
False |
True |
False |
Editor |
True |
True |
True |
True |
Admin |
True |
True |
True |
True |
AdminWithBilling |
True |
True |
True |
True |
Owner |
True |
True |
True |
True |
Template properties¶
Template properties are exactly the same as the Test Properties mentioned in the Tests page.
List templates¶
Web¶
In order to view the templates on our platform, all you have to do is browse to the Templates page.
API call¶
The API call is:
curl -s \
-d '{"team_id":"my-team"}' \
-H "X-Api-Key: my_api_key" \
-X POST \
https://app.rungutan.com/v1/api/templates/list | jq . -r
{
"Tests": [
{
"template_id": "my_template_id",
"threads_per_region": 2,
"created_date": "2020-03-26T09:08:15Z",
"run_time": "30s",
"member_email": "[email protected]",
"test_region": "ap-southeast-1,ap-southeast-2"
},
{
"template_id": "my_template_id_2",
"threads_per_region": 5,
"created_date": "2020-03-29T10:12:34Z",
"run_time": "60s",
"member_email": "[email protected]",
"test_region": "us-east-1,us-east-2"
}
}
You can also filter based on template_id to generate the summary for only that specific template_id:
curl -s \
-d '{"team_id":"my-team", "template_id": "my_template_id"}' \
-H "X-Api-Key: my_api_key" \
-X POST \
https://app.rungutan.com/v1/api/templates/list | jq . -r
{
"Templates": [
{
"template_id": "my_template_id",
"threads_per_region": 2,
"created_date": "2020-03-26T09:08:15Z",
"run_time": "30s",
"member_email": "[email protected]",
"test_region": "ap-southeast-1,ap-southeast-2"
}
}
CLI¶
List all templates:
$ rungutan templates list
{
"Tests": [
{
"template_id": "ad837abd-15d4-47ce-a344-01a3323bdd09",
"test_name": "test name",
"threads_per_region": 1,
"created_date": "2020-05-19T12:04:42Z",
"run_time": 60,
"member_email": "[email protected]",
"test_region": "us-east-1"
},
{
"test_id": "15fa78b9-097b-401a-bedb-a70ddc4726ed",
"test_name": "Sample worklfow test",
"threads_per_region": 1,
"created_date": "2020-05-19T11:56:19Z",
"run_time": 60,
"member_email": "[email protected]",
"test_region": "us-east-1"
}
]
}
Filter based on template_id:
$ rungutan templates list --template_id ad837abd-15d4-47ce-a344-01a3323bdd09
{
"Templates": [
{
"test_id": "ad837abd-15d4-47ce-a344-01a3323bdd09",
"test_name": "test name",
"threads_per_region": 1,
"created_date": "2020-05-19T12:04:42Z",
"run_time": 60,
"member_email": "[email protected]",
"test_region": "us-east-1"
}
]
}
Add template¶
Web¶
In order to save a new template, all you have to do is browse to the Templates page and click on the create template button.
API call¶
The API call is:
curl -s \
-d '{
"team_id": "my-team",
"run_time": 60,
"num_clients": 10,
"threads_per_region": 1,
"test_region": [
"us-east-1"
],
"workflow": [
{
"path": "https://example.com/",
"method": "GET",
"data": "",
"headers": {}
}
]}' \
-H "X-Api-Key: my_api_key" \
-X POST \
https://app.rungutan.com/v1/api/templates/add | jq . -r
{
"template_id": "some_template_id",
"message": "Successfully created new template"
}
CLI¶
Start the test in the background:
$ rungutan templates add --test_file test_file.json
{
"test_id": "fff6580d-999b-4ce5-8e1b-b14eb66f42be",
"test_name": "test from cli",
"message": "Successfully created new template"
}
Get template details¶
Web¶
In order to get the details of a template, all you have to do is browse to the Templates page and click on the Copy Template Json button for the respective template.
API call¶
The API call is:
curl -s \
-d '{
"template_id": "some_template_id",
"team_id": "my-team"
}' \
-H "X-Api-Key: my_api_key" \
-X POST \
https://app.rungutan.com/v1/api/templates/get | jq . -r
{
"TestData": {
"run_time": 60,
"num_clients": 10,
"threads_per_region": 1,
"workflow": [
{
"path": "https://example.com/",
"method": "GET",
"data": "",
"headers": {}
}
],
"test_region": [
"us-east-1"
]
}
}
CLI¶
This is how you run the CLI:
$ rungutan templates get --template_id 61c8bc4b-e1b1-4fb5-bb24-d860bf79e460
{
"TestData": {
"run_time": 5,
"num_clients": 10,
"threads_per_region": 1,
"workflow": [
{
"path": "https://example.com/",
"method": "GET",
"data": "",
"headers": {}
}
],
"test_region": [
"us-east-1"
]
}
}
And this is how you get the TestData and save it to a file for later use:
$ rungutan templates get --template_id 61c8bc4b-e1b1-4fb5-bb24-d860bf79e460 | jq -r .TestData > file.json
$ cat file.json
{
"run_time": 5,
"num_clients": 10,
"threads_per_region": 1,
"workflow": [
{
"path": "https://example.com/",
"method": "GET",
"data": "",
"headers": {}
}
],
"test_region": [
"us-east-1"
]
}
Remove template¶
Web¶
In order to remove a template, all you have to do is browse to the Templates page and click remove template button.
API call¶
The API call is:
curl -s \
-d '{
"template_id": "some_template_id",
"team_id": "my-team"
}' \
-H "X-Api-Key: my_api_key" \
-X POST \
https://app.rungutan.com/v1/api/templates/remove | jq . -r
{
"message": "Successfully deleted template"
}
CLI¶
Remove the template using the CLI:
$ rungutan templates remove --template_id fff6580d-999b-4ce5-8e1b-b14eb66f42be
{
"message": "Successfully deleted template"
}