Testcover.com Testcover.com
Tutorial - Functional Dependence -
Temperature Conversion Example

Home
Existing User Login
Brochure
Sign up for Risk-Free Trial
About Testcover.com
Frequently Asked Questions
Tutorial with Examples
->Equivalence Partitioning
--->HTML Form Example
--->Functional Dependence
----->Temperature Example
----->Calendar Example
----->Fixed Values Procedure
--->Shopping Cart Example
----->Seq. Unit Replay Design
->UML State Machines
--->Shopping Cart Example
--->Thermostat Example
->Definitions of Terms
Performance
WSDL Interface
Background
Partners
Registrations
Contact Information

Direct Product Block notation is a general way to specify constraints. A partition containing blocks of factor values defines all the possible test cases by allowing all the blocks' combinations of values. Earlier examples show how to set up blocks in a partition to generate test cases for browser-operating system configuration constraints, for calendar rule constraints and for business rule constraints. When the constraints are complex, or when there are many test factors, it may take several blocks to define the allowed test cases. However, the specification of the constraints can be simplified when a factor's values are determined by the values of other factors. That is, the factor's values are functionally dependent on other factors. Expressing values in functionally dependent form can clarify the constraint analysis in a test design by making these relations among factor values explicit. The temperature conversion example on this page illustrates the simplification when the dependence is on one other factor.

Functionally Dependent Form
The temperature conversion program changes a temperature on the Celsius, Fahrenheit or Kelvin scale to the corresponding temperature on any of these three scales. The three test factors are:
• inScale, the temperature scale for the input temperature
• inTemp, an integral number of degrees on the input scale
• outScale, the scale for the converted temperature
Temperatures below absolute zero are invalid.

The tester plans to try several inTemp values in the valid temperature partition. These will include the minimum valid temperature, 20 and 68 degrees on the input scale, and the freezing and boiling points for water.

The three test factors have values as follows.

Test FactorNumber of ValuesTest Factor Values
1. inScale3 Celsius Fahrenheit Kelvin
2. inTemp5 minimum(inScale) 20 68 freezing(inScale) boiling(inScale)
3. outScale3 Celsius Fahrenheit Kelvin

Three of the inTemp values are expressed as functions of the inScale values. The values of inScale (the determinant factor) determine the values of the functions for inTemp (the functionally dependent factor). Thus, when inScale is Celsius, the minimum temperature, minimum(Celsius), is -273. The outScale factor is not part of these relations, so it is a nondeterminant factor.

The test case generator request can be expressed in terms of these functions (in functionally dependent form) or in terms of their fixed values determined by the inScale factor (in fixed values form). Using functionally dependent values in this example reduces the number of blocks as well as the number of test cases. The inTemp functions are placeholder values, to be evaluated and substituted according to the inScale values in the generated test cases. When an inScale value appears with an inTemp function, the function's value is determined for the test case.

The test case generator request in functionally dependent form is given below.
Temperature Conversion Example - functionally dependent form
inScale
inTemp
outScale
# all valid temperatures
+inTemp depends on inScale
Celsius Fahrenheit Kelvin
minimum(inScale) 20 68 freezing(inScale) boiling(inScale)
Fahrenheit Kelvin Celsius

The results table follows. The input temperatures after substitution are shown in the column on the right.

#1. all valid temperatures
Test
Case ID
inScale inTemp outScale Combo
Countdown
Input Temperature
after Substitution
3 Values5 Values3 Values39
1Celsiusminimum(inScale)Fahrenheit36-273 oC
2Fahrenheit20Celsius3320 oF
3Kelvin68Kelvin3068 oK
4Fahrenheitfreezing(inScale)Kelvin2732 oF
5Kelvinboiling(inScale)Celsius24373 oK
6Celsius20Kelvin2120 oC
7Kelvin20Fahrenheit1820 oK
8Celsius68Celsius1568 oC
9Fahrenheit68Fahrenheit1268 oF
10Fahrenheitminimum(inScale)Kelvin10-459 oF
11Kelvinminimum(inScale)Celsius80 oK
12Celsiusfreezing(inScale)Fahrenheit60 oC
13Kelvinfreezing(inScale)Celsius4273 oK
14Celsiusboiling(inScale)Fahrenheit2100 oC
15Fahrenheitboiling(inScale)Kelvin0212 oF

