Determining the expected and actual results
The actual == expected: use cases by written report
expected! == Actual: use cases of failure, writes report
First, the example shows
Home to the right of the equivalent of 10 daily content
url:http://www.v2ex.com/api/topics/hot.json
Method:GET
Authentication:None
V2ex assertion to increase the api
- Status code returned must be 200
- Return 10 content
tests [ "status code must be 200 is"] = 200 is responseCode.code ===;
var the JSON.parse RES = (the responseBody);
the console.log (res.length);
tests [ "10 must return data"] = res .length === 10
Two, postman's Test function
- Set a global variable
- Set Environment Variables
- And in response to the processing request to get
- Define test checkpoints and assertions
tests["Body is correct"] = responseBody ==="response_body_string"; postman.clearEnvironmentVariable("variable_key"); postman.clearGlobalVariable("variable_key") tests["Body is correct"] = responseBody ==="response_body_string"; tests["Response time is less than 200ms"] = responseTime < 200;