/APITestUsingMochaJS

API Test (Post and Get using Mochajs)

Primary LanguageJavaScript

API Test Using MochaJS, Supertest and ChaiJS Demo

Introduction

MochaJS is javascript testing framework from Node, In this document I explain how to install and use MochaJS for testing API

Supertest is module that provide the high-level API for testing HTTP

ChaiJS is an assertation library for node and browser. it make test and validation eassier because it can be pair with others javascipt framework and has readable style language.

Installation

install mochaJS

npm install mocha -g --save-dev

more information: http://mochajs.org/#installation

install super test

npm install supertest --save-dev

more information: https://www.npmjs.com/package/supertest

install chaiJS

npm install chai

more information: http://chaijs.com/guide/installation/#nodejs

How to running script

  • Clone source from github
  • Adjust request url (depend on server)
  • run test on terminal npm test
  • If you want to try another scripts, please run script using mocha