An API testing tool for human.
In progressing...
Write test cases in human json.
{
request: {
url: http://127.0.0.1:8000/login_success
}
response: {
body: {
success: true
message: login success
}
}
}
View testing report. Highlight bad assertions.
Put the following test case into a file.
# This is a simple test case
{
# Reuqest the url: http://127.0.0.1:8000/login_success
request: {
url: http://127.0.0.1:8000/login_success
}
# Expected response is the following json:
# {
# "success":true,
# "message":"login success"
# }
response: {
body: {
success: true
message: login success
}
}
}
Suppose the file name is helloworld.jsontest
, then you can run the test case use
the fowllowing command:
python jsontest.py helloworld.jsontest
It will give the output:
Passed: helloworld.jsontest
Total 1
Passed 1
Failed 0
Error 0
The response has a status
field if target url not returning 200 ok.
In this way, you can check the status code.
{
request: {
url: http://127.0.0.1:8000/bad_url
}
response: {
status: "404"
body: {
success: false
message: request path not found
}
}
}
You can define variables for better maintenance.
{
var: {
# define a target variable
target: http://127.0.0.1:8000
}
request: {
# ${target} to use the variable
url: ${target}/login_success
}
response: {
body: {
success: true
message: login success
}
}
}