Postman Monitors Test Failed


#1

I have a problem to auto test the collection in Postman Monitor.

For example, The test target like https://mysite.xyz/.

Here is my test code in Postman:

    pm.test("Response time is less than 200ms", function () {
        pm.expect(pm.response.responseTime).to.be.below(200);
    });

    pm.test("Status code is 200", function () {
         pm.response.to.have.status(200);
    });

It can be pasted in Postman client. But failed in Postman Monitor cloud. From the log got these messages:

    4 15:25:48 Error: ESOCKETTIMEDOUT
    5 15:25:48 Failed: Response time is less than 200ms
    6 15:25:48 expected undefined to be a number or a date
    7 15:25:48 Failed: Status code is 200
    8 15:25:48 expected { Object (id, _details, ...) } to have property 'code'

Another way:

    tests["Response time is less than 200ms"] = responseTime < 200;
    tests["Status code is 200"] = responseCode.code === 200;

Got error from Console Log:

|4|15:45:55|Error: ESOCKETTIMEDOUT|
|5|15:45:55|Failed: Response time is less than 200ms|
|6|15:45:55|expected false to be truthy|
|7|15:45:55|Failed: Status code is 200|
|8|15:45:55|expected false to be truthy|

Have already choosed Disable SSL validation in setting page.

Don’t know why.


#2

Is your target URL available publicly? For a monitor to run correctly, the URL needs to be public.


#3

The Test Results can passed:

45

It’s public.