- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Executing Tests on Cookies in Postman
We can execute Tests on Cookies in Postman. Once a request gets executed for an endpoint, a Response gets generated. Within a Response, the cookie information gets generated under the Cookies tab.
We can add Tests script around cookies and apply Assertions on them for verification. Test scripts are incorporated under the Tests tab. Let us add the below script to verify the value of cookie – Cookie_Postman.
pm.test("Verify Cookie value", function(){ pm.expect(pm.cookies.get('Cookie_Postman')).to.eql('value1')})
Send the Request. After the Response is received, navigate to the Tests tab. It shows the Assertion in our Test script failed as the expected value of the Cookie_Postman is value 1 but the actual value is cookie_Val.
Advertisements