API Testing Using Postman Part 15: How to write API test cases in Postman using JavaScript

Published: 01 October 2021
on channel: Testing Tutorialspoint
721
16

Pre-req:
const moment = require('moment');

pm.collectionVariables.set("todayDate",moment().format("YYYY-MM-DD"));

pm.collectionVariables.set("todayDate1",(new Date()).toISOString());

pm.collectionVariables.get("todayDate1");

pm.collectionVariables.set("Name","morpheus");

pm.collectionVariables.set("Job","leader");

Tests Code:

var jsonData = pm.response.json();

pm.test("varify name", function(){
pm.expect(jsonData.name).to.eql("morpheus");
});

pm.collectionVariables.set("ID",jsonData.id);


On this page of the site you can watch the video online API Testing Using Postman Part 15: How to write API test cases in Postman using JavaScript with a duration of hours minute second in good quality, which was uploaded by the user Testing Tutorialspoint 01 October 2021, share the link with friends and acquaintances, this video has already been watched 721 times on youtube and it was liked by 16 viewers. Enjoy your viewing!