When you author a browser test, you can now create a file from a template, with new values filled in on every run. Use it to test imports that require different file content each time:
- Unique data: some apps reject data they already have, such as policy reference numbers in a spreadsheet or CSV.
- Data from the test: some user journeys require a file to reference something that the test just created, such as the ID of a new account.
Template files contain placeholders, such as {{@policyReference}}, where the values go. Your test sets the values for those variables and fills them into a copy of the template file, which you can upload in a later step. In addition to Excel spreadsheets and CSVs, template files can be JSON or XML files.
Try it out
To get started, create your template file. For example, open the spreadsheet your app imports and type {{@policyReference}} in the cell where the policy reference goes.
Then, in the latest version of the mabl Desktop App, open the Trainer and take the following steps:
- Add the template file to the test as a file variable: {x} > Manage variables > Data-driven variables > New file variable.
- In the test steps, set each variable that the template file references. For example, create a string template variable named
policyReferencewith the valuePOL-{{alnum:8}}. - Click {x} > Create a variable, set Set variable using to "File from template," and select your template file from the Template file variable list. mabl saves the filled-in copy as a new file variable.
- Add a file upload step, select File variable as the file source, and select the new file variable.