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

testapi6

v1.2.89

Published

Test and auto export document to .md or .swagger file. Support many others tasks

Downloads

408

Readme

testapi6

Utility tools for dev which run base on scenario yaml files

Features

  1. Test APIs base on scenario files *.yaml
  2. Validate data after each steps
  3. Re-use variable after each steps
  4. Split a huge testcase to many small testcases which make easy to test in a big project
  5. Easy to extends, customize for specific project
  6. Load external modules (mysql, postgreSQL, mongo, redis, grpc, rabbitmq...) or create tags by yourself
  7. Support run benchmark via wrk
  8. Auto generate sequence diagram from any file base on comment

Practice

Installation

Visual code

  • Install extension doanthuanthanh88.testapi6

CLI

# install via npm
npm install -g testapi6
# install via yarn
yarn global add testapi6 --prefix /usr/local

Docker

  docker pull doanthuanthanh88/testapi6

How to run

Visual code extension

  1. Create a scenario files *.yaml
  2. Open the scenario file
  3. Press ctr+shift+t or cmd+opt+t

CLI

  testapi6 ${PATH_TO_SCENARIO_FILE}

Docker

  1. Run with local scenario files
  docker run --rm \
    -v $PWD/scenario_file.yaml:/test/index.yaml \
    -e {var_name_1}={value} \
    -e URL=http://urlhere... \
    doanthuanthanh88/testapi6
  1. Run with http scenario files
  docker run --rm \
    -e {var_name_1}={value} \
    -e URL=http://urlhere... \
    doanthuanthanh88/testapi6 \
    http://.../scenario_file.yaml
  1. Run with scenario encrypted files which need a password to decrypted before run
  docker run --rm \
    -v $PWD/scenario_file.yaml.encrypt:/test/index.yaml.encrypt \
    -e {var_name_1}={value} \
    -e URL=http://urlhere... \
    doanthuanthanh88/testapi6 \
    http://.../scenario_file.yaml \
    $PASSWORD
  1. Run with some external modules
  docker run --rm \
  -v $PWD/test/examples/mock_data.yaml:/test/index.yaml \
  -e MODULES="testapi6-mockapi testapi6-sql" \
  doanthuanthanh88/testapi6

The environment variables always override all of vars in Testcase file

Scenario file example

title:                      # Document title
description:                # Document description
developer: [email protected]  # Author
version: 1.0.0              # Document version
servers:                    # Example server in document
  production: https://prod.abc.vn/my-service/v1.0
  staging: https://staging.abc.vn/my-service/v1.0
  development: http://localhost:3001
# debug: true
vars:                               # Declare global variables
  url: http://0.0.0.0:3001
templates:                          # Declare templates which not run
  # Make request
  - Api:
  - Get:
  - Post:
  - Put:
  - Patch:
  - Delete:
  - Head:
  - Group:
steps:
  # Make request
  - Api:            # REST API
  - Get:            # API GET method
  - Delete:         # API DELETE method
  - Head:           # API HEAD method
  - Post:           # API POST method
  - Put:            # API PUT method
  - Patch:          # API PATCH method
  # Print
  - Echo:           # Print data
  - Schema:         # Print object schema
  # Logic
  - Script:         # Inject javascript in scenario
  - Vars:           # Declare global variables
  - Regex:          # Handle regex string
  # Validate
  - Validate:       # Validate logic
  - Validator:      # Create a new validator
  # Common
  - Pause:          # Pause or delay calls
  - Import:         # Import files
  - Load:           # Load data file then assign the value to a variable
  - Require:        # Load external module or embed code to create a new tags
  - Group:          # Group steps to manage
  - Exec:           # Execute external command
  - Utils:          # Utility functions
  - Define:         # Declare new Utils/Validate/Vars
  - Input:          # Get user input keyboard
  - OutputFile:     # Save data to file
  - DocSwagger:     # Save to swagger document
  - DocMarkdown:    # Save to markdown document
  - DocSequence:    # Generate to sequence diagram base on comments in code
  ...

Support some tags

!remove             # Remove item array when merge 
!keep               # Not override item in array when merge
!erase              # Delete field in object or item in array
!upload             # Incase upload file

Examples