- To make smoke tests of API easier and more enjoyable for server-side developers
- Planing smoke tests by using a JSON style config file
- Various cookies for test can be prepared
- Reusable test target API information store
Please download and install golang
$ git clone https://github.com/willsmile/s2test
$ cd s2test
$ GO111MODULE=on go get -v -d
$ go build -o s2test .
$ ./s2test help
To prepare a test plan by using the following format (for example, let's name the file 'plan.json').
{
"goal": "Have a try on s2test",
"endpoints": "./api.json",
"ua": "tester",
"auths": {
"cookieA": {
"type": "Cookie",
"name": "cookieName",
"value": "cookieValue"
},
"tokenA": {
"type": "OAuth 2.0",
"prefix": "Bearer",
"value": "tokenValue"
}
},
"tasks": [
{
"targetAPI": "GET a sample post",
"auth": ["tokenA"]
},
{
"targetAPI": "POST a sample post",
"auth": ["tokenA"],
"variables": {
"sample_use_id": "1",
"sample_post_title": "sample post title"
}
}
]
}
Also, to write down the information of test target API by using the following format.
{
"GET a sample post": {
"description": "GET a sample post",
"url": "https://jsonplaceholder.typicode.com/posts/1",
"method": "GET",
"headers": {
"Content-type": "application/json; charset=utf-8"
}
},
"POST a sample post": {
"description": "POST a sample post",
"url": "https://jsonplaceholder.typicode.com/posts",
"method": "POST",
"headers": {
"Content-type": "application/json; charset=utf-8"
},
"body": {
"title": "#{sample_post_title}",
"body": "sample post body",
"userId": "#{sample_use_id}"
}
}
}
- Run with both
plan path
andapi path
./s2test -p plan.json -a api.json
- Run with only
plan path
(api path
will be set with the value ofendpoints
in test plan file)
./s2test -p plan.json