Test data can be defined in the Test Modeller Model Editor, in order to generate test data at the same time as test cases. This creates data with which to execute every test case required to satisfy the level of test coverage specified for the model, testing systems to a sufficient degree of rigour within a given cycle.
Variables and Values
Test data is generated from variables defined at the flow level and values selected at the Task block level.
Test case generation combines the test data Values, creating data for each test step. These test steps are the Task blocks, combined in paths through the model that are equivalent to test cases. You only need to define data in each block in the model once, and it is then created automatically for every test case in which that block occurs.
Values can be assigned to blocks statically, or the Data Editor can be used to assign data generation functions for each block. Test case generation resolves functions specified in the Data Editor as tests are created, generating varied and realistic synthetic data for each set of test cases created.
To define test data Variables, open the relevant model and navigate to the Test Data tab of the menu. Click the "Variables" option:
This will open the Test Data Variables window:
Click "Add Variable" and provide the Variable Name for each new variable in the Data Variable window. You can also assign a Variable Type and Default Value:
Note: If you want a Variable to inform a Rule used during test case generation, you must select the "Expose as Flow Parameter" option. Click "Advanced" and then select the checkbox when creating a Data Variable:
Click "Save" to close the Data Variable window.
Newly created variables appear in the Data Variables window, and can be edited or deleted in future by selecting the cog symbol there. Click "Save" to return to the Model.
Assigning Values to Blocks
Once test data Variables have been created, data Values need to be assigned for every Task block in a model.
Values determine the data that will be created for that block when test cases are generated. They are used to define data at each point in a system's logic, attaching data to each test step (Task block) within a test case (path) generated by Test Modeller.
To assign data, first select the relevant node, and click "Assignment" in the Test Data tab. This will open the Test Data sidebar for a given node. Click "Add" to open the Test Data window:
Select the relevant Variable from the drop-down menu, or click the plus symbol to add a new Variable to associate a Value with for a given block.
Once data Variables and Values have been assigned to each task block, the data can be viewed and edited by selected a block and clicking "Assignment" in the Test Data tab of the Menu. This will open the Test Data sidebar: