Group of expect

tests

#1

Hi
i would like to know if is possible to group more than one expect on pm.test and take message error for all these that are failed .

var expect = require('chai').expect
  , foo = 'bar'
  , beverages = { tea: [ 'chai', 'matcha', 'oolong' ] };

 pm.test("Last Value property 3 ", function () { 
    expect(foo,"last1").to.be.a('string');
    expect(foo,"last2").to.equal('bar');
    expect(foo,"last3").to.have.lengthOf(3);
    expect(beverages,"beverages").to.have.property('tea').with.lengthOf(3);
});

The above code work correctly because all the 4 expect are true
but if we run the below code

pm.test("Last Value property 3 ", function () {
expect(foo,“last1”).to.be.a(‘error1’);
expect(foo,“last2”).to.equal(‘error2’);
expect(foo,“last3”).to.have.lengthOf(3);
expect(beverages,“beverages”).to.have.property(‘texxa’).with.lengthOf(223);
});

we take test result error only for the first failed assertion

Last Value property 3 | AssertionError: last1: expected ‘bar’ to be an error1


#2

What is a real world use case for this? Normally in testing you would want granularity to know what exactly was broken. It allows for more transparency and quicker de-bugging.

In a perfect world, 1 test = 1 assert.