How to use Text Matching to Test Dynamic Scenarios

Learn how to use text matching to test dynamic scenarios


Text matching under a mask allows a user to verify specific text within a screenshot that is predictable but can change from run to run. For example, you can verify that a message at the end of a sign-up flow says “Welcome first name” even if “first name” will change from run to run using the {{random.first_name}} built-in data generator.

How it Works

Rainforests optical character recognition (OCR) system will be used to verify specific content including any assigned test data values. When a step with text matching is in a run, Rainforest will:

  • Search for the unmasked area of the screenshot on the page.
  • If a match is found, Rainforest OCR’s any text in the masked area
  • Search for the target text including any assigned data values within the OCR’d text
  • If a perfect match is found the step will pass.

How to Add Text Matching

  1. Add Text Matching to any UI element with a mask. Use the mask to define the dynamic area of a screenshot. If Text Matching is added to that masked area, Rainforest validates the dynamic text within that area matches the specific assigned value for that run.
  1. Set a text match using test data or a string of data. Use built-in test data (ex. {{random.first_name}}) or upload dynamic/static test data to use for verification.
    • An example of a string of data could be set a text match to “Welcome”. Where you have typed out Welcome and {{}} is part of a dynamic data set.

How to Update a Text Match

  1. Review why steps passed or failed on text matching from:
  • Preview: open the console to watch automation at work as you preview steps with text matching enabled
  • Automation logs: Rainforest record the logs that explain exactly when automation searched for specific content
  • The investigate step page: On step details page Rainforest explains why the step passed or failed.
  • The run page: you can see if a test failed due to Text Matching like you would verify screenshot details on this page.
  1. Update your screenshots or UI elements from test results:Directly edit UI elements from results. Change the screenshot, masked area, or text match from the investigate step page without going into the editor


Can text matching be used on any element type?

If a mask can be added, text matching can be used (i.e. if there’s a screenshot with text, you can use text matching).

If you have any questions, reach out to us at [email protected].

Related Articles & Links