Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/ralpheichelberger/api_test_runner

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/ralpheichelberger/api_test_runner

  • v0.0.0-20210512113632-3d068dc3a5e2
  • Source
  • Go
  • Socket score

Version published
Created
Source

API Tester Runner

A simple test runner, thats lets you descripe API test and helps find differences when responses have changed.

The testruns are written as yaml files and have a simple structure.

All test files are located in the sub directory 'tests'.

They have the following structure:

host:
  protocol: <http/https>
  name: <hostname>
  port: <port number>
testrun:
  skip: <true/false>
  name: <name of the testrun>
  description: <description of the testrun>
  tests: <array of tests>
    - request: 
        description:  <description of the test>
        method: GET
        path: <path of the api call and url params>
      response:
        code: <response code e.g. 200 or 404>
        message: <message text>
    - request:
        skip: <true/false>
        id: <int ID of the test>
        description: <description ot the test request>
        method: POST
        path: add_receipt_item
        contenttype: application/json
        body: <JSON request body>
        store: <variable name>
      response:
        description: <description of what is expected as response>
        body: <JSON response string>

With 'store' a JSON result of a request can be provided via mustasch syntax like so:

store: result1
...
body: '{code:"{{result1.code}}"}'

Regular expressions are supported

BUT you need to use 'µ' instead of '[' - I couldn't get JSON an regex working without this substitution hack - any ideas? E.g. "^[0..9]" you need to use "^µ0..9]" - sorry

After testruns are written the api_test_runner can be started with following flags:

-v verbose
    all descriptions, request and response bodies are printed out
-q quiet
    only the results and failed tests are printed out
-r test ID
    Runs only a test with the given test ID. Multiple tests can share the same ID.
-s stop on first error
    stops testing after first failed test

FAQs

Package last updated on 12 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc