charles to postman & api monitor & test(BDD)

postman api test, great!!

csdn blog:

https://blog.csdn.net/intbird/article/details/115114486

export:

https://github.com/postmanlabs/postman-app-support/issues/4450

webhooks:

begining:

https://learning.postman.com/docs/writing-scripts/script-references/test-examples/

https://documenter.getpostman.com/view/1559645/RzZFCGFR?version=latest&_ga=2.6372410.947437744.1616396895-1351023426.1616396895

https://www.chaijs.com/api/bdd/

pm.test("response must be valid and have a body", function () {
    pm.response.to.be.ok;
    pm.expect(pm.response.json()).to.a('array');
    pm.expect(pm.response.json()[1]).to.has.property('response');
});


pm.test("response must be valid and have a body", function () {
    pm.response.to.be.ok;
    pm.expect(pm.response.json()).to.a('object');
    pm.expect(pm.response.json()).to.have.any.keys('responseContext');
});


pm.test("start with text ", function () {
    pm.response.to.be.ok;
    pm.expect(pm.response.text()).to.be.a('string').and.satisfy(text => text.startsWith('jsonp2'));
});

pm.expect(response.body.message).to.be.a('string').and.match(/^https:\/\/google\.com\.jp\/news\//i);
expect(response.body.message).to.be.a('string').and.match(new RegExp('^' + escapeRegExp('https://google.com.jp/news/'), 'i'));

  1. charles export curl data

2. import curl data to postman

3. add testing method

4. save request result

5. run monitor

6. check email

7. upgrade free plan