newman-server

0.8.0 • Public • Published

Node.js CI

newman-server

newman-server is a simple NodeJS server that can run your Postman's collections, using the newman engine.

🚩 Requires nodeJS >= 20 🚩

Example:

$ npm install -g newman-server
$ newman-server
Server started on port 8080
Access http://localhost:8080 to test the server

If you don't want to do a global installation, you can use npx to run a locally installed dependency

$ npm install newman-server
$ npx newman-server

The server expose a simple POST /run/{outputType} endpoint that expect the Postman collection as a form data input. For example POST /run/json for will use the json newman reporter. An basic index.html is provided to try running your collection.

Features

Supported outputs

Output type Path param Reporter used
JSON json https://github.com/postmanlabs/newman#json-reporter
JUnit junit https://github.com/postmanlabs/newman#junitxml-reporter
HTML html https://www.npmjs.com/package/newman-reporter-htmlextra

Form Inputs

Form input Type Description
collectionFile .json file The Postman JSON collection file
iterationDataFile .json file (Optional) The Postman iteration data JSON file

CLI options

Option Type Default Description
port number 8080 The server's port
tempReportsFolder path ./temp_reports The folder where the temporary XML and HTML report file will be created.

OpenApi doc

To have more details about the endpoints shape, you can look at the server OpenApi documentation

Health check endpoint

The server is exposing the endpoint GET /api/health that verifies that the server is in an healthy state. When the endpoint is called, the program will check that:

  • It has read/write access to the temparory result folder
  • The newman NPM package has been successfully installed and is able to run a Postman collection If the tests succeed, the response status code will be 200, otherwise it will respond with a 500.

Convert to HTML endpoint

The server is exposing the endpoint POST /convert/html that expects JSON summary file as form data input that can be received through POST /run/json. If the provided summary file is valid, the response will be 200 with HTML report, otherwise it will respond with a 400 and error.

Developer's guide

Local test and run

$ npm install
$ npm test
$ npm run start:dev

Install the CLI locally

$ npm pack 
$ cd some-test-folder
$ npm install ..\newman-server-x.x.x.tgz
$ npx newman-server

Readme

Keywords

Package Sidebar

Install

npm i newman-server

Weekly Downloads

1

Version

0.8.0

License

ISC

Unpacked Size

172 kB

Total Files

30

Last publish

Collaborators

  • criteo-rnd
  • ouvreboite