Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tutorial:hybrid_model [2020/12/30 22:59] – [Add Data Sets to Model] admintutorial:hybrid_model [2024/01/03 19:54] (current) – removed admin
Line 1: Line 1:
-====== Tutorial: Combined Hybrid Model ====== 
- 
-Learning Objectives: 
-  * Differences between state model and combinatorial model 
-  * Hybrid model 
- 
- 
-===== State Model vs. Combinatorial Model ===== 
-State model and combinatorial model are two most common types of models used in Model-Based Testing (MBT).   
- 
- 
-==== State Model ====  
- 
-State model is used when you can describe the AUT behavior using a state diagram or finite state machine (FSM).  The sequencer is then used to generate test cases (paths from initial state to final states).  
- 
- 
-==== Combinatorial Model ==== 
- 
-Combinatorial model is typically used to generate test cases to test interactions between/among a set of variables.  The algorithm is then used to generate variable permutations to achieve the desired degree of interaction strength. Most commonly used algorithm is Pairwise. 
- 
- 
-==== Which model should I choose? ==== 
-State model focuses on system behavior while combinatorial model focuses on static variable interaction. 
- 
-Often times you may find that in your state model you need to test a set of variable interactions, for example, to test a online web store application, besides testing the navigation between pages, you also need to test all permutations of: 
-  * payment types: visa, master, discover, american express, gift card 
-  * promotion code: no code/blank, 10% discount code, 20% discount code, ... 
-  * product warranty offer: accepted (checked), denied (unchecked) 
-  * shipping methods: 2-day, next-day, same-day (rush) 
- 
-So state model would be good to generate test cases to navigate web pages while combinatorial model would be good to test permutation of various options at check out page. 
- 
-If you find similar situation, the hybrid model by bringing combinatorial model into your state model would allow you to perform both testing in one model. 
- 
- 
-===== Hybrid Model ===== 
-You can embed combinatorial model in a state model as data sets in the state model and reference the data sets in the state model: 
- 
-  * create state model 
-  * add data sets and generate data table 
-  * attach data set to transition or 
-  * loop through data set programmatically in scripts 
- 
- 
-==== 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]]. 
- 
-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. 
- 
- 
- 
- 
- 
- 
- 
- 
-==== Add Data Sets to Model ==== 
-Open the state model and select //DATASET// tab. You should see the following: 
- 
-{{wiki:overview:tut_DataSet_New.png?800}}  
- 
-As shown above, a new data set has been created for us and assigned a default name "NEW_DS_01". 
- 
-Let's rename the data set to "PaymentOptions": hover mouse over the data set name: 
- 
-{{wiki:overview:tut_DataSet_Rename.png?300}}  
- 
-click on the pencil icon to open dataset rename dialog: 
- 
-{{wiki:overview:tut_DataSet_RenameDialog.png?300}}  
- 
-Enter new data set name "PaymentOptions": 
- 
-{{wiki:overview:tut_DataSet_Renamed.png?300}}  
- 
- 
-The data set created has no variables, let's proceed to add variables. 
- 
-=== Add Variables === 
- 
-As stated earlier, the variables we would like to test all combinations of are: 
-  * PaymentType: VISA, MASTER, DISCCOVER, AMERICAN, GIFTCARD 
-  * CardNum: 4111-1111-1111-1111 (visa), 5500-0000-0000-0004 (master), 6011-0000-0000-0004(Discover), 3400-0000-0000-009 (American Express), 2123-222-2123 (gift card) 
-  * PromoCode: blank, 10%OFF, 20%OFF, $5OFF, 15$OFF 
-  * Warranty: true, false 
-  * Shipping: 2 (2-day), 1 (next-day), 0 (same-day) 
- 
-To add a variable click on "+" button: 
- 
-{{wiki:overview:tut_DataSet_AddVar.png?300}}  
- 
-and you should see a variable is added: 
- 
-{{wiki:overview:tut_DataSet_NewVar.png?200}}  
- 
-Go ahead and enter first variable name "PaymentType" in "Name" field and values to be tested in "Domain" field - one value per line as shown below: 
- 
-{{wiki:overview:tut_DataSet_VarPaymentType.png?200}}  
- 
-Note that the default data type is "text", which is good for "PaymentType". 
- 
-Proceed to add the rest of the variables as below - be sure to set the data type accordingly: 
- 
-{{wiki:overview:tut_DataSet_AllVars.png?600}}  
- 
-Click on the orange disk button to save the changes before proceeding to the next step. 
- 
-=== Generate DataTable === 
- 
-To generate the combinations of the variables, select an algorithm from the "Overall Strength" dropdown list on the upper-right corner of the screen: 
- 
-{{wiki:overview:tut_DataSet_selectAlgorithm.png?200}}  
- 
-Select "Pairwise" for now and click the generate button next to it.  You should see the //DataTable// populated with rows of data: 
- 
-{{wiki:overview:tut_DataSet_firstGen.png?600}}  
- 
-The system generated 25 combinations (rows).  Since Pairwise was used to generate the combinations, all pairs of any two variables should be represented by at least one row in the DataTable. 
- 
-=== Adjustments === 
-You may have noticed that "PaymentType" and "CardNum" are messed up, for example, we are seeing payment type of VISA has the non-VISA card number, which is not desired.   
- 
-We need to make "CardNum" variable to match variable "PaymentType". To fix this issue, on variable "CardNumselect select "PaymentType" from the "Coupling" dropdown list as show below and re-generate DataTable: 
- 
-{{wiki:overview:tut_DataSet_secondGen.png?600}}  
- 
-Now the payment types and credit card numbers are matching correctly. 
- 
-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 "CheckOut" transition on the model. 
- 
- 
-==== Attach Data Set to Transition ==== 
- 
-==== Loop through Data Set ==== 
- 
- 
- 
- 
-