0

I am testing the application and face this error, I want to include this error in my script but I don't know-how.

This error happens because I write the wrong variable name on the body, and is also part of the process to test.

I want to do something like that:

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 ^");
});
nahidf
  • 2,260
  • 1
  • 15
  • 22

1 Answers1

0

This will do it:

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 ^");
});
Christian Baumann
  • 3,188
  • 3
  • 20
  • 37