Because the request is in functionally dependent form, the test case generator treats each of the inTemp functions as a single value. The implications for coverage are as follows.
• All allowed values of the dependent factor are covered. Even though each inTemp function is treated as one value, when it is paired with the determinant function values it is interpreted correctly, by the definition of the function.
• All allowed pairs of determinant and dependent factor values are covered. Each determinant factor value is paired with the corresponding value of each of the dependent factor's functions.
• All allowed pairs of determinant and nondeterminant factor values are covered.
• Each nondeterminant factor value is paired with at least one value of each function and with all the fixed values of the dependent factor.
These coverage characteristics may be sufficient for test goals. When they are not (when each nondeterminant factor value is to be paired with all the values of each function), the request can be converted to fixed values form. This approach is illustrated next. Alternatively the request can be repartitioned to cover all pairs. This second approach is illustrated below on this page. It makes use of the fact that when all the values of the dependent factor are given by one function of one factor, all allowed pairs are covered.

Fixed Values Form
Converting the functionally dependent request above to fixed values form requires specific values for the inTemp functions based on the inScale values. Now the three test factors have values as follows.

Test FactorNumber of ValuesTest Factor Values
1. inScale3 Celsius Fahrenheit Kelvin
2. inTemp11 minimum(Celsius) minimum(Fahrenheit) minimum(Kelvin) 20 68
freezing(Celsius) freezing(Fahrenheit) freezing(Kelvin)
boiling(Celsius) boiling(Fahrenheit) boiling(Kelvin)
3. outScale3 Celsius Fahrenheit Kelvin
The request is converted to fixed values form by replacing its block with three blocks containing the individual determinant factor values and their corresponding functionally dependent factor values.
Temperature Conversion Example - fixed values form
inScale
inTemp
outScale
# all valid temperatures
+Celsius inScale
Celsius
minimum(Celsius) 20 68 freezing(Celsius) boiling(Celsius)
Fahrenheit Kelvin Celsius
+Fahrenheit inScale
Fahrenheit
minimum(Fahrenheit) 20 68 freezing(Fahrenheit) boiling(Fahrenheit)
Fahrenheit Kelvin Celsius
+Kelvin inScale
Kelvin
minimum(Kelvin) 20 68 freezing(Kelvin) boiling(Kelvin)
Fahrenheit Kelvin Celsius

The results table follows. The input temperatures after substitution are shown in the column on the right.

#1. all valid temperatures
Test
Case ID
inScale inTemp outScale Combo
Countdown
Input Temperature
after Substitution
3 Values11 Values3 Values75
1Celsiusfreezing(Celsius)Fahrenheit720 oC
2Celsiusminimum(Celsius)Kelvin69-273 oC
3Celsius20Celsius6620 oC
4Fahrenheitfreezing(Fahrenheit)Fahrenheit6332 oF
5Fahrenheitminimum(Fahrenheit)Kelvin60-459 oF
6Fahrenheit68Celsius5768 oF
7Kelvinfreezing(Kelvin)Fahrenheit54273 oK
8Kelvinminimum(Kelvin)Kelvin510 oK
9Kelvinboiling(Kelvin)Celsius48373 oK
10Celsiusboiling(Celsius)Kelvin46100 oC
11Celsius68Kelvin4468 oC
12Fahrenheitboiling(Fahrenheit)Kelvin42212 oF
13Fahrenheit20Fahrenheit4020 oF
14Kelvin20Kelvin3820 oK
15Kelvin68Fahrenheit3668 oK
16Celsiusminimum(Celsius)Fahrenheit35-273 oC
17Celsiusfreezing(Celsius)Celsius340 oC
18Celsiusboiling(Celsius)Fahrenheit33100 oC
19Celsiusminimum(Celsius)Celsius32-273 oC
20Celsiusfreezing(Celsius)Kelvin310 oC
21Celsiusboiling(Celsius)Celsius30100 oC
22Fahrenheitminimum(Fahrenheit)Fahrenheit29-459 oF
23Fahrenheitfreezing(Fahrenheit)Celsius2832 oF
24Fahrenheitboiling(Fahrenheit)Fahrenheit27212 oF
25Fahrenheitminimum(Fahrenheit)Celsius26-459 oF
26Fahrenheitfreezing(Fahrenheit)Kelvin2532 oF
27Fahrenheitboiling(Fahrenheit)Celsius24212 oF
28Kelvinboiling(Kelvin)Kelvin23373 oK
29Kelvinminimum(Kelvin)Fahrenheit220 oK
30Kelvinfreezing(Kelvin)Celsius21273 oK
31Kelvinboiling(Kelvin)Fahrenheit20373 oK
32Kelvinminimum(Kelvin)Celsius190 oK
33Kelvinfreezing(Kelvin)Kelvin18273 oK

