Back on the main page
Task from testing courses:  Apply the appropriate test technique(s) for testing the feature.
Domaine Insurance
Feature Life insurance module for the company employees.
The feature description / task You've been assigned to a project for an insurance company. Now your main priority is a life insurance module for the company employees. The life insurance program is provided to all employees. For those who have worked in a company for more than five years, the program costs 150 USD. If an employee has worked for less than five years, it costs 250 USD. Smokers must pay an additional 25% each year. Employees with 10+ years of experience get a 10% discount, and those with 20 years of experience earn a 15% discount.
Insurance can have additional packages:
- Cancer protection: +100 USD
- Family pack: +150 USD
If a person buys car insurance for 50 USD, they get an additional 10% discount. Employees who ordered the insurance previously but missed payments cannot be reinsured.
Applied test techniques 1. Decision table
2. Equivalence partitioning
3. Boundary value analysis
4. Error guessing
5. Pairwise testing
Technique(s):

1. Decision table
I used two tables as conditions from table 2 not influence on conditions from table 1. This approach made it more convenient to divide the conditions, which prevented Table 1 from becoming too large and difficult. I also noted any questions that arose during the process of creating the table, as some points were unclear.

So, I used main program with basic and estimated cost and additional packages with their separate cost. Taking into account all the costs, I have the final total cost.
The notation in Decision tables is as follows: For conditions
- Y means the condition is true,
- N means the condition is false,
- N/A means the value of the condition doesn’t matter,
- the cells also contain meaningful text.

For actions
- Y means the action should occur,
- N means the action should not occur,
- the cells also contain meaningful text.
 
Decision table 1. Main program Rule 1 Rule 2 Rule 3 Rule 4 Rule 5 Rule 6 Rule 7 Rule 8 Rule 9 Rule 10 Rule 11 Rule 12 Rule 13 Rule 14 Rule 15 Rule 16 Questions about requirements
Conditions    
Employee's work experience in a company for basic cost of the Main program < 5 years < 5 years < 5 years < 5 years > 5 years > 5 years > 5 years > 5 years > 5 years > 5 years > 5 years > 5 years > 5 years > 5 years > 5 years > 5 years On what date the work experience should be determined?
What will be the result for exactly 5 years of work?
It is not clearly clear from the task condition.
Employee's work experience in a company for an additional discount N/A N/A N/A N/A <= 10 years <= 10 years <= 10 years <= 10 years 10 <E< 20 years 10 <E< 20 years 10 <E< 20 years 10 <E< 20 years > = 20 years > = 20 years > = 20 years > = 20 years There may be inconsistencies with "10+". Is the "10+" means 10 full years and 1 day?
What is the technical boundary in the code for possible employee experience?
Does the employee smoke? N N Y Y N N Y Y N N Y Y N N Y Y  
Did a person buy car insurance for 50 USD? Y N Y N Y N Y N Y N Y N Y N Y N  
Actions    
Basic cost of the Main program (USD) $250,00 $250,00 $250,00 $250,00 $150,00 $150,00 $150,00 $150,00 $150,00 $150,00 $150,00 $150,00 $150,00 $150,00 $150,00 $150,00 This cost for what period? In a year or a month? Only for smokers is mentioned "25% each year".
Discount for the most experienced employees N N N N N N N N 10% discount 10% discount 10% discount 10% discount 15% discount 15% discount 15% discount 15% discount Is the discounts and extra payment considered relative to the basic cost of the main program (without regard to additional packages)?
This is not clearly specified in the task, but the condition is stated in such a way that there are no instructions for discounts on additional packages.
Calculations are made with the assumption that all discounts are considered only relative to the basic cost of the program and do not effect on additional packages' cost.
However, this issue needs to be clarified further in the requirements and/or from the PO, the customer.
Smokers must pay an additional 25%
each year
N N must pay 25% more must pay 25% more N N must pay 25% more must pay 25% more N N must pay 25% more must pay 25% more N N must pay 25% more must pay 25% more
An additional discount 10 % for car insurance holders 10% discount N 10% discount N 10% discount N 10% discount N 10% discount N 10% discount N 10% discount N 10% discount N
Estimated cost for Main program = $225,00 $250,00 $287,50 $312,50 $135,00 $150,00 $172,50 $187,50 $120,00 $135,00 $157,50 $172,50 $112,50 $127,50 $150,00 $165,00
   
