So far, we have covered creating and tagging the automation code with the associated test data allocations manually. Test Modeller can be used to automatically create this code with the appropriate method calls embedded to execute associated data allocations and consume the resolved results within each associated automation parameter. To do this you must first create a model with both automation and test data allocations overlaid.
Once you have a model with the test data and automation you can click the execute button within the test cases side-bar below. Click here to learn more about test case generation.
Once execute has been clicked, the export dialog should be displayed. Here you can specify the server, process, code template, and allocation pool to use. The code template ‘Java Allocation’ contains the appropriate code snippets to construct java allocation code for TestNG (as defined manually above). If the actions below do not appear in your automation server you may need to add data allocation to your server. If your framework is not using our out-the-box TestNG code, you can edit and create custom code templates.
Click the execute button to run the code generator. A first pass is made to perform an initial allocation and create the associated tests within the data catalogue allocation pool selected. After this the associated code is created referencing the created tests within the associated allocation pools selected.
Once the generation is complete a screen will appear with a status of complete and the ability to download a Result.zip file.
Before downloading the created ‘results.zip’ file it is useful to look at the allocation pool you have selected. Here you should see the allocation pool has been populated with the associated test types, along with the initial allocated values.
Within the code folder there is a java file which contains the code definition. Open this file within a text editor to inspect the corresponding java test definition with data allocations generated.
Below is a screen capture of example code file generated. Pay particular attention to the embedded @DataAllocation tag referencing the data pool, test suite, and test cases, along with the appropriate DataAllocationResult objects embedded in the appropriate automation actions by getting the values by column indexes.