Skip to main content
Version: 9.0.0

Newman Plugin

API testing

Newman

API collections designed in Postman can be executed in Test Maker by extending Newman plugin. Like the previously described plugins, a configuration file is added as a dependency to the project and its path is referenced in the spec file.

postman-api-collection.json
"info": {
"$ref": "#/definitions/info"
},
"item": {
"type": "array",
"description": "Items are the basic unit for a Postman collection.You can think of them as corresponding to a single API endpoint. Each Item has one request and may have multiple API responses associated with it.",
"items": {
"title": "Items",
"oneOf": [
{
"$ref": "#/definitions/item"
},
{
"$ref": "#/definitions/item-group"
}
]
}
},
"event": {
"$ref": "#/definitions/event-list"
},
"variable": {
"$ref": "#/definitions/variable-list"
},
"auth": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/definitions/auth"
}
]
},
"protocolProfileBehavior": {
"$ref": "#/definitions/protocol-profile-behavior"
}
}

Here is an example of using Newman Plugin. Note that different reporters can be used:

import {Feature, newmanPlugin} from "test-maker";

Feature(`API tests`)
.Scenario(`API testing`)
.Given(`Newman test`, async (I, runInfo) => {
await newmanPlugin.run({
collection: `./postman-api-collection.json`,
reporters: [`cli`, `htmlextra`]
})
})
note

We recommend using Postman documentation as it contains all the information you need to build API tests.