Decision table 2. Additional factors Rule 1 Rule 2 Rule 3 Rule 4 Rule 5 Rule 6 Rule 7 Rule 8 Rule 9
Conditions  
Is the person an employee of the company? N Y Y Y Y Y Y Y Y
Have there been any missed payments for insurance previously by employee? N/A Y Y Y Y N N N N
Does the employee want to buy an additional insurance package? N/A Only Main program Cancer protection Family pack Cancer protection + Family pack N Cancer protection Family pack Cancer protection + Family pack
Actions  
Is it available for a person the life insurance program? N Y Y Y Y Y Y Y Y
Can a person to be
reinsured?
N/A Y Y Y Y N N N N

Final total cost of life insurance for an employee =
N/A Estimated cost for Main program Estimated cost for Main program
+ 100 USD
Estimated cost for Main program
+ 150 USD
Estimated cost for Main program
+ 100 USD
+ 150 USD
Estimated cost for Main program Estimated cost for Main program
+ 100 USD
Estimated cost for Main program
+ 150 USD
Estimated cost for Main program
+ 100 USD + 150 USD
The cost of car insurance for 50 USD not included as we test life insurance program. Discounts in the presence of such insurance are considered in the decision table.
 
Technique(s)
2. Domain testing
 
2.1. Equivalence partitioning We have 2 categories of work experience that can be processed by the system in different ways (for basic coast and for discount).
We can divide the entire category of work experience into equivalence classes to select a date from them.

Equivalence classes for work experience (E):
line:  0 - 5 - 10 - 20 - more years.

More accurate equivalence classes for work experience (E):
1) 0 > E (invalid class)
2) 0 < E < 5 years (What will be the result for exactly 5 years of work? It is not clearly clear from the task condition.)
3) 5 < E <=  10 years
4) 10 < E < 20 years
5) 20 < = E < = more years (open boundary). Additionally, I must ask the developers what technical boundary is set in the code for the possible experience of employees.

Every valid classes from 2 to 5 has four rules in table 1 (further - T1).

We also have other equivalence classes that match the conditions in the decision table:
- smokers are non-smokers
- owners of insurance for a car for $ 50 and not owners
- insured people who have previously made late payments on insurance and paid on time
- holders of various additional insurance packages
2.2. Boundary value analysis The common minimum coverage standard for decision table testing is to have at least one test case per decision rule in the table. This typically involves covering all combinations of conditions.
If the rule's conditions are binary, a single test for each combination is probably sufficient. On the other hand, if a condition is a range of values, consider testing at both the low and high end of the range. In this way we merge the ideas of Boundary Value testing with Decision Table testing.
In this situation choosing test cases is slightly more complex— each rule (vertical column) becomes a test case but values satisfying the conditions must be chosen.

Years are not an indivisible unit.
It is not known exactly how this function will be implemented. For example, it can be the selection of values (radio buttons or other), or the input of a number, or the data is processed automatically and transmitted to the system on request in the exact designation of the number of years and days.

The following options for treating the length of work experience can be selected:
- in years only in integers as indivisible units, e.g. 0, 1, 2, etc. years
- days worked also will be taken into account, e.g. 5 years and 1 day
- years are expressed in decimals,  e.g. 4.99 years.

If we measure work experience exclusively in years as an indivisible value, then it may turn out that an employee who works for example for 6 months has 0 years of work experience. If we perceive a year as a divisible value, then the work experience is 0.5 years (or an equal number of days).
Different options for BVA depending on development design (three values approach as this is a high-risk system), which are not clear from the task conditions: BVA for years only in integers as indivisible units:

