Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
tutorial:scripting_comb_data_model [2020/07/18 02:26] admin [Model scripting] |
tutorial:scripting_comb_data_model [2021/01/05 03:00] (current) |
||
---|---|---|---|
Line 2: | Line 2: | ||
Learning Objectives: | Learning Objectives: | ||
- | * Model scripting | + | * [[#Model scripting]] |
- | * Activating plugins | + | * [[#Looping DataTable]] |
- | * Looping through DataTable | + | * [[#Activating plugins]] |
- | * Persisting | + | * [[# |
+ | * [[#Remote Execution]] | ||
+ | |||
+ | This tutorial assumes that you are familiar with how to create a Combinatorial Data Model and have created a simple model with at least 2 variables named Field1 and Field2 and have generated the DataTable. | ||
===== Model scripting ===== | ===== Model scripting ===== | ||
Line 12: | Line 16: | ||
//Groovy// script is syntactically very similar to most of programming language that allows you to create classes, functions and basic logic and arithmetic operations. | //Groovy// script is syntactically very similar to most of programming language that allows you to create classes, functions and basic logic and arithmetic operations. | ||
- | Unlike [[tutorial_state_modeling | + | Unlike [[scripting_state_model |
+ | |||
+ | | ||
+ | |||
+ | Run the model, you should see following returned and displayed on [[../ | ||
+ | |||
+ | Total number of rows in DataTable: 10 | ||
+ | |||
+ | |||
+ | ===== Looping DataTable ===== | ||
+ | To perform the testing on all rows in DataTable, you must loop through each row in DataTable ($DATASET.getDataRows()). You can do this with //for// loop: | ||
+ | for (Map< | ||
+ | $DATASET.notifyClient(row); | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | ===== Activating Plugins ===== | ||
+ | Just like [[scripting_state_model | scripting for State Model]], you need to activate plugins to interact with AUT to perform the testing on each row in the DataTable. | ||
+ | |||
+ | For this tutorial, activate //Random// plugin, and modify the script to use // | ||
- | | ||
for (Map< | for (Map< | ||
- | | + | if ($RANDOM.randNum(0,10) > 5) { |
- | | + | |
| | ||
| | ||
Line 23: | Line 45: | ||
else { | else { | ||
| | ||
- | | + | |
} | } | ||
$DATASET.notifyClient(row); | $DATASET.notifyClient(row); | ||
} | } | ||
+ | |||
+ | Make changes to your script to incorporate the plugin function calls and re-run the model. | ||
+ | |||
+ | ===== Exporting results ===== | ||
+ | When running the model in IDE, you can export/ | ||
+ | |||
+ | After model execution completes, you can export the results by menu //File / Export// or {{wiki: | ||
+ | |||
+ | Try the export and review the result file downloaded. | ||
+ | |||
+ | If you are running model remotely using [[../ | ||
+ | |||
+ | |||
+ | ===== Remote Execution ===== | ||
+ | You may run your data model remotely using REST api: | ||
+ | |||
+ | curl -X POST " | ||
+ | |||
+ | Replace " | ||
+ | |||
+ | The output is written to " | ||