Replies


  • Assertions are used to validate whether the test script is working as expected or not in software testing solutions. Mocha provides built-in Assert class having multiple API that are used in software quality assurance services. Most commonly used API's include: assert.equal(actual, expected[, message]), assert.notEqual(actual, expected[, message]), assert.strictEqual(actual, expected[, message])

    Apart from this, most widely used API for assertion is Chai. It is easy to install: npm install chai

    The basic assertions used with chai library includes:
    a) Should -- To verify that specific condition should be working fine
    Exampls:
    var sould = chai.should;
    foo.should.be.a('string');
    foo.should.equal('bar');
     
    b) Expect -- expect the specific text to have certain properties
    var expect = chai.expect;
    expect(test).to.be.a('string');
    expect(test).to.have.property('flavors').with.lengthOf(3);

    c) Assert -- To verify whether expected and actual values are same, expected value is true, specific condition matched the expected value
    var assert = chai.assert;
    assert.equal(testText, 'bar');
    assert.lengthOf(test.flavour, 3);

    The Best Software Testing Services Company - QASource
    Partner with the leading software testing company, QASource, and accomplish all your software testing goals within strict deadlines and budget. We pr…
This reply was deleted.
    results->result as $result) { ?>
  1. jobtitle;?>
    company;?>(formattedRelativeTime;?>)city;?>, state;?>
    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.