Releases: societe-generale/spintest
Releases · societe-generale/spintest
Fix output issues on Rollback
Capability to use output values during a Rollback scenario
See the example, now it is working
result = spintest(
["http://test.com"],
[
{
"method": "GET",
"route": "/test",
"output": "test_output",
"expected": {"code": 400},
"rollback": ["test_rollback"],
},
{
"name": "test_rollback",
"method": "DELETE",
"route": "/test/{{ test_output['id'] }}",
"expected": {"code": 201},
},
],
)
Fail_on definition
Add capabilty to stop test execution if some elements are present on "fail_on" definition
from spintest import spintest
urls = ["https://test.com"]
tasks = [
{
"method": "GET",
"route": "test",
"expected": {
"body": {"result": "Success"},
"expected_match": "partial",
},
"fail_on": [
{
"code": 409,
},
{
"body": {"result": "Failed"},
"match": "partial",
},
{
"body": {"result": "Error"},
"match": "partial",
},
],
"retry": 15,
}
]
result = spintest(urls, tasks, generate_report="report_name")
assert True is result
Generate report
Spintest is now able to generate report.
how to use it
On the spintest call, add the new argument generate_report=[PATH_OF_REPORT]
- example
result = spintest(
["http://test.com"],
[
{"method": "GET", "route": "/test", "output": "test"},
{"method": "GET", "route": "/{{ test['foo'] }}"},
],
generate_report="/tmp/spintest_report/test_report.json",
)
-
Report will be present on path = "/tmp/spintest_report/test_report.json"
-
Report look like :
[{"url": "http://test.com", "reports": [{"name": null, "status": "SUCCESS", "timestamp": "Fri Jun 26 14:31:05 2020", "duration_sec": 0.11, "url": "http://test.com", "route": "/test", "message": "OK.", "code": 200, "body": "Hello!", "task": {"method": "GET", "route": "/test", "delay": 1, "ignore": false, "retry": 0, "headers": {"Accept": "application/json", "Content-Type": "application/json"}, "duration_sec": 0.11}, "ignore": false, "output": {"__token__": "***"}}, {"name": null, "status": "SUCCESS", "timestamp": "Fri Jun 26 14:31:05 2020", "duration_sec": 0.11, "url": "http://test.com", "route": "/test", "message": "OK.", "code": 200, "body": "Hello!", "task": {"method": "GET", "route": "/test", "delay": 1, "ignore": false, "retry": 0, "headers": {"Accept": "application/json", "Content-Type": "application/json"}, "duration_sec": 0.11}, "ignore": false, "output": {"__token__": "***"}}], "total_duration_sec": 0.22}]
Fix test issues
v0.2.1 Bump version: 0.2.0 → 0.2.1