Generating Test Data from Models
    • Dark

    Generating Test Data from Models

    • Dark

    Article Summary

    Discover how to Generate Test Data from Models in Test Modeller.

    Defining Test Data at the Model Level

    Test data can be defined in the Test Modeller 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.

    Assigning Variables

    To define test data Variables, open the relevant model and navigate to the Test Data & Automation 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 in/out Flow Parameter" option. 

    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 Variables 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:

    The Data Editor Explained

    You can type Values by hand for each block, or can copy and paste from a test data database or file. Alternatively, the Data Editor enables quick and simply generation of synthetic test data values for each block, using a comprehensive range of data generation functions.

    The Data Editor assigns functions to each Task Block, which are then resolved when test cases are generated. This creates a varied and realistic set of test data for the generated Test Cases, with a range of Values created for each Variables.

    To open the Data Editor, select the block to which a synthetic data variable should be assigned, and select "Assignment" in the Test Data tab of the menu. Next, click "Add" in the Test Data Sidebar, and select the edit button next to the value:

    To generate test data Values using the data generation functions, specify the formula in the Function Editor. Either type the function by hand in the Function Editor box, or browse the Function List and click "Add Function".

    Functions are formatted in the same way as standard Excel formula. They can contain literal text, specified in double quotes, and can be combined into complex formula. Complex formula can contain Excel functions alongside the Test Modeller Functions, combined using the "&" symbol or the VIP "Parse" function.

    Exporting Test Data for Test Automation

    Test Modeller can export test data to Excel Spreadsheets, both separate or flat, and to VIP Outputs and Templates.

    To export the Test Data, click "Tests" to bring up the Test Case sidebar, and click the Test Data icon.

    Data exported to Excel will contain the defined Variables, as well as any static Values and resolvable data functions. Including resolvable data functions in test data means that data driven test automation using VIP is dynamic, rather than static; the functions will be resolved each time a test is executed, ensuring that test data that reflects the latest system under test is used to drive testing.

    Note: The VIP data generation functions require the Excel Data Generation Add-In when used in Excel. Please review the Prerequisites and Installation article for the Excel Add-In for instructions on setting the Excel Add-In up.