Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorial:hybrid_model [2020/12/30 23:06] – [Create State Model] admin | tutorial: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). | ||
- | |||
- | |||
- | ==== Combinatorial Model ==== | ||
- | |||
- | Combinatorial model is typically used to generate test cases to test interactions between/ | ||
- | |||
- | |||
- | ==== 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, | ||
- | * 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 " | ||
- | |||
- | {{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. | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | ==== Add Data Sets to Model ==== | ||
- | Open the state model and select //DATASET// tab. You should see the following: | ||
- | |||
- | {{wiki: | ||
- | |||
- | As shown above, a new data set has been created for us and assigned a default name " | ||
- | |||
- | Let's rename the data set to " | ||
- | |||
- | {{wiki: | ||
- | |||
- | click on the pencil icon to open dataset rename dialog: | ||
- | |||
- | {{wiki: | ||
- | |||
- | Enter new data set name " | ||
- | |||
- | {{wiki: | ||
- | |||
- | |||
- | 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: | ||
- | * CardNum: 4111-1111-1111-1111 (visa), 5500-0000-0000-0004 (master), 6011-0000-0000-0004(Discover), | ||
- | * 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 " | ||
- | |||
- | {{wiki: | ||
- | |||
- | and you should see a variable is added: | ||
- | |||
- | {{wiki: | ||
- | |||
- | Go ahead and enter first variable name " | ||
- | |||
- | {{wiki: | ||
- | |||
- | Note that the default data type is " | ||
- | |||
- | Proceed to add the rest of the variables as below - be sure to set the data type accordingly: | ||
- | |||
- | {{wiki: | ||
- | |||
- | 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 " | ||
- | |||
- | {{wiki: | ||
- | |||
- | Select " | ||
- | |||
- | {{wiki: | ||
- | |||
- | The system generated 25 combinations (rows). | ||
- | |||
- | === Adjustments === | ||
- | You may have noticed that " | ||
- | |||
- | We need to make " | ||
- | |||
- | {{wiki: | ||
- | |||
- | 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 " | ||
- | |||
- | |||
- | ==== Attach Data Set to Transition ==== | ||
- | |||
- | ==== Loop through Data Set ==== | ||
- | |||
- | |||
- | |||
- | |||
- | |||