我正在测试应用程序,并遇到此错误,我想在脚本中包含此错误,但我不知道如何做。
此错误发生,因为我在正文上输入了错误的变量名,这也是测试过程的一部分。
我想做这样的事情:
pm.test("There was an error in evaluating the test script",
function(){
pm.expect(??.??).to.eql("There was an error in evaluating the test
script: JSONError: Unexpected token '<' at 1:1 <pre class="cake-error">
<a href="javascript:void(0);"
onclick="document.getElem ^");
});
答案 0 :(得分:0)
这可以做到:
const resBody = pm.response.text();
pm.test("There was an error in evaluating the test script", function(){
pm.expect(resBody).to.include("There was an error in evaluating the test script: JSONError: Unexpected token '<' at 1:1 <a href=\"javascript:void(0);\" onclick=\"document.getElem ^");
});