在邮递员中,我如何 运行 根据另一个测试是通过还是失败来进行新测试?
In postman, how can i run a new test based on whether another test has passed or failed?
我有两个测试测试 A 和测试 B。只有当 A 通过时,我才希望 B 运行。我怎样才能在邮递员中做到这一点?
pm.test("Status code is 200", function() {
pm.response.to.have.status(200);
});
pm.test("Check if fruits found with this search criteria", function() {
pm.expect(responseData.Message).to.not.eql("No fruits found with this search criteria");
});
我想 运行 只有在这两个测试用例通过时才进行第三次测试。我怎样才能做到这一点?
提前致谢。
您可以简单地嵌套测试:
pm.test("Status code is 200", function() {
pm.response.to.have.status(200);
pm.test("Check if fruits found with this search criteria", function() {
pm.expect(responseData.Message).to.not.eql("No fruits found with this search criteria");
pm.test("Third test", function() {
//pm.expect()...
});
});
});
我有两个测试测试 A 和测试 B。只有当 A 通过时,我才希望 B 运行。我怎样才能在邮递员中做到这一点?
pm.test("Status code is 200", function() {
pm.response.to.have.status(200);
});
pm.test("Check if fruits found with this search criteria", function() {
pm.expect(responseData.Message).to.not.eql("No fruits found with this search criteria");
});
我想 运行 只有在这两个测试用例通过时才进行第三次测试。我怎样才能做到这一点? 提前致谢。
您可以简单地嵌套测试:
pm.test("Status code is 200", function() {
pm.response.to.have.status(200);
pm.test("Check if fruits found with this search criteria", function() {
pm.expect(responseData.Message).to.not.eql("No fruits found with this search criteria");
pm.test("Third test", function() {
//pm.expect()...
});
});
});