1) -1 year (invalid value, work experience cannot be expressed in negative numbers);
2) 0 years (valid), 4 years, 5 years (the reaction of the system is not known now);
3) 6 year; 9 years; 10 years;
4) 11 years; 19 years;
5) 20 years; 21 years; 60 years (approximate logical boundary).

Test cases: 1 (1st class - invalid) + 4 Rules T1 * 3 boundary values (2st class) + 4 Rules T1 * 3 boundary values (3st class) + 4 Rules T1 * 2 boundary values (4st class) + 4 Rules T1 * 3 boundary values (5st class) = 45
BVA if days are taken into account:

1) -1 day (invalid value, work experience cannot be expressed in negative numbers); 0 days (invalid value, because employees have the right to this insurance, and the employee will have at least 1 day of work experience);
2) 1 day; 5 years minus 1 day; 5 years exactly (the reaction of the system is not known now);
3) 5 years plus 1 day; 10 years minus 1 day; 10 years exactly;
4) 10 years plus 1 day; 20 years minus 1 day;
5) 20 years exactly; 20 years plus 1 day; 60 years exactly (approximate logical boundary).

Test cases: 2 (1st class - invalid) + 4 Rules T1 * 3 boundary values (2st class) + 4 Rules T1 * 3 boundary values (3st class) + 4 Rules T1 * 2 boundary values (4st class) + 4 Rules T1 * 3 boundary values (5st class) = 46
BVA for years are expressed in decimals:
1) -0.01 years; 0.00 years (invalid class);
2) 0.01 years; 4.99 years; 5.00 years (the reaction of the system is not known now);
3) 5.01 years; 9.99 years; 10.00 years;
4) 10.01 years; 19.99 years;
5) 20.00 years; 20.01 years; 60.00 (approximate logical boundary).

Test cases: 2 (1st class - invalid) + 4 Rules T1 * 3 boundary values (2st class) + 4 Rules T1 * 3 boundary values (3st class) + 4 Rules T1 * 2 boundary values (4st class) + 4 Rules T1 * 3 boundary values (5st class) = 46
  In final, test cases = 55:
- decision table 1:  46
-  decision table 2:   9
3. Error guessing A methodical approach to the error guessing technique is to create a list of possible errors, defects, and failures, and design tests that will expose those failures and the defects that caused them.

Situations with possible errors, defects, and failures:
- Integration with other modules.
- Determination the date for calculating insurance cost.
- What will happen if the inputs are not in the expected format.
- How the system will react to any changes in the parameters related to the employee to calculate the cost of insurance (will the date for calculation be chosen correctly, will it determine which value to choose correctly):
If the employee resigned and came back after some time, how will the system handle it?
If the employee has changed the status of smoking?
If the status of the owner of the car insurance has changed?
If an employee has made a late payment, how will it be reflected in the system, how will it handle this situation to solve the reinsurance rule?
If the employee has the main insurance and one additional one, and then decides to buy another additional one. Will the system calculate the cost correctly? Will there be an excessive calculation of the cost here?
4. Pairwise testing (possibly, but it's better to choose Decision table for this project and test all combinations;
only as a check of the decision table
)
Pairwise testing is very useful when designing tests for applications that involve multiple parameters. It significantly reduces the number of test cases, but not cover all combinations.
But it is not always correct to use it for complex business rules.
The choice between decision table and pairwise testing for testing the cost of insurance with multiple parameters depends on the testing goals, complexity of parameter interactions, and available resources. If the goal is to identify all possible combinations of parameters that can affect the insurance cost, decision table is a better choice. If the goal is to quickly and efficiently identify errors with minimal tests, pairwise testing is a better choice.
So the decision table should be chosen, because it is important for us to check whether the system performs actions correctly, and the table gives more clarity than pairwise testing.
In this case, pairwise testing will not provide adequate coverage.
  I generated pairs for educational and comparing purposes using https://pairwise.teremokgames.com/.
I can find files with generated report in achieve.
Also I have several screenshots.
16 combinations (all) for Table 1
 
9 combinations (all) for Table 2
 
128 combinations (all) for Table 1 and 2 together
+ 1 test for not employees
 
12 generate Pairwise  The coverage is extremely low.