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

@skills17/postman-helpers

v1.0.1

Published

Provides Postman helpers for usage in a skills competition environment.

Downloads

7

Readme

skills17/postman-helpers

This package provides Postman helpers for usage in a skills competition environment. It includes:

  • Custom output formatter
  • Opinionated Newman run command for multiple collections at once
  • ... and more

Table of contents

Installation

Requirements:

  • Node 16 or greater
  • Postman 9.0 or greater

To install this package, run the following command:

npm install @skills17/postman-helpers

It is suggested to add the following npm scripts:

  "scripts": {
    "test": "skills17-postman run",
    "test:json": "skills17-postman run --json"
  },

This will provide the following commands:

  • npm test - Run all tests once and show a nice output with the awarded points (useful for the competitors to see their points)
  • npm run test:json - Run all tests once and get a json output (useful for automated marking scripts)

The runner will look for exported Postman collections in a collections/ folder and run them all.

Usage

A config.yaml file needs to be created that contains some information about the task. It should be placed in the root folder of your task, next to the package.json file.

See the @skills17/task-config package for a detailed description of all available properties in the config.yaml file.

CLI

As seen in the installation instructions, the skills17-postman command is available.

It is a thin wrapper around the actual newman command which prepares the task and configures Newman correctly.

All arguments to the command will be forwarded to newman so Newman can be used exactly the same way if this package wouldn't be installed.

Additionally, the following new arguments are available:

  • --json output the test result with scored points in json to standard out

Grouping

A core concept are request folders. You usually don't want to test everything for one criterion in one request test function but instead split it into multiple ones for a cleaner tests and a better overview.

In Postman, tests can be grouped by folders. Request names have to be specified with their path in the config.yaml file.

For example, a request with name "bar" in a collection "skills" and folder "foo" will have the name skills > foo > bar.

To catch and group all tests within the foo context, the group matcher can be set to skills > foo > .+ for example. Each of the tests within that group will now award 1 point to the group.

Extra tests

To prevent cheating, extra tests can be used. They are not available to the competitors and should test exactly the same things as the normal tests do, but with different values.

For example, if your normal test contains a check to reject a random token in a header (e.g. 'foo'), copy the test into an extra test and change the token to another value (e.g. 'bar'). Since the competitors will not know the extra test, it would detect statically returned responses that were returned to simply satisfy the 'foo' tests instead of actually implementing the requested logic.

Extra tests are detected if they the collection name contains a suffix extra. That means that you can duplicate your collection foo and name it foo-extra. The test names should exactly equal the ones from the normal tests. If they don't, a warning will be displayed.

It usually makes sense to move the extra tests in a separate folder, so the folder can simply be deleted before the tasks are distributed to the competitors. Nothing else needs to be done or configured.

If an extra test fails while the corresponding normal test passes, a warning will be displayed that a manual review of that test is required since it detected possible cheating. The penalty then has to be decided manually from case to case, the points visible in the output assumed that the test passed and there was no cheating.

License

MIT