Because the request is in fixed values form, all allowed pairs are covered among all factors. The fixed values are expressed here in terms of the function's domain, e.g. minimum(Celsius). In fixed values form they can be expressed in terms of the function's range instead, -273 for minimum(Celsius), etc.

One Function of One Factor
The second approach to cover all pairs of all factors is to split the original functionally dependent partition into separate partitions for each inTemp function. There are three partitions for minimum(inScale), freezing(inScale) and boiling(inScale), and one more for the fixed values 20 and 68. This illustration focuses on the partition for minimum(inScale); the partitions for freezing(inScale) and boiling(inScale) are constructed similarly.

When the minimum(inScale) function specifies all the inTemp values, the three test factors have values as follows.

Test FactorNumber of ValuesTest Factor Values
1. inScale3 Celsius Fahrenheit Kelvin
2. inTemp1 minimum(inScale)
3. outScale3 Celsius Fahrenheit Kelvin

The test case generator request is given below.
Temperature Conversion Example - one function of one factor
inScale
inTemp
outScale
# all valid temperatures
+inTemp depends on inScale
Celsius Fahrenheit Kelvin
minimum(inScale)
Fahrenheit Kelvin Celsius

The results table follows. The input temperatures after substitution are shown in the column on the right.

#1. all valid temperatures
Test
Case ID
inScale inTemp outScale Combo
Countdown
Input Temperature
after Substitution
3 Values1 Value3 Values15
1Kelvinminimum(inScale)Celsius120 oK
2Celsiusminimum(inScale)Kelvin9-273 oC
3Fahrenheitminimum(inScale)Fahrenheit6-459 oF
4Kelvinminimum(inScale)Fahrenheit50 oK
5Fahrenheitminimum(inScale)Celsius4-459 oF
6Celsiusminimum(inScale)Celsius3-273 oC
7Kelvinminimum(inScale)Kelvin20 oK
8Fahrenheitminimum(inScale)Kelvin1-459 oF
9Celsiusminimum(inScale)Fahrenheit0-273 oC

As before, the test case generator treats the inTemp function as a single value. The implications for coverage are as follows.
• All allowed values of the dependent factor are covered. Even though each inTemp function is treated as one value, when it is paired with the determinant function values it is interpreted correctly, by the definition of the function.
• All allowed pairs of determinant and dependent factor values are covered. Each determinant factor value is paired with the corresponding value of the dependent factor's function.
• All allowed pairs of determinant and nondeterminant factor values are covered.
• Each nondeterminant factor value is paired with all the values of the dependent factor. This is because when each nondeterminant factor value is paired with a determinant factor value, it must be paired with the corresponding dependent value as well. There is no other choice.
Thus, all allowed pairs among all factors are covered. In this case (one function of one factor) the functionally dependent form is equivalent to the fixed values form: Both forms yield test cases covering the same values and pairs.

A general procedure for converting requests from functionally dependent form to fixed values form includes the two approaches introduced here. Example a in the procedure illustrates this one function of one factor case.

The calendar example is revisited on the next page to show how constraints for a factor determined by two other factors can be simplified.

<HTML Form Example Calendar Example (revisited)>

Copyright © 2003-2017 Testcover.com, LLC. All rights reserved.