Created
July 27, 2017 19:22
-
-
Save JamesMessinger/ad0746045e29497e1b1e22f8fa9ae39b to your computer and use it in GitHub Desktop.
Postman BDD example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('Get customer info', () => { | |
it('should return a valid response', () => { | |
response.should.have.status(200); | |
response.should.be.json; | |
response.body.should.not.be.empty; | |
}); | |
it('should set the Location header', () => { | |
response.should.have.header('Location'); | |
}); | |
it('should match the customer schema', () => { | |
var customerSchema = JSON.parse(environment.customerSchema)); | |
response.body.should.have.schema(customerSchema); | |
}); | |
it('should return the correct customer', () => { | |
response.body.id.should.equal(12345); | |
response.body.age.should.be.above(18).and.below(99); | |
response.body.firstName.should.be.a('string').and.not.empty; | |
response.body.lastName.should.be.oneOf(['Smith', 'Jones', 'Robinson']); | |
}); | |
}); |
See the Postman documentation for examples of their new test syntax:
https://learning.postman.com/docs/writing-scripts/script-references/test-examples/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Excuse me, but how to use the Postman's BDD own syntax? Is there something different? Where can I find the documentation of it? TIA.