Skip to main content

System Testing: Conditionals

Paycheck Requirements

Raleigh’s Parks and Recreation Department hires landscapers to care for and maintain the city’s parks.

Skill Level

An employee has one of three skill levels; each with a hourly pay rate:

Skill Level Hourly Pay Rate ($)
Level 1 $19.00
Level 2 $22.50
Level 3 $25.75

Deductions

All employees may opt in for insurance, which results in a deduction from their pay check.

Deduction Weekly Cost ($)
Option 1 - Medical Insurance $24.50
Option 2 - Dental Insurance $15.30
Option 3 - Vision Insurance $5.25

Employees at skill level 3 may also opt to place up to 6% of their gross pay into a retirement account.

Input

The Paycheck program prompts the user for information about the Employee, including the name, level (1, 2, or 3), hours worked, retirement percent, and whether he or she has medical, dental, and vision insurances. This program assumes a perfect user. There is no error checking for user input based on data type.

Output

The following information is printed about the employee’s pay check:

  1. employee’s name
  2. hours worked for a week
  3. hourly pay rate
  4. regular pay for up to 40 hours worked
  5. overtime pay (1.5 pay rate) for hours over 40 worked
  6. gross pay (regular + overtime)
  7. total deductions
  8. net pay (gross pay – total deductions).

If the net pay is negative, meaning the deductions exceeds the gross pay, then an error is printed.

Testing Strategies

Test Requirements

When testing a program, you should ensure that all of the customer requirements are tested at least once. Our Paycheck program has the requirement that if the net pay is negative, meaning the deductions exceeds the gross pay, then an error is printed. The following test case would test that requirement. The bold text in the description shows the values the tester would enter into the Paycheck program at the given prompts.

Test ID Description Expected Results Actual Results
Boundary regular hours,
All insurances,
Level 1
Preconditions: Paycheck program started
Employee Name: Alice Anderson
Employee Level: 1
Hours Worked: 0
Medical Insurance (Y/N): Y
Dental Insurance (Y/N): Y
Vision Insurance (Y/N): Y
Error Message  

Test Equivalence Classes

There are three main groups of input and output in the Paycheck program: skill levels, insurances, and hours worked. For employees of skill level 3, there is also the equivalence class for retirement. For skill levels, there are equivalence classes for skill level 1, skill level 2, skill level 3, and invalid skill level. For each type of insurance, there are two equivalence classes: having insurance and not having insurance. For hours worked, there are three equivalence class: regular hours, overtime hours, and invalid hours (negative).

Skill Level

Our test of the requirements may also satisfy equivalence classes. The test shown in the previous section satisfies the equivalence class for a skill level 1. We can add other tests for skill levels as shown below. Note that to make a complete test execution, we are also providing input for all user input.

Test ID Description Expected Results Actual Results
Mid-range regular hours,
Two insurances,
Level 1
Preconditions: Paycheck program started
Employee Name: Carol Cole
Employee Level: 1
Hours Worked: 10
Medical Insurance (Y/N): Y
Dental Insurance (Y/N): N
Vision Insurance (Y/N): Y
Name Hours PayRate Regular OT Gross Deduc. Net
Carol Cole 10.00 19.00 190.00 0.00 190.00 29.75 160.25
 
Mid-range regular hours,
Two insurances,
Level 2
Preconditions: Paycheck program started
Employee Name: Carol Cole
Employee Level: 2
Hours Worked: 10
Medical Insurance (Y/N): Y
Dental Insurance (Y/N): N
Vision Insurance (Y/N): Y
Name Hours PayRate Regular OT Gross Deduc. Net
Carol Cole 10.00 22.50 225.00 0.00 225.00 29.75 195.25
 
Mid-range regular hours,
Two insurances,
Level 3,
Boundary retirement
Preconditions: Paycheck program started
Employee Name: Carol Cole
Employee Level: 3
Hours Worked: 10
Medical Insurance (Y/N): Y
Dental Insurance (Y/N): N
Vision Insurance (Y/N): Y
Retirement Percentage (0-6): 1
Name Hours PayRate Regular OT Gross Deduc. Net
Carol Cole 10.00 25.75 257.50 0.00 257.50 32.32 225.18
 

Insurance

The following two tests also test yes and no for each insurance.

