Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
tutorial:hybrid_model [2020/12/30 22:58] admin [Add Data Sets to Model] |
tutorial:hybrid_model [2020/12/31 03:10] admin [Generate Test Cases] |
||
---|---|---|---|
Line 45: | Line 45: | ||
==== Create State Model ==== | ==== Create State Model ==== | ||
- | First create a state model with a transition named "checkout", the transition we will use to attach data sets to. If you need help creating the state model, you may refer to [[state_modeling | Create State Model tutorial]]. | + | First create a state model with a transition named "CheckOut", the transition we will use to attach data sets to. |
+ | |||
+ | {{wiki: | ||
+ | |||
+ | If you need help creating the state model, you may refer to [[state_modeling | Create State Model tutorial]]. | ||
You can also use any of your existing state model as well, just select a transition from the model which we will attach the data sets. | You can also use any of your existing state model as well, just select a transition from the model which we will attach the data sets. | ||
Line 129: | Line 134: | ||
Feel free to experiment with other algorithms and compare the # of rows generated in DataTable by different algorithms. | Feel free to experiment with other algorithms and compare the # of rows generated in DataTable by different algorithms. | ||
+ | |||
+ | Next step is to attach this data set to the " | ||
==== Attach Data Set to Transition ==== | ==== Attach Data Set to Transition ==== | ||
+ | |||
+ | In this step, we will attach the data set " | ||
+ | |||
+ | Open the transition properties by double-clicking on the transition label or through transition context menu and select " | ||
+ | |||
+ | {{wiki: | ||
+ | |||
+ | When a data set is attached to the transition, the sequencer that generates test cases from the model will ensure the test cases generates will cover the transition the number of times to loop through all of the rows in the data set. | ||
+ | |||
+ | Save the changes. | ||
+ | |||
+ | ==== Generate Test Cases ==== | ||
+ | |||
+ | Select " | ||
+ | |||
+ | The best way to show this is through {{wiki: | ||
+ | |||
+ | Notice that in {{wiki: | ||
+ | |||
+ | To confirm that each row in data set is used, let's print out the data row as model runs - the test cases generated and executed. | ||
+ | |||
+ | To write a line of script in TRIGGER for transition " | ||
+ | |||
+ | {{wiki: | ||
+ | |||
+ | IDE should navigate to //SCRIPT// tab. Since the TRIGGER for transition " | ||
+ | |||
+ | {{wiki: | ||
+ | |||
+ | Click " | ||
+ | |||
+ | {{wiki: | ||
+ | |||
+ | Alternatively you can add the skeleton TRIGGER script for the transition by pressing Ctrl-I while your cursor is placed on a blank line in //SCRIPT// tab and select transition " | ||
+ | |||
+ | {{wiki: | ||
+ | |||
+ | |||
+ | |||
+ | TRIGGER script is just a //groovy// function, go ahead and add two lines of scripts as show below: | ||
+ | |||
+ | {{wiki: | ||
+ | |||
+ | |||
+ | The " | ||
+ | |||
+ | Save the changes and run the model again, and examine //Script Log// by clicking on the script log button in //RESULT// tab: | ||
+ | |||
+ | {{wiki: | ||
+ | |||
+ | Below is the first few lines from the script log: | ||
+ | |||
+ | | ||
+ | |||
+ | >>> | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | |||
+ | |||
==== Loop through Data Set ==== | ==== Loop through Data Set ==== |