Mobile QA Zone

A Mobile Application Testing Community

What is the use of Chai when we are automating using JavaScript for NodeJS applications

Views: 68

Reply to This

Replies to This Discussion

Chai is an assertion library which is used by automation testing services providers for JavaScript automation solutions of NodeJS applications. 

Mostly, Chai is used with combination of Mocha. Here Mocha is used as a testing framework and Chai is used as a Asserting library for the same. 

Chai package can be installed using below command: 

npm install mocha chai

Chai library can be imported using below syntax:

var chai = require('chai').expect;

For Example: 

it('Main Fun',function(){

    request('http://www.google.com', function(err, res){

    expect(res.statuscode).to.equal(404);

}

});

RSS

© 2018   Created by Anurag Khode.   Powered by

Badges  |  Report an Issue  |  Terms of Service

Welcome to Mobile QA Zone, a Next Generation Software Testing Community.Invite your friends to join this community.Write to us to become a featured member.