npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

runpostman

v0.0.2

Published

Run Newman/Postman with reporters

Downloads

2

Readme

runpostman

This is a cli node script put together that reads a json file and runs multiple postman collections with the given parameters as options. Currently this script has only a csv reporter, which is handy because it can be imported into a database and manipulated from there to generate any sort of report needed.

Decisions on which reporters to include

At this time, the html reporters have security concerns and have opted to not fold them into this script at this time. I am finding, however, that the csv reporter provides most of the information that is needed anyway, so the first iteration will only contain this reporter while I create a new one.

Json Configuration

The json configuration allows for providing options to the newman postman runner, but also provides some customization for the reporters included. At this time, only the csv reporter is bundled in, but as more reporters are added, more options can be specified.

The collections json item contains an array of postman run configurations. Things that are required are the collection name and the environment file. The rest of the options have defaults that seemed reasonable at the time of writing. If no report file name is specified, it will default to the collection name with the fitting extension type for the report.

note: at the time of this writing, the error checking on the json configuration is not terribly robust. The script will error out if the format is incorrect. This is an area for development.

available options and default values

  {
            verbose: pmCollection.verbose || true,
            collection: collectionFile,
            environment: environmentFile,
            iterationData: pmCollection.dataFile ? (basedir + pmCollection.dataFile) : undefined,
            iterationCount: isNaN(pmCollection.iterations) ? 0 : pmCollection.iterations,
            ignoreRedirects: true,
            insecure: true,
            timeoutRequest: pmCollection.timeoutRequest || 0,
            timeoutResponse: pmCollection.timeoutResponse || 0,
            timeout: pmCollection.timeout || 0,
            timeoutScript: pmCollection.timeoutScript || 0,
            delayRequest: pmCollection.delayRequest || 0
  }

samples/multiconfig.json

There is an example postman collection in the samples directory.

{
  "collections": [
    {
      "reportFileName": "RestExample",
      "collection": "collections/RestExample.postman_collection.json",
      "environment": "environments/RestExample.postman_environment.json",
      "iterationCount": "all",
      "includeBody": false
    },
    {
      "reportFileName": "RestExampleWithData",
      "collection": "collections/RestExample.postman_collection.json",
      "environment": "environments/RestExample.postman_environment.json",
      "datafile": "datafiles/datafile.csv",
      "iterationCount": "all",
      "delayRequest": 500,
      "includeBody": true
    }
  ]
}

Suggested project structure

  • root dir
    • newmandir/
      • collections/
      • datafiles/
      • enviornments/
      • newman-reports/
      • jsonconfig.json

Console output

The console is being written to for each request issued. This can be removed or perhaps toggled with an option

Lauras-iMac:laura$ ./runpostman -k multiconfig.json
Running 2 request(s) and 1 iteration(s)
Running 2 request(s) and 1 iteration(s)
GET https://jsonplaceholder.typicode.com/users
POST https://jsonplaceholder.typicode.com/posts
CSV write complete!
RestExample: collection run completed
Success
GET https://jsonplaceholder.typicode.com/users
POST https://jsonplaceholder.typicode.com/posts
CSV write complete!
RestExampleWithData: collection run completed
Success

Report files

The report files are will be written to ./newman-reports e.g.

- newman-reports
    - RestExample.csv
    - RestExampleWithData.csv

Sample csv report

iteration,collectionName,requestName,method,url,status,code,responseTime,responseSize,executed,failed,skipped,body
"1","RestExample","users","GET","https://jsonplaceholder.typicode.com/users","OK","200","162","5645","Status code is 200"
"1","RestExample","posts","POST","https://jsonplaceholder.typicode.com/posts","Created","201","89","130","Status code is 200, Validate response content"

Newman GitHubRepo

https://github.com/postmanlabs/newman