Understanding Decision Table-Based Testing

Slide Note
Embed
Share

Decision table-based testing is a method that utilizes logical decisions to describe various scenarios and impossible combinations of input values. It involves creating a structured table where conditions and actions are defined based on the inputs provided, aiding in the identification of appropriate actions for different input conditions.


Uploaded on Sep 15, 2024 | 1 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. Decision Table- based Testing

  2. Decision Table-based testing Uses logical decisions Includes conditions and describes several different scenarios Describes impossible combinations of input values May not be obvious for all problems 2

  3. Decision Table entries stub condition entries (rules) conditions action entries actions 3

  4. Explanation The top left portion of the table describes conditions One line per input variable For each line in the top left portion, the top right portion describes whether the condition is true or false Each line in the bottom left portion describes an action Each vertical column in bottom right portion indicates what actions to be taken when the corresponding conditions in the top right portion are matching 4

  5. Example - login User provides two inputs username and password Both inputs are validated for format and existence in the data store. Action Invalid entry may be incorrect format or the parameter does not exist Valid entry the user is allowed to login

  6. 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 2 0 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 3 0 3 1 3 2 Conditions Username format is correct T T T T T T T T T T T T T T T T F F F F F F F F F F F F F F F F Username matches with an entry in data store T T T T T T T T F F F F F F F F T T T T T T T T F F F F F F F F Password format is correct T T T T F F F F T T T T F F F F T T T T F F F F T T T T F F F F Password matches with an entry in data store T T F F T T F F T T F F T T F F T T F F T T F F T T F F T T F F Username and password both match an entry in data store Actions T F T F T F T F T F T F T F T F T F T F T F T F T F T F T F T F Login X Error message X X X X X X X X X Impossible X X X X X X X X X X X X X X X X X X X X X X 6

  7. Another Example Given three integers a, b and c representing the sides of a triangle, and the function String typeOfTrinagle (int a, int b, int c) that determines what type of triangle the inputs represent, generate test cases for the function using decision table method. Notice that the three integers may not form a triangle. Use the following conditions to determine whether or not they represent a triangle. a + b > c AND b + c > a AND c + a > b This example is given in Paul Jorgensen s book. 7

  8. 1 2 3 4 5 6 7 8 9 10 11 Conditions a < b + c? b < c + a? c < a + b? a = b? b = c? c = a? Actions Not a triangle Scalene Isosceles Equilateral Impossible F - - - - - T F - - - - T T F - - - T T T T T T T T T T T F T T T T F T T T T T F F T T T F T T T T T F T F T T T F F T T T T F F F X X X X X X X X X X X X - represents a DON T CARE value for a condition 8

  9. Generating test cases One test case per column in the truth table No test cases for impossible situations Every don t care condition generates two test cases, one for T and one for F Don t care entry The condition is irrelevant The condition does not apply Total number of test cases will be less than or equal to the number of columns in the truth table Make sure that all possible outcomes/actions are covered in the test cases 9

  10. Test cases Test case No. a b c Expected output 1 10 5 5 Not a triangle 2 5 10 5 Not a triangle 3 5 5 10 Not a triangle 4 10 10 10 Equilateral triangle or isosceles triangle 5 10 10 15 Isosceles triangle 6 10 15 15 Isosceles triangle 7 15 10 15 Isosceles triangle 8 10 15 20 Scalene triangle 10

  11. Decision Table for f(x1,x2) a<= X1 <=b T T F F c<= X2 <=d T F T F X Compute y Output error X X X 11

  12. Explanation When both input values x1 and x2 are within their ranges (defined by the first column in top right portion), compute y value ( described by the action column in bottom right portion). In all other situations, output an error message 12

  13. Decision Table with dont cares a<= X1 <=b T - F F c<= X2 <=d T F - F X Compute y Output error X X X - indicates don t care 13

  14. Decision Table for f(x1,x2) Extended Version 1 x1 < a T F F F F x1 = a a < x1 <b F T F F F F F T F F x1=b F F F T F x1>b F F F F T - T T T - c<= X2 <=d X X X Compute y Output error X X Exercise: Split the conditions for x2 and expand the table 14

  15. Decision Tables A decision table guarantees a form of complete testing we consider every possible combination of condition values. Decision table is declarative Limited entry decision table all the conditions are binary (true /false, yes/no, 0/1) Extended entry decision table conditions are allowed to have several values. 15

  16. Decision Table-based Testing Identify test cases from decision table Consider conditions as input Consider actions as output Rules are test cases 16

  17. Develop a decision table Decision tables provide a notation that translates conditions and actions into a tabular form. Steps to develop a decision table: List all actions that can be associated with a specific function (or module) List all conditions( or decisions made) during execution of the procedure Associate specific sets of conditions with specific actions, eliminating impossible combinations; alternatively, develop every possible permutation of conditions. Define rules by indicating what action(s) occurs for a set of conditions. 17

  18. Decision Tables The choice of conditions can greatly expand the size of a decision table. When conditions refer to equivalence classes Actions are treatment NextDate: mutually excusive among conditions Don t care entry Without don t care entry, rule counts as 1 With don t care entry, double the rules. 18

  19. Decision Tables Complete the decision table: Redundancy remove the repetition Consistency when don t care entry is used in the decision table and causes the inconsistency, we should take care of the entry. 19

  20. Advantages of Decision table method Covers most of the possible cases Easy to visualize the completeness of the test cases Describe logical relationships between inputs Something that is missing in boundary value analysis and equivalence class testing Possible to identify impossible combinations of inputs A column for which no action is specified Possible to identify inconsistent combinations of inputs Two identical condition entries leading to different action entries 9/15/2024 C-S 342 LECTURE4 20

  21. Another example Generate test cases for the following problem using decision-table method: A student is required to take three exams, for course A, course B and a practicum for course B (let us call it course C). The student will get a pass if he/she gets 50% or more in each of the exams. The student will get a pass if he/she gets 50% or more in A and B, and gets an average of 65% in B and C together. The student will get a pass if he/she gets an average of 75% in all the three courses put together. The student will fail otherwise. 21

  22. Conditions Let A, B and C represent marks in courses A, B and C respectively. There are five conditions: A >= 50 B >= 50 C >= 50 (A+B)/2 >= 65 (A+B+C)/3 >= 75 22

  23. Actions There are two possible actions Pass Fail We also add one more action Impossible 23

  24. Decision table Conditions A >= 50 B >= 50 C >= 50 (B+C)/2 >= 65 T T T T T T T T T T T F T T T F T T F T T T F T T T F F T T F F T F T T T F T T T F T F T F T F T F F T T F F T T F F F T F F F (A+B+C)/3 >= 75 T F T F T F T F T F T F T F T F Actions Pass Fail Impossible x x x x x x x x x x x x x x x x 24

  25. Decision table (continued) Conditions A >= 50 B >= 50 C >= 50 (B+C)/2 >= 65 F T T T F T T T F T T F F T T F F T F T F T F T F T F F F T F F F F T T F F T T F F T F F F T F F F F T F F F T F F F F F F F F (A+B+C)/3 >= 75 T F T F T F T F T F T F T F T F Actions Pass Fail Impossible x x x x x x x x x x x x x x x x 25

  26. Simplified Decision Table Conditions A >= 50 B >= 50 C >= 50 (B+C)/2 >= 65 (A+B+C)/3 >= 75 Actions Pass Fail Impossible T T T - - T T - T - - - - - T T T - F F - F - - F F - - - F F F - - T F - F - T - F F - T x x x x x x x x x 26

  27. A public utility billing system If the customer account is billed using a fixed rate method, a minimum monthly charge is assessed for consumption of less than 100 KWH( kilowatt-hours). Otherwise, computer billing applies a Schedule A rate structure. However, if the account is billing using a variable rate method, a Schedule A rate will apply to consumption below 100 KWH, with additional consumption billed according to Schedule B. 27

  28. Limitation Decision-table method is useful for those applications that include several dependent relationships among the input parameters. For simple data-oriented applications that typically perform operations such as adding, deleting and modifying entries, decision-table method is not appropriate. 28

Related


More Related Content