How To: Regular Expressions In Postman (2 Min) | Test Assertions

Published: 13 June 2022
on channel: Gokce DB
1,713
10

In this tutorial, you'll learn how to use regular expressions in test assertions in Postman.


Facebook:   / gokcedbsql  

Video Transcript

Hi guys, this is Abhi from Gokcedb. In this video, you're going to learn how to use regular expressions in test assertions in postman. Let's start by looking at the get URL I'm sending a request to postman echo.com with the query parameters of id equal to one two and three in the tests tab.

On line four, I'm using a regular expression to assert the value of the user-agent key in the headers. Backslash d implies a digit character and backslash d2 in curly braces implies two digit characters. If I change the first digit character from 1 to 2 assertion will fail.

Next, on line 5 I'm asserting that the value of the user dash agent contains 7.29. On line 7 I'm expecting the value of x amazon trace id to match the root equal to the dot start where the dot star implies zero or more characters. On line nine, I'm expecting the value of accept dash encoding to match backslash w four comma backslash w plus comma backslash w plus here backslash w implies a word character and plus implies one or more characters for example if I change one of the backslashes w to backslash d then my assertion will fail.

Finally, on line 10 I'm expecting the value of accept dash encoding to include the word gzip. There you have it. Make sure you like, subscribe, and turn on the notification bell until next time.


Watch video How To: Regular Expressions In Postman (2 Min) | Test Assertions online, duration hours minute second in high quality that is uploaded to the channel Gokce DB 13 June 2022. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 1,713 times and liked it 10 visitors.