Skip to content

Latest commit

 

History

History
60 lines (37 loc) · 1.57 KB

api.test.md

File metadata and controls

60 lines (37 loc) · 1.57 KB

Tests for Postman

This is an example of Blueman file with test scripts for Postman.

### H3 heading must contains API Blueprint's Action Section : action defined by name, i.e. ## <identifier> [<HTTP request method>].

Postman test script must be followed by this heading section.

All scripts must be started with Markdown code block definition example.

All test scripts for Actions are optional.

Initial code

Header ## H2 above wiil be ignored.

This section may by empty or not defined.

Code below will be prepend to all test scripts. May be empty.

var jsonData = JSON.parse(responseBody);

Create a Player

This text will be ignored. Use it to comments.

tests["Content-Type is present"] = postman.getResponseHeader("Content-Type"); //Note: the getResponseHeader() method returns the header value, if it exists.
tests["Status code is 200"] = responseCode.code === 200;

This text also will be ignored.

Another action

No tests.

Example 0

Empty test

Example 1

Code without language definition

var a = 1;

Example 2

Empty code block with language definition