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

Veröffentlicht am: 13 Juni 2022
auf dem Kanal: 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.


Auf dieser Seite können Sie das Online-Video How To: Regular Expressions In Postman (2 Min) | Test Assertions mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Gokce DB 13 Juni 2022 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 1,713 Mal angesehen und es wurde von 10 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!