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

@kingojs/kingo

v0.9.4

Published

Write better test cases

Downloads

5

Readme

金吾 (Kingo)

NPM Version NPM Weekly Downloads NPM Downloads

Kingo is a REST API testing framework with the following goals:

  • Generate Postman collections
  • Be an easy-to-learn tool
  • Be a friendly tool for Developers and QA Engineers
  • Have organized code
  • Be able to write test cases from any text-editor/IDE
  • Get rid of Postman UI

Why?

Postman is a powerful tool with a lot of useful features that allow developers to perform quality tests with ease but writing test cases from Postman UI can be a little bit annoying, especially because Postman UI was not meant to work as a text-editor.

By using Kingo, developers will be able to have a better versioning control of their test cases.

Also, Kingo allows developers to use different languages like: JavaScript (Vanilla [recommended]), TypeScript, CoffeeScript, Clojure, PureScript, and a long et cetera.

Use example

This is the folder structure to be followed in order to generate the Postman collection.

.
└── collection/
    ├── api_01/
    │   ├── test_case_01/
    │   │   ├── prerequest.js
    │   │   ├── request.json
    │   │   ├── body.json
    │   │   └── tests.js
    │   ├── test_case_02/
    │   │   ├── prerequest.js
    │   │   ├── request.json
    │   │   ├── body.json
    │   │   └── tests.js
    │   ├── readme.md
    │   └── prerequest.js
    ├── api_02/
    │   ├── test_case_01/
    │   │   ├── prerequest.js
    │   │   ├── request.json
    │   │   ├── body.json
    │   │   └── tests.js
    │   ├── test_case_02/
    │   │   ├── prerequest.js
    │   │   ├── request.json
    │   │   ├── body.json
    │   │   └── tests.js
    │   └── readme.md
    ├── variables.json
    ├── readme.md
    └── prerequest.js

Import kingonize from @kingojs/kingo and send an object as the one bellow and provide the required fields.

import { kingonize } from '@kingojs/kingo';

kingonize({
    root: './collection', // files location
    // The APIs you want to include
    APIS: [
        'API_01',
        'API_02'
    ],
    // prefix for each file type
    prefixes: {
        request: 'request', // method and url
        prerequestScript: 'prerequest', // script running before request
        variables: 'variables', // global variables (collection level)
        body: 'body', // in JSON format
        tests: 'tests', // script running after request
        documentation: 'readme' // markdown file
    }
});

Finally, execute the script as a normal NodeJS file.

node main.js

Note I: It is important to notice that it is not necessary to create all the different type of files, notices how API_02 does not contain a prerequest.js file, whilst API_01 does.

Note II: Make sure the request.json file has the following structure:

{
    "method": "get",
    "request_url": "{{base_url}}/test"
}

Compile

If you want to compile the project, you can use the following command:

npx tsc

tsconfig.json file will do the magic for you!

Reporting

newman-reporter-htmlextra is a perfect compliment for Kingo, by using this module you can run collections generated by Kingo directly from the terminal to get fully rid of Postman UI.

TODO

  • Authentication support
  • Non-REST APIs support
  • Implicit APIs selection

Why is it named 金吾?

Because of the one and only 濱田金吾 (Kingo Hamada)!