With the latest version of the mabl Desktop App, you can now use partial string matching when asserting on filenames in download assertions!
Previously, download assertions only supported exact filename matching. To work around this, you either had to store the filename in a variable or remove the filename assertion entirely. With partial string matching, you can assert the predictable portion of a filename. For example, if filenames always start with results_ and finish with a unique ID, you can assert that the filename starts with results_.
The following partial match modes are available:
- contains - matches if the filename includes the specified text
- starts with - matches the beginning of the filename
- ends with - matches the end of the filename
- matches regex - matches against a regular expression
Try it out
To get started, update the mabl Desktop App to version 2.46.1 or later. Then, in the Trainer:
- Record or navigate to a download assertion step.
- Click Edit assertion.
- Use the Match file name by dropdown to select a match mode.
- Enter the value you want to match against.
- Add any other assertions on metdata or content, and you’re all set!
matches regex
Use JavaScript regular expression syntax for matches regex assertions.
Note that if no forward slashes are provided, mabl defaults to case-insensitive matching for filename assertions to ensure better compatibility across different file systems. This configuration differs from regex match in other assertion types, which are case-sensitive by default.
Learn more
To learn more, see the article on download assertions.