0

I'm using protractor with mocha-allure reporter. In a test, when multiple "expect" statements are there,only the first "expect" statement result gets logged in the report.Please find sample code below

var chai = require('chai');
var chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
var expect = chai.expect;

describe('Allure report for multiple expect', function() {

 it('Check Allure', function(done) {
    expect("first checkpoint").to.equal("is displayed")
    expect("second checkpoint").to.equal("is not displayed")
    expect("third checkpoint").to.equal("is not displayed")
});      

})     

The allure report displays only first failure Allure Report Screenshot

I need all the failures for all the expect statements in the testcase. Is there any way i can achieve this?

Thanks!!

jsan
  • 1
  • 3

1 Answers1

0

Short answer: yes, but only by an own test case for each expectation.

Long answer: It is always a good pattern to only have one expectation per test - as a failing test should tell you exactly what went wrong. To have several expectations in one test case is only useful if they somehow belong together - meaning that if one fails, it doesn't interest you for that moment which other ones fail as they all have a common cause for failure anyways (which you need to adress).

So my suggestion in your case would be to really split them up in three tests.

David Losert
  • 4,652
  • 1
  • 25
  • 31