Using Regular Expressions in Testim

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 […]

Using Regular Expressions in Testim
By Raj Subramanian, Jun 11, 2019

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/



Related Content

Python Test Automation: Six Options for More Efficient Tests

A few weeks ago, we talked about automating tests. Now it’s time to take a look at six of the best Python test automation tools. The good news is that the Python standard library already includes excellent unit testing tools. You can go a long way toward setting up robust test automation using the language’s […]

Python Test Automation: Six Options for More Efficient Tests

What Is the Software Testing Life Cycle? A Complete Guide

Presenting a perfect product to the customer is the end goal of every organization. But did you know that there was a time when testing wasn’t even a part of the software development life cycle (SDLC)? Nothing puts off customers more than bug-filled user experience. So when enterprises realized this, they began to include testing […]

What Is the Software Testing Life Cycle? A Complete Guide

Why Artificial Intelligence Is the Future of Testing

We’ve already undergone quite a journey to evolve from “classical testing” and test automation to continuous testing. Nevertheless, when we look into the future, it’s clear that even continuous testing won’t be sufficient.  Certainly, digital transformation happens in test automation, as it does in every field. We’ve come from manual testing to a robust automated […]

Why Artificial Intelligence Is the Future of Testing
image/svg+xml Jenkins forward