Skip a property validation in snapshot testing

I am performing snapshot testing using template mentioned here. Postman

For few of the parameters, the response values is dynamic, for example response time.
I want to skip validation for this field, how can I skip it?

For example:
In the below response, I want to skip the validation for response time.

{
 *"responseTime": 23*,
    "payload":[
        {
           "header":{}
        }
    ]
} 

I’m guessing that snapshot testing is checking that the response is identical to a previous saved example. It will check all keys and values.

Have a look at the folder test script that produces this. Its fairly complex and I wouldn’t recommend trying to refactor it to ignore a particular value. If that is even possible. It works against any example from a mock and doesn’t seem to care about what key/values are thrown at it. It will recurse through the mock object and check the request ridgidley against the example. Which is exactly what you would want snapshot testing to do.

If the responseTime value is dynamic, then it doesn’t sound like snapshot testing is an suitable test for this request. You might want to consider JSONSchema tests or another method.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.