mercredi 5 décembre 2018

Check date equals yesterdays date using POSTMAN

I'm running a GET request using POSTMAN and the JSON response is below:

{
    "Version": "1.0.524.0",
    "BuildName": "Live",
    "BuildDate": "04/12/2018 18:58:50.85 \r\n"
}

The build date increments by one each day and I want to write a script to check the date has been incremented and if it hasn't then its a failed test. Currently I have this:

pm.test("Check Build Date", function (CheckDate) {
    pm.expect(pm.response.text()).to.include("04/12/2018 18:58:50.85");
});

However I know if I run this script tomorrow it won't work and I will get the following error:

FAIL Check Build Date | AssertionError: expected '{"Version":"1.0.524.0","BuildName":"Live","BuildDate":"05/12/2018 18:58:50.85 \\r\\n"}' to include '06/12/2018 18:58:50.85'

Can anybody assist please?

Aucun commentaire:

Enregistrer un commentaire