Table of Contents |
---|
Value Comparison
This document specifies the rules to follow when comparing values returned by the System Under Test and the values expected by the field expert.
Comparing character strings
Rule 1 : String comparison is case sensitive
rule for | string comparison | |
---|---|---|
expected value | system value | equal? |
A string | A string | yes |
a mixed Case String | A Mixed case string | no |
a string | another string | no |
"a string in quotes" | a string in quotes | yes |
Comparing numbers
Rule 2 : When comparing numeric values, leading zeros are ignored. When comparing decimal values, trailing zeros are ignored.
rule for | number comparison | |
---|---|---|
expected value | system value | equal? |
7 | 7 | yes |
1 | 1.0 | yes |
.15 | 0.15 | yes |
0.1 | 1.0 | no |
0042 | 42 | yes |
-0.1 | -.1 | yes |
Comparing boolean values
Rule 3 : true and yes both represent the true value. no and false both represent the false value. Comparison is case insensitive.
rule for | boolean comparison | |
---|---|---|
expected value | system value | equal? |
true | true | yes |
TRUE | true | yes |
yes | true | yes |
true | false | no |
no | false | yes |
Comparing to a null value
Rule 4 : We can specify that we expect a nil value using the keywords null and nothing.
rule for | null comparison | |
---|---|---|
expected value | system value | equal? |
null | null | yes |
null | any value | no |
nothing | null | yes |
any value | null | no |
Note : blank cell ...
Comparing to a type
Rule 5 : We can compare to a specific type (i.e. an instance of a class, an interface or a subclass of a class) using the name of the type.
...
java.awt.Component | java.awt.Button | yes |
java.awt.Button | java.awt.Container | no |
java.awt.image.ImageObserver | java.awt.Button | yes |
Comparing to errors
Rule 6 : We can use the keyword error when we expect an exception to occur within the system.
...