Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

nbcdotcom/newman-reporter-basicText

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Basic text reporter for Newman

Installation

Run npm install --save newman-reporter-basicText@git+ssh://[email protected]:nbcdotcom/newman-reporter-basicText.git

Usage

In order to use this custom reporter, simply add 'basicText' to the list of reporters.

Options

This text reporter also accepts three options.

  • export: If you'd like newman to output the results of the collection to a file, enter the file name under the 'export' property.
  • cli: If you'd like newman to output the results of the collection to stdout, set the 'cli' property as 'true' (string not bool).
  • rolling: If you'd like newman to output the results to a new file based on the current day set this property to 'true'

Note that you do not have to do require('newman-reporter-basicText') anywhere as newman will automatically require the package when the collection is run.

newman.run({
    collection: require('./tests.postman_collection.json'),
    reporters: 'basicText',
    reporter: {
        'basicText': {
            // Take output and save it to file
            export: `./logs/${startTime}.txt`,
            // Output to rolling file based on current day
            rolling: 'true',
            // Output the results to stdout
            cli: 'true'
        }
    }
}, function (err) {
    if (err) { throw err; }
});
newman run ./tests.postman_collection.json --reporter basicText --reporter-basicText-export './logs/output.txt' --reporter-basicText-rolling 'true' --reporter-basicText-cli 'true'

Example Output

< Start collection run
< ✔ Assertion passed! [1 / 3] "User successfully logged in" (duration 312) ms"
< ✔ Assertion passed! [2 / 3] "User profile should exist for user" (duration 229) ms"
< ✗ Assertion failed! [3 / 3] "No results in elastic search (ADMIN view)" (duration 108) ms"
< Collection run completed for collection: 3 tests executed