mocha-test-url
Easy to test running on Node.js
Installation
Require
Node >= 8
Install through NPM mocha, chai and chai-http
npm install mocha
npm install chai
npm install chai-http
Next step install mocha-test-url
npm install mocha-test-url
In package.json
"scripts":
Usage
var testUrl = ; /* -------------- Setup Server -------------- */ testUrl;testUrl; ;
npm run test-permission
Setup
Setup host and path user login
testUrl;testUrl; // method post
Setup Header
testUrl;
Setup user login
Setup in before() after testUrl.addUser('Guest');
testUrl;
Setup group and url
First you will setup group
testUrl;
Next setup url and permission
testUrl;
Setup running
Setup in after()
testUrl;
or
testUrl;
Preference
checkStatusCode
checkStatus (status)
- Number check the number with status codecheckJSON (status, hasValue, value)
- Number, String, String check the number with status code, hasValue check key in return type and value (optional) check valuecheckDataAndStatus (status, hasMessage)
- Number, String check the number with status code and hasMessage check text in data returncheckCustom (customFunction)
- Function use custom function to check data customFunction have 2 parameter headerStatus,dataPageReturn. When error use functionassertError(String)
to return false
Example
testUrl;