Test steps often rely on data parameters, such as menu item names, user names, or numeric values. You can hard-code these values, or parameterize your test cases with different variable values.
- How can I parameterize my test data?
- When to choose which option?
- How to Insert Test Data into tests?
- How to Manage Data Parameters?
- How to Manage Data Entities?
- How to preview test data?
- How to resolve data definition errors?
How can I parameterize my test data?
If you choose to parameterize your tests, you have the following options:
or any combination of these data sources.
When to choose which option?
- If your test data is a list of fixed values, or has dependencies between columns, the best solution is to collect this data in spreadsheet columns and attach the CSV file to the test.
- If you need dynamic test data, generate it synthetically. Generated test data looks like real or random data, but you have full control over its form, and you don't have to collect it yourself. You generate data using Test Data Generator Functions.
- Synthetic test data is advantageous in tests where you need dynamic parameter values, such as relative date stamps ("today" or "last month"), fake but valid credit card numbers, random but plausible names, and so on.
- BlazeMeter additionally helps you avoid invalid values: The included functions don't generate dates such as February 31, names such as asdf%as'df, nor credit card numbers with invalid checksums.
- If you use the CA Test Data Manager product and its Find & Reserve feature, BlazeMeter offers TDM integration to access your TDM F&R Models to load test data from multiple sources.
How to Insert Test Data into tests?
Note: If you are using the GUI Functional Test debugger, click Stop to close the debugger before defining new test data.
- Open a Test and go to the Configuration tab.
- Click Test Data.
A panel with data entities opens on the right side. - Click the Plus sign and create a parameter.
To initialize the parameter, choose one of the following procedures:- Generate Synthetic Test Data
- Load Test Data from Spreadsheets
- Find Test Data from TDM F&R Models
You have now defined a parameter value.
- Click Copy Parameter Name to Clipboard.
The clipboard now contains a string such as ${address}. - Return to the test configuration and edit the appropriate test step. For a GUI Functional test, edit a test step in the Scriptless Editor. For a performance test, edit a HTTP Request field in JMeter.
- Replace a hard-coded value with the pasted parameter.
Example: In a GUI Functional Test, paste the parameter as a value into a test action. - Run the test
BlazeMeter generates test data for the parameter based on your chosen data entities, and replaces parameter values in the test definition with generated values.
How to Manage Data Parameters?
Parameter names have to be unique across all data entities. If two parameters have the same name, one will override the other in an arbitrary order. Therefore, after uploading files, review the loaded parameter names in the Test Data panel, and rename them there if needed.
In the Test Data panel, hover the mouse over a parameter definition to show the editor buttons.
The four buttons have the following functionalities, from left to right:
- Copy Parameter Name to Clipboard so you can paste it easily into the test definition.
- Preview one instance of generated data. Click again to toggle back to the function view.
- Edit this parameter definition to change the parameter name, the function, or its arguments.
- Delete this parameter. If the deleted parameter is in use in a scenario step, the step will break.
How to Manage Data Entities?
GUI Functional tests currently support one data entity only. Performance tests support multiple data entities.
- To add a data entity to a performance test, click Test Data … > Add Data Entity > Create New. Give the data entity a descriptive, unique name.
- To control how many rows of data are used, configure iteration settings.
- To share a data entity with your team, use the Ellipsis menu next to the entity's name and select ... > Save to Workspace or Load From Workspace.
- To make backups, similarly, use ... > Export to File and Import From File. For more information, see How to Share Test Data.
- To view or delete saved data entities, click Test Data … > Data Entities > Manage. Here you can delete data entities from all tests. Verify whether they are unused before deleting them. If no team members have saved any data entities to the Workspace, this window is empty.
For each data entity, use the Ellipsis menu next to its name to manage it:
- Here you can Rename or Remove data entities.
- You can also Download Data As CSV to export it as a spreadsheet and import it, for example, into MS Excel.
Hover the mouse over a CSV file entity in the data entity to access the following buttons:
- Download CSV
- Edit CSV
- Delete CSV
How to preview test data?
Before a test run, you can preview your test data in the Test Data panel by clicking Iterations (for GUI Functional Tests) or Data Settings (for Performance Tests and Mock Services), respectively.
After a test run, go to the History tab, open the test Report, and go to the Summary tab. Under Test Data, click Show Test Data to review which data was used. Here you can also click the Rerun button to run this test again with the same test data, which can be useful for debugging.
How to resolve data definition errors?
No data can be generated as long as there are errors in the data definition. Errors include missing or misspelled arguments of generator functions, missing mandatory values, inappropriate data types (such as entering text where a number is expected), unpaired quotation marks or parentheses, missing files, and so on.
Errors are clearly indicated by the inline validator in the Test Data panel, so you can address each warning immediately. If you have loaded a Data Model that contains multiple errors, an error bar will indicate the number of issues to address before data can be generated. Click the number in the error bar to review a detailed list of detected issues and a description of the error. Then click each listed data parameter or data entity to quickly navigate to the item to fix it.
0 Comments