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 🙏

© 2026 – Pkg Stats / Ryan Hefner

auto-test-api

v1.1.2

Published

Auto test API via testcases which are json files

Downloads

11

Readme

AutoTestAPI

Used to test APIs via testcases files which is formated by json.

Some features:

  • Auto play test via npm, you can integrate into jenkin...
  • Use variable to store response data which will be reuse for the testcases
  • See variable value via console log in browser by click on variable which you want to debug
  • Generate result file to html which so easy to view and debug

Version

1.0.0

Tech

AutoTestAPI uses a number of open source projects to work properly:

  • AngularJS - HTML enhanced for web apps!
  • node.js - evented I/O for the backend
  • unirest - A set of lightweight HTTP libraries
  • jsonfile - Read/write JSON files
  • open - Open a file or url in the user's preferred application

And of course AutoTestAPI itself is open source with a git-repo-url on GitHub.

Installation

You need Gulp installed globally:

$ git clone [git-repo-url] autotestapi
$ cd autotestapi
$ npm install

Plugins

AutoTestAPI is currently extended with the following plugins

  • Github

Readmes, how to use them in your own application can be found here:

  • [plugins/github/README.md] PlGh

Todos

  • Write Testcase in [testcases/main.js] PlTc
  • Run $ npm test or $ npm test {testcase.json}
  • View test result which extension is .result.html

Write testcase

Main testcase: testcases/main.json

{
	"project": "Prject name",
	"headers" : { //Headers you want add in the request
		"content-type": "application/json" 
	},
	"env": { // Global variable which you want to use for all testcases
		"url": "http://localhost", // used in testcases is "${env.url}"
		"port": 8080,
		"login": {
			"username": "[email protected]",
			"password": "12345"
		}
	},
	"status": [200, 201], // If response status is not in these, it'll be marked fail
	"testcases": [
		"testcases/login.json", // your testcase file
		"testcases/account.json"
	]
}

Your testcase: testcases/login.json

{
	"title": "API Login", // title testcase
	"api": [
		{// Request to API
			"des": "Login", // Description
			"method": "POST", // Http method: POST, GET, PUT, DELETE
			"url": "http://localhost:8080/nanacloset/account/login",// URL Request
			"body": { // Request data body
			    "userName": "[email protected]",
			    "passWord": "123456"
			},
			"var": "currentUser",// variable which will be stored response data to use for others
			"expect": { // Expected response which will validate testcase pass or fail
				"status": 200,// http response status code must be 200 -> passed
				"data": {// response data
					"code": "OK" // It'll check response data must have a field "code" and its value is "OK" 
				}
			}
		},
		{
			"des": "Add account",
			"method": "PUT",
			"url": "${env.url}:${env.port}/nanacloset/account/addAccount",
			"body": {
		    "userName": "thanh-${utils.uniqueId()}",// utils.uniqueId() will autoincrements which used for ID
		    "passWord": "123aA",
		    "email": "${this.userName}@gmail.com",// "this."// used by local variable which in a object
		    "displayName": "${this.userName}",
		    "mobilePhone": "0973363999",
		    "homePhone": "0973363999",
		    "deviceId": []
			},
			"var": "newUser",
			"expect": {
				"status": 200,
				"data": {
					"code": "OK"
				}
			}
		},
		{
			"des": "Get all campaign",
			"method": "POST",
			"url" : "http://localhost:8080/nanacloset/campaign/getListCampaign",
			"var": "listCampaign",
			"body": {
		    "aid": "${currentUser.baseClass[0].aid}", // used currentUser variable which was declared in the previous api testing
		    "token": "${currentUser.baseClass[0].token}"
			},
			"expect": {
				"status": [200, 201], // http response status code must be in 200 or 201 -> passed
				"data": {
					"code:": ["OK", "NOT_FOUND"], // Check code value in response data must be IN "OK" or "NOT_FOUND". Syntax: "[FIELD_NAME]:"
					"campaign": {
						"status!:": [1, 2], // Check status value in response data must NOT be IN 1 or 2. Syntax: "[FIELD_NAME]!:"
						"name!": "Restaurants" // Check name value in response data must NOT be "Restaurants". Syntax: "[FIELD_NAME]!"
					}
				}	
			},
			"apply": {// set new value for variables. After responsed , currentUser variable will be updated something. You can update many variables
				"currentUser": { // It's variable which was declared in the testcase API Login
					"baseClass": [// Property in currentUser variable
						"name": "name_after_updated", // set name for currentUser variable
						"email": "${this.name}@gmail.com" // It's "[email protected]". "this" will be reference the a object which contains it
					]
				}
			}
		}
	]
}

License

MIT

Free Software, Hell Yeah!