Testcover.com 1 Functional Dependence and Equivalence Class Factors in Combinatorial Test Designs George B. Sherwood Copyright © 2014 Testcover.com, LLC. All rights reserved.
Testcover.com 2 This talk is about: Evaluation of test design coverage before test case generation – Partition includes test case generation combinations – Equivalence class includes expected result combinations – Typically a partition spans multiple equivalence classes – Formulas for equivalence class coverage Design choices to improve coverage – Use increased generation strength t – Align partitions with equivalence classes as needed Copyright © 2014 Testcover.com, LLC. All rights reserved.
Testcover.com 3 Body mass index report requirements R1. Input data for patient database table: Age in years Weight in pounds Height in inches Sex (female, male) Intake in kilocalories per day R2. Compute & store body mass index: BMI = 703 x Weight / Height 2 R3. Age ≥ 65: Generate Medicare report Copyright © 2014 Testcover.com, LLC. All rights reserved.
Testcover.com 4 Body mass index report requirements continued R4. Age < 20 Generate Child report: Girl, percentile from female BMI-age table Boy, percentile from male BMI-age table R5. Age ≥ 20 Generate Adult report: Underweight, BMI < 18.5 Normal, 18.5 ≤ BMI < 25.0 Overweight, 25.0 ≤ BMI < 30.0 Obese, 30.0 ≤ BMI Copyright © 2014 Testcover.com, LLC. All rights reserved.
Functional dependence 5 Mapping from a determinant set to one element in a dependent set Examples: y = sin( x ) US postal address index → ZIP code l -tuple → m -tuple BMI = 703 x Weight / Height 2 determinant factor values → functionally dependent factor values Testcover.com Copyright © 2014 Testcover.com, LLC. All rights reserved.
Testcover.com 6 Functionally dependent test factors A test factor is functionally dependent when its value is identified by l determinant factors Example: BMI is determined by l = 2 factors, Weight & Height Weight, Height → BMI Independent factors which are not part of this relation are nondeterminant Example: n = 3 nondeterminant factors, Age, Sex & Intake Copyright © 2014 Testcover.com, LLC. All rights reserved.
Testcover.com 7 Equivalence classes Equivalence classes group test factor combinations by similar expected results Example: Age ≤ 0 leads to invalid, error handling class Classes help insure test design coverage Example: The Medicare, Child and Adult reports each have multiple, valid equivalence classes ReportValid equivalence classes Medicare noyes Child nogirlboy Adult nounderweightnormaloverweightobese Copyright © 2014 Testcover.com, LLC. All rights reserved.
Testcover.com 8 Equivalence classes are functionally dependent Age, Weight, Height→ Adult classes32 Input, configuration values→ result → equivalence class Equivalence class factor examples: ln Age→ Medicare classes14 Age, Sex→ Child classes23 Equivalence class factor values Factors for test case generationFactors determined from test cases Independent input factorsFunctionally dependent factors AgeWeightHeightSexIntakeMedicareChildAdult female 2000 nogirlno male 3000 yesnonormal Copyright © 2014 Testcover.com, LLC. All rights reserved.
9 Combinations to reach equivalence classes – Medicare Input factorsEquivalence class factors DeterminantNondeterminant Functionally dependent AgeWeightHeightSexIntakeMedicareChildAdult 42 no 67 yes Testcover.com Combinations to reach equivalence classes – Child Input factorsEquivalence class factors DeterminantNondeterminantDeterminant Non- determinant Functionally dependent AgeWeightHeightSexIntakeMedicareChildAdult 19 femalegirl 19 maleboy 42 or 67 no Combinations to reach equivalence classes – Adult Input factorsEquivalence class factors DeterminantNondeterminant Functionally dependent AgeWeightHeightSexIntakeMedicareChildAdult 19 no 42 or normal 42 or underweight 42 or obese 42 or overweight Determinant coverage Copyright © 2014 Testcover.com, LLC. All rights reserved.
Testcover.com 10 Adult report classes 71 in 64 in 131 lb 180 lb Copyright © 2014 Testcover.com, LLC. All rights reserved.
Functionally dependent factor j – Child Input factorsEquivalence class factors DeterminantNondeterminantDeterminant Non- determinant Functionally dependent AgeWeightHeightSexIntakeMedicareChildAdult Nondeterminant subarray J – Child Input factorsEquivalence class factors DeterminantNondeterminantDeterminant Non- determinant Functionally dependent AgeWeightHeightSexIntakeMedicareChildAdult Nondeterminant coverage 11 Nondeterminant factors provide coverage unrelated to the functional dependence A nondeterminant subarray J consists of a functionally dependent factor and its n nondeterminant factors. Example: J has nondeterminant strength s when every subarray of s factors including the functionally dependent factor has every s -tuple in at least one test case. Example: When s = 3 each pair of nondeterminant factor values is associated with each Child equivalence class. Testcover.com Copyright © 2014 Testcover.com, LLC. All rights reserved.
Test cases from one strength-4 partition for multiple equivalence classes – Child Input factorsEquivalence class factorsAn expected result DeterminantNondeterminantDeterminant Non- determinant Functionally dependent Test CaseAgeWeightHeightSexIntakeMedicareChildAdultBMI female2000nogirlno male3000noboyno female3000nogirlno male2000noboyno female3000nogirlno male2000noboyno female2000nogirlno male3000noboyno female3000no normal22.5 … Test cases from one strength-4 partition for multiple equivalence classes – Child Input factorsEquivalence class factorsAn expected result DeterminantNondeterminantDeterminant Non- determinant Functionally dependent Test CaseAgeWeightHeightSexIntakeMedicareChildAdultBMI female2000nogirlno male3000noboyno female3000nogirlno male2000noboyno female3000nogirlno male2000noboyno female2000nogirlno male3000noboyno female3000no normal22.5 … Test cases from one strength-4 partition for multiple equivalence classes – Child Input factorsEquivalence class factorsAn expected result DeterminantNondeterminantDeterminant Non- determinant Functionally dependent Test CaseAgeWeightHeightSexIntakeMedicareChildAdultBMI female2000nogirlno male3000noboyno female3000nogirlno male2000noboyno female3000nogirlno male2000noboyno female2000nogirlno male3000noboyno female3000no normal22.5 … Test cases from one strength-4 partition for multiple equivalence classes – Child Input factorsEquivalence class factorsAn expected result DeterminantNondeterminantDeterminant Non- determinant Functionally dependent Test CaseAgeWeightHeightSexIntakeMedicareChildAdultBMI female2000nogirlno male3000noboyno female3000nogirlno male2000noboyno female3000nogirlno male2000noboyno female2000nogirlno male3000noboyno female3000no normal22.5 … Test cases from one strength-4 partition for multiple equivalence classes – Child Input factorsEquivalence class factorsAn expected result DeterminantNondeterminantDeterminant Non- determinant Functionally dependent Test CaseAgeWeightHeightSexIntakeMedicareChildAdultBMI female2000nogirlno male3000noboyno female3000nogirlno male2000noboyno female3000nogirlno male2000noboyno female2000nogirlno male3000noboyno female3000no normal22.5 … 12 Age, Sex → Child classes s = t - l + 1 = = 3. All pairs of nondeterminant factor values are associated with each Child class. s ≤ n + 1 because there are n + 1 columns in the subarray. Testcover.com Copyright © 2014 Testcover.com, LLC. All rights reserved. Nondeterminant strength formula s = t - l + 1
Coverage formulas 13 Multiple equivalence classes – Coverage depends on l Example: t ≥ 3 to reach all classes; choose t = 3 Medicare classes: l = 1; s = 3 Child classes: l = 2; s = 2 Adult classes: l = 3; s = 1 (coverage problem) One equivalence class – Coverage is independent of l Example: any strength to reach one class; choose t = 2 s = 3 for each class in its own partition Partition contains Strength to cover equivalence class(es) Nondeterminant strength multiple values for an equivalence class factor t ≥ l s = t – l + 1, s = n + 1, t ≤ l + n t ≥ l + n Testcover.com one value for an equivalence class factor any s = t + 1, s = n + 1, t ≤ n t ≥ n Copyright © 2014 Testcover.com, LLC. All rights reserved.
14 One strength-3 partition for multiple equivalence classes – Medicare Input factorsEquivalence class factorsAn expected result DeterminantNondeterminant Functionally dependent Test CaseAgeWeightHeightSexIntakeMedicareChildAdultBMI female 2000 nogirlno male 3000 noboyno male 2000 noboyno female 3000 nogirlno female 2000 nogirlno male 3000 noboyno female 2000 no normal male 3000 no normal female 3000 no underweight male 2000 no obese female 2000 no overweight male 3000 no overweight female 2000 yesnonormal male 3000 yesnonormal female 3000 yesnounderweight male 2000 yesnoobese female 2000 yesnooverweight male 3000 yesnooverweight25.1 Age → Medicare classes s = t - l + 1 = = 3. All pairs of nondeterminant factor values are associated with each Medicare class. Testcover.com Copyright © 2014 Testcover.com, LLC. All rights reserved.
15 One strength-3 partition for multiple equivalence classes – Child Input factorsEquivalence class factorsAn expected result DeterminantNondeterminantDeterminant Non- determinant Functionally dependent Test CaseAgeWeightHeightSexIntakeMedicareChildAdultBMI female 2000 nogirlno male 3000 noboyno male 2000 noboyno female 3000 nogirlno female 2000 nogirlno male 3000 noboyno female 2000 no normal male 3000 no normal female 3000 no underweight male 2000 no obese female 2000 no overweight male 3000 no overweight female 2000 yesnonormal male 3000 yesnonormal female 3000 yesnounderweight male 2000 yesnoobese female 2000 yesnooverweight male 3000 yesnooverweight25.1 Age, Sex → Child classes s = t - l + 1 = = 2. All nondeterminant factor values are associated with each Child class. Testcover.com Copyright © 2014 Testcover.com, LLC. All rights reserved.
16 One strength-3 partition for multiple equivalence classes – Adult Input factorsEquivalence class factorsAn expected result DeterminantNondeterminant Functionally dependent Test CaseAgeWeightHeightSexIntakeMedicareChildAdultBMI female 2000 nogirlno male 3000 noboyno male 2000 noboyno female 3000 nogirlno female 2000 nogirlno male 3000 noboyno female 2000 no normal male 3000 no normal female 3000 no underweight male 2000 no obese female 2000 no overweight male 3000 no overweight female 2000 yesnonormal male 3000 yesnonormal female 3000 yesnounderweight male 2000 yesnoobese female 2000 yesnooverweight male 3000 yesnooverweight25.1 Age, Weight, Height → Adult classes s = t - l + 1 = = 1. Some nondeterminant factor values might not be associated with each Adult class. Neither male nor 2000 is associated with the underweight class. Testcover.com Copyright © 2014 Testcover.com, LLC. All rights reserved.
17 One strength-4 partition for multiple equivalence classes – Adult Input factorsEquivalence class factorsAn expected result DeterminantNondeterminant Functionally dependent Test CaseAgeWeightHeightSexIntakeMedicareChildAdultBMI female2000nogirlno male3000noboyno female3000nogirlno male2000noboyno female3000nogirlno male2000noboyno female2000nogirlno male3000noboyno female3000no normal male2000no normal female2000no underweight male3000no underweight female2000no obese male3000no obese female3000no overweight male2000no overweight female2000yesnonormal male3000yesnonormal female3000yesnounderweight male2000yesnounderweight female3000yesnoobese male2000yesnoobese female2000yesnooverweight male3000yesnooverweight25.1 Age, Weight, Height → Adult classes s = t - l + 1 = = 2. All nondeterminant factor values are associated with each Adult class. Testcover.com Copyright © 2014 Testcover.com, LLC. All rights reserved.
One strength-2 partition for multiple equivalence classes – Medicare Input factorsEquivalence class factorsAn expected result DeterminantNondeterminant Functionally dependent Test CaseAgeWeightHeightSexIntakeMedicareChildAdultBMI uw male 3000 yesnounderweight16.0 uw female 2000 yesnounderweight18.4 uw male 2000 no underweight17.4 uw male 2000 no underweight16.9 uw female 3000 no underweight16.9 uw female 3000 no underweight17.4 One strength-2 partition for one equivalence class – Adult underweight Input factorsEquivalence class factorsAn expected result DeterminantNondeterminant Functionally dependent Test CaseAgeWeightHeightSexIntakeMedicareChildAdultBMI uw male 3000 yesnounderweight16.0 uw female 2000 yesnounderweight18.4 uw male 2000 no underweight17.4 uw male 2000 no underweight16.9 uw female 3000 no underweight16.9 uw female 3000 no underweight One partition for each Adult underweight class: Age, Weight, Height → Adult classes s = t + 1 = = 3. All pairs of nondeterminant factor values are associated with each Adult class. One partition for both Medicare classes: Age → Medicare classes s = t - l + 1 = = 2. All nondeterminant factor values are associated with each Medicare class. Boundary cases: Medicare: lower Age Adult: lower Age Adult, underweight: upper BMI Testcover.com Copyright © 2014 Testcover.com, LLC. All rights reserved.
Testcover.com 19 Adult report classes and boundaries 66 in 70 in 64 in l b l b l b l b l b l b 211 lb 61 in 72 in 118 lb Copyright © 2014 Testcover.com, LLC. All rights reserved.
Testers have choices 20 Copyright © 2014 Testcover.com, LLC. All rights reserved. Testcover.com Equivalence class factor values in a partition:multiple1 Number of partitions:1multiple Test target:largesmaller Dependence on oracle:somemore Freedom to test equivalence class boundaries:limitedyes Strength to reach equivalence class: l any Nondeterminant strength ( s ≤ n + 1): t – l + 1 t + 1