Test ID Description Expected Results Actual Results
Mid-range regular hours,
Two insurances,
Level 1
Preconditions: Paycheck program started
Employee Name: Danny D David
Employee Level: 1
Hours Worked: 20
Medical Insurance (Y/N): Y
Dental Insurance (Y/N): Y
Vision Insurance (Y/N): N
Name Hours PayRate Regular OT Gross Deduc. Net
Danny D David 20.00 19.00 380.00 0.00 380.00 39.80 340.20
 
Boundary regular hours,
One insurance,
Level 1
Preconditions: Paycheck program started
Employee Name: Ellen Edwards
Employee Level: 1
Hours Worked: 39
Medical Insurance (Y/N): N
Dental Insurance (Y/N): N
Vision Insurance (Y/N): Y
Name Hours PayRate Regular OT Gross Deduc. Net
Ellen Edwards 39.00 19.00 741.00 0.00 741.00 5.25 735.75
 

Hours Worked

Considering the possible equivalence classes for hours worked other tests of the requirements. For the Paycheck program, we would want at least one middle test that would result in each class. Tests for these equivalence classes are shown below.

Test ID Description Expected Results Actual Results
Mid-range regular hours,
Two insurances,
Level 1
Preconditions: Paycheck program started
Employee Name: Danny D David
Employee Level: 1
Hours Worked: 20
Medical Insurance (Y/N): Y
Dental Insurance (Y/N): Y
Vision Insurance (Y/N): N
Name Hours PayRate Regular OT Gross Deduc. Net
Danny D David 20.00 19.00 380.00 0.00 380.00 39.80 340.20
 
Mid-range overtime hours,
No insurance,
Level 1
Preconditions: Paycheck program started
Employee Name: Hilda Henderson
Employee Level: 1
Hours Worked: 50
Medical Insurance (Y/N): N
Dental Insurance (Y/N): N
Vision Insurance (Y/N): N
Name Hours PayRate Regular OT Gross Deduc. Net
Hilda Henderson 50.00 19.00 760.00 285.00 1045.00 0.00 1045.00
 

Test Boundary Values

The input for hours worked for the Paycheck program has two boundaries. We want to test the boundary of 0 and the values to either side. We also want to test the boundary of 40. Some tests for the boundary are shown below.

Test ID Description Expected Results Actual Results
Boundary regular hours,
Two insurances,
Level 3,
Boundary retirement
Preconditions: Paycheck program started
Employee Name: Bob Baker
Employee Level: 3
Hours Worked: 1
Medical Insurance (Y/N): N
Dental Insurance (Y/N): Y
Vision Insurance (Y/N): Y
Retirement Percentage (0-6): 1
Name Hours PayRate Regular OT Gross Deduc. Net
Bob Baker 1.00 25.75 25.75 0.00 25.75 20.80 4.95
 
Boundary regular hours,
One insurance,
Level 3,
Boundary retirement
Preconditions: Paycheck program started
Employee Name: Ellen Edwards
Employee Level: 3
Hours Worked: 39
Medical Insurance (Y/N): N
Dental Insurance (Y/N): N
Vision Insurance (Y/N): Y
Retirement Percentage (0-6): 5
Name Hours PayRate Regular OT Gross Deduc. Net
Ellen Edwards 39.00 25.75 1004.25 0.00 1004.25 55.46 948.79
 
Boundary regular hours,
One insurance,
Level 3,
Boundary retirement
Preconditions: Paycheck program started
Employee Name: Frank Frankenstein
Employee Level: 3
Hours Worked: 40
Medical Insurance (Y/N): Y
Dental Insurance (Y/N): N
Vision Insurance (Y/N): N
Retirement Percentage (0-6): 6
Name Hours PayRate Regular OT Gross Deduc. Net
Frank Frankenstein 40.00 25.75 1030.00 0.00 1030.00 86.30 943.70
 
Boundary overtime hours,
One insurance,
Level 3,
Mid-range retirement
Preconditions: Paycheck program started
Employee Name: George George
Employee Level: 3
Hours Worked: 41
Medical Insurance (Y/N): N
Dental Insurance (Y/N): Y
Vision Insurance (Y/N): N
Retirement Percentage (0-6): 2
Name Hours PayRate Regular OT Gross Deduc. Net
George George 41.00 25.75 1030.00 38.62 1068.62 36.67 1031.95
 

Testing Materials for Paycheck