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.
Смотрите видео How To: Regular Expressions In Postman (2 Min) | Test Assertions онлайн, длительностью часов минут секунд в хорошем качестве, которое загружено на канал Gokce DB 13 Июнь 2022. Делитесь ссылкой на видео в социальных сетях, чтобы ваши подписчики и друзья так же посмотрели это видео. Данный видеоклип посмотрели 1,713 раз и оно понравилось 10 посетителям.