Giter VIP home page Giter VIP logo

rathorsunpreet / anotherapitestinterface Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 59 KB

A CLI for test suites written for Mocha with the possibility of using any node based test runner.

License: MIT License

JavaScript 98.98% HTML 1.02%
chai javascript mocha mocha-chai mocha-testing mocha-tests mochajs mochawesome mochawesome-report supertest supertest-mocha-chai json5 template ui api-test api-testing api-tests

anotherapitestinterface's Introduction

Another API Test Interface

Another API Test Interface is, the successor of Simple API Test Interface, an API Test Interface which uses command-line arguments or format-specific JSON files supplied during the execution to perform certain actions.

This interface allows users:

  • to create multiple test suites or singular test cases
  • execution of all test suites or a single suite
  • report generation of the executed suite(s)
  • ease of execution of complex commands or a lengthy command via the use of templates
  • ability to change directories/folders of necessary components like location of test suite(s)
  • automatic update of available test suite(s)
  • creation of templates made easy by the use of command 'savetemplate'

The API used in this project is Reqres.in.

Demo/Usage/Installation: https://www.youtube.com/watch?v=QZXw-YRT838

Installation

Download the package from Github and unzip it.

# Installs dependencies
npm install

# If the above does not work, then
npm install --only=dev

Usage

The project allows for the following commands to be used:

  • env - Sets the environment to use
  • site - Sets the site to use
  • token - Sets the authorization token to use
  • display - Displays the non-commands lists/objects used
  • excludefiles - Comma-separated list of suite(s) to exclude during execution
  • runner - Sets the Node Runner to use
  • templatename - Sets the template to load
  • templatedir - Sets the location of templates
  • suitedir - Sets the location of test case(s) or suite(s)
  • datafile - Sets the location of user-defined data
  • currentsuitelist - List of test suites to execute, used inside templates
  • help - Show this message
  • list - Display the list of valid test suite(s) or case(s)
  • report - Generate a HTML Report upon execution of test suite(s) or case(s)
  • savetemplate - Save the current arguments in a JSON template
  • env=site - Compound command which executes 'env' and 'site' in consecutive order

The keyword 'all' can be used to signal the inclusion of all test suite(s) / case(s). 'all' is considered invalid when used with 'excludefiles' command.

# To view the help message
npm run test help

# To view the list of available suites
npm run test list

# To execute test suite(s)
npm run test users registration

# To generate HTML report
npm run test users report registration

Templates

Templates are commmand line arguments saved in a JSON file. The structure of a template is as follows:

{
  commands: {
    all commands here such as 
    env: prod,
    excludefiles: [
      file1,
      file2
    ]
  },
  currentsuitelist: [
    all suite(s) / case(s) names here such as
    file1,
    file2
  ]
}

For the commands that do not take a value such as 'report', simply use the following method to write it under 'commands' object:

  report: true

A false value is simply ignored.

If a template name is provided along with command-line arguments, then the preference is given to command-line arguments. This means that command-line arguments are executed and if a template equivalent is present then that is simply skipped.

License

MIT

anotherapitestinterface's People

Contributors

rathorsunpreet avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.