Agile

Using Regular Expressions in Testim

Google+ Pinterest LinkedIn Tumblr

Testim gives you the flexibility to add regular expressions (RegEx) to help in easier string searching and validations.  It is extremely helpful in extracting required information from a web page or when there is a need to validate strings that has a portion of it changing dynamically.

For Example – Say you want to validate the label  “Price” in the below page.

The price value is going to change dynamically based on the itinerary booked; every time you run the test. So, if you want to ensure the label “Price” is displayed correctly in the page no matter what the price value maybe, RegEx can be of great help here.

You could add /^Price/ in the Expected Value Field in the properties panel of the Test Step; within Testim.  What this does is, it validates whether the text starts with the word “Price”, allowing the rest of the text to be dynamic and still pass the validation.

Commonly used RegEx and their syntax are as follows-

More references on how to use RegEx can be found below-

https://docs.testim.io/advanced-steps/advanced-text-validations

https://www.w3schools.com/jsref/jsref_obj_regexp.asp

https://regexone.com/



Raj Subramanian a former developer, moved to testing to focus on his passion. Raj currently works as a Developer Evangelist for Testim.io, that provides AI based software testing solutions for clients. He actively contributes to the testing community by speaking at conferences, writing articles, blogging, making videos on his youtube channel and being directly involved in various testing-related activities. He currently resides in Chicago and can be reached at raj@testim.io. His website is www.rajsubra.com and twitter handle – @epsilon11. His videos on testing, leadership and productivity can be found here – http://www.rajsubra.com/my-youtube-channel/

Be smart & save time...
Simply automate.

Get Started Free