blob: f506c50450153486d34ff6d1fe933002b3501e87 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<org.eclipse.epf.uma:ContentDescription xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:org.eclipse.epf.uma="http://www.eclipse.org/epf/uma/1.0.3/uma.ecore" epf:version="1.0.0" xmi:id="-FX8hDYUKOXsrQulFe9lwtw" name="test_ideas_for_booleans_and_boundaries,1.7150344523489172E-305" guid="-FX8hDYUKOXsrQulFe9lwtw" changeDate="2006-11-21T15:55:18.633-0800" version="1.0.0">
<mainDescription>&lt;a id=&quot;XE_test__developer_testing__test_ideas__for_booleans_and_boundaries&quot;
name=&quot;XE_test__developer_testing__test_ideas__for_booleans_and_boundaries&quot;&gt;&lt;/a&gt;&lt;a
id=&quot;XE_test-ideas__for_booleans_and_boundaries&quot; name=&quot;XE_test-ideas__for_booleans_and_boundaries&quot;&gt;&lt;/a&gt;&lt;a
id=&quot;XE_design__developer_testing__test_ideas__for_booleans_and_boundaries&quot;
name=&quot;XE_design__developer_testing__test_ideas__for_booleans_and_boundaries&quot;&gt;&lt;/a&gt;
&lt;h3&gt;
&lt;a id=&quot;Introduction&quot; name=&quot;Introduction&quot;&gt;&lt;/a&gt;Introduction
&lt;/h3&gt;
&lt;p&gt;
Test ideas are based on &lt;a href=&quot;./../../../glossary/glossary.htm#fault_model&quot; target=&quot;_blank&quot;&gt;fault models&lt;/a&gt;,
notions of which faults are plausible in software and how those faults can best be uncovered. This guideline shows how
to create test ideas from boolean and relational expressions. It first motivates the techniques by looking at code,
then describes how to apply them if the code hasn't been written yet or is otherwise unavailable.
&lt;/p&gt;
&lt;h3&gt;
&lt;a id=&quot;BooleanExpressions&quot; name=&quot;BooleanExpressions&quot;&gt;&lt;/a&gt;&lt;b&gt;Boolean Expressions&lt;/b&gt;
&lt;/h3&gt;
&lt;p&gt;
Consider the following code snippet, taken from an (imaginary) system for managing bomb detonation. It's part of the
safety system and controls whether the &quot;detonate bomb&quot; button push is obeyed.
&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre&gt;
if (publicIsClear || technicianClear) {
bomb.detonate();
}
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;
The code is wrong. The &lt;font size=&quot;+0&quot;&gt;||&lt;/font&gt; should be an &lt;font size=&quot;+0&quot;&gt;&amp;amp;&amp;amp;&lt;/font&gt;. That mistake will have
bad effects. Instead of detonating the bomb when both the bomb technician and public are clear, the system will
detonate when &lt;i&gt;either&lt;/i&gt; is clear.
&lt;/p&gt;
&lt;p&gt;
What test would find this bug?
&lt;/p&gt;
&lt;p&gt;
Consider a test in which the button is pushed when both the technician and public are clear. The code will allow the
bomb to be detonated. But-and this is important-the &lt;i&gt;correct&lt;/i&gt; code (the one that uses an &lt;font
size=&quot;+0&quot;&gt;&amp;amp;&amp;amp;&lt;/font&gt;) would do the same. So the test is useless at finding this fault.
&lt;/p&gt;
&lt;p&gt;
Similarly, this incorrect code behaves correctly when both the technician and public are next to the bomb: the bomb is
not detonated.
&lt;/p&gt;
&lt;p&gt;
To find the bug, you have to have a case in which the code as written evaluates differently than the code that should
have been written. For example, the public must be clear, but the bomb technician is still next to the bomb. Here are
all the tests in table form:
&lt;/p&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;table
style=&quot;BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid&quot;
cellspacing=&quot;0&quot; bordercolordark=&quot;#808080&quot; cellpadding=&quot;4&quot; width=&quot;100%&quot; bordercolorlight=&quot;#808080&quot; border=&quot;1&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th scope=&quot;col&quot; width=&quot;20%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
publicIsClear
&lt;/p&gt;
&lt;/th&gt;
&lt;th scope=&quot;col&quot; width=&quot;20%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
technicianClear
&lt;/p&gt;
&lt;/th&gt;
&lt;th scope=&quot;col&quot; width=&quot;20%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
Code as written...
&lt;/p&gt;
&lt;/th&gt;
&lt;th scope=&quot;col&quot; width=&quot;20%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
Correct code would have...
&lt;/p&gt;
&lt;/th&gt;
&lt;th width=&quot;20%&quot;&gt;
&amp;nbsp;
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;20%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;20%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;20%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
&lt;font color=&quot;#008000&quot;&gt;detonates&lt;/font&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;20%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
&lt;font color=&quot;#008000&quot;&gt;detonated&lt;/font&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;20%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
test is useless (for this fault)
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;20%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;20%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;20%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
&lt;font color=&quot;#ff0000&quot;&gt;detonates&lt;/font&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;20%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
&lt;font color=&quot;#ff0000&quot;&gt;not detonated&lt;/font&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;20%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
useful test
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;20%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;20%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;20%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
&lt;font color=&quot;#ff0000&quot;&gt;detonates&lt;/font&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;20%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
&lt;font color=&quot;#ff0000&quot;&gt;not detonated&lt;/font&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;20%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
useful test
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;20%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;20%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;20%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
&lt;font color=&quot;#008000&quot;&gt;does not detonate&lt;/font&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;20%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
&lt;font color=&quot;#008000&quot;&gt;not detonated&lt;/font&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;20%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
test is useless (for this fault)
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;p&gt;
The two middle tests are both useful for finding this particular fault. Note, however, that they're redundant: since
either will find the fault, you needn't run both.
&lt;/p&gt;
&lt;p&gt;
There are other ways in which the expression might be wrong. Here are two lists of common mistakes in boolean
expressions. The faults on the left are all caught by the technique discussed here. The faults on the right might not
be. So this technique doesn't catch all the faults we might like, but it's still useful.
&lt;/p&gt;
&lt;div align=&quot;right&quot;&gt;
&lt;table
style=&quot;BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid&quot;
cellspacing=&quot;0&quot; bordercolordark=&quot;#808080&quot; cellpadding=&quot;4&quot; width=&quot;100%&quot; bordercolorlight=&quot;#808080&quot; border=&quot;1&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th scope=&quot;col&quot; width=&quot;50%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
&lt;b&gt;Faults detected&lt;/b&gt;
&lt;/p&gt;
&lt;/th&gt;
&lt;th scope=&quot;col&quot; width=&quot;50%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
&lt;b&gt;Faults possibly not detected&lt;/b&gt;
&lt;/p&gt;
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;50%&quot;&gt;
Using wrong operator: a &lt;font color=&quot;#ff0000&quot;&gt;&lt;b&gt;||&lt;/b&gt;&lt;/font&gt; b should be a&lt;font
color=&quot;#ff0000&quot;&gt;&lt;b&gt;&amp;amp;&amp;amp;&lt;/b&gt;&lt;/font&gt;b
&lt;/td&gt;
&lt;td width=&quot;50%&quot;&gt;
Wrong variable used: a&amp;amp;&amp;amp;&lt;font color=&quot;#ff0000&quot;&gt;&lt;b&gt;b&lt;/b&gt;&lt;/font&gt;&amp;amp;&amp;amp;c should be a&amp;amp;&amp;amp;
&lt;font color=&quot;#ff0000&quot;&gt;&lt;b&gt;x&lt;/b&gt;&lt;/font&gt;&amp;amp;&amp;amp;d
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;50%&quot;&gt;
Negation is omitted or incorrect: a||b should be &lt;font color=&quot;#ff0000&quot;&gt;&lt;b&gt;!&lt;/b&gt;&lt;/font&gt;a||b, or &lt;font
color=&quot;#ff0000&quot;&gt;&lt;b&gt;!&lt;/b&gt;&lt;/font&gt; a||b should be a||b
&lt;/td&gt;
&lt;td width=&quot;50%&quot;&gt;
Expression is too simple: a&amp;amp;&amp;amp;b should be a&amp;amp;&amp;amp;b&lt;font
color=&quot;#ff0000&quot;&gt;&lt;b&gt;&amp;amp;&amp;amp;c&lt;/b&gt;&lt;/font&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;50%&quot;&gt;
The expression is misparenthesized: a&amp;amp;&amp;amp;b||c should be a&amp;amp;&amp;amp;&lt;font
color=&quot;#ff0000&quot;&gt;&lt;b&gt;(&lt;/b&gt;&lt;/font&gt;b||c&lt;font color=&quot;#ff0000&quot;&gt;&lt;b&gt;)&lt;/b&gt;&lt;/font&gt;
&lt;/td&gt;
&lt;td width=&quot;50%&quot;&gt;
Expressions with more than one of the faults in the left column
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;50%&quot;&gt;
The expression is overly complex: a&amp;amp;&amp;amp;b&lt;b&gt;&amp;amp;&amp;amp;c&lt;/b&gt; should be &lt;font
size=&quot;+0&quot;&gt;a&amp;amp;&amp;amp;b&lt;br /&gt;
&lt;/font&gt; (This fault is not so likely, but is easy to find with tests useful for other reasons.)
&lt;/td&gt;
&lt;td width=&quot;50%&quot;&gt;
&amp;nbsp;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;p&gt;
How are these ideas used? Suppose you're given a boolean expression like &lt;font size=&quot;+0&quot;&gt;a&amp;amp;&amp;amp;!b&lt;/font&gt;. You
could construct a truth table like this one:
&lt;/p&gt;
&lt;div align=&quot;right&quot;&gt;
&lt;table
style=&quot;BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid&quot;
cellspacing=&quot;0&quot; bordercolordark=&quot;#808080&quot; cellpadding=&quot;4&quot; width=&quot;100%&quot; bordercolorlight=&quot;#808080&quot; border=&quot;1&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th scope=&quot;col&quot; width=&quot;14%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
a
&lt;/p&gt;
&lt;/th&gt;
&lt;th scope=&quot;col&quot; width=&quot;14%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
b
&lt;/p&gt;
&lt;/th&gt;
&lt;th scope=&quot;col&quot; width=&quot;14%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
a&amp;amp;&amp;amp;!b&lt;br /&gt;
(code as written)
&lt;/p&gt;
&lt;/th&gt;
&lt;th scope=&quot;col&quot; width=&quot;14%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
maybe it should be&lt;br /&gt;
a&lt;font color=&quot;#ff0000&quot;&gt;&lt;b&gt;||&lt;/b&gt;&lt;/font&gt;!b
&lt;/p&gt;
&lt;/th&gt;
&lt;th scope=&quot;col&quot; width=&quot;14%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
maybe it should be&lt;br /&gt;
&lt;font color=&quot;#ff0000&quot;&gt;&lt;b&gt;!&lt;/b&gt;&lt;/font&gt;a&amp;amp;&amp;amp;!b
&lt;/p&gt;
&lt;/th&gt;
&lt;th scope=&quot;col&quot; width=&quot;15%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
maybe it should be&lt;br /&gt;
a&amp;amp;&amp;amp;b
&lt;/p&gt;
&lt;/th&gt;
&lt;th scope=&quot;col&quot; width=&quot;15%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
...
&lt;/p&gt;
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;14%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;14%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;14%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;14%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
&lt;font color=&quot;#ff0000&quot;&gt;true&lt;/font&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;14%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;15%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
&lt;font color=&quot;#ff0000&quot;&gt;true&lt;/font&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;15%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
...
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;14%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;14%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;14%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;14%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;14%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
&lt;font color=&quot;#ff0000&quot;&gt;false&lt;/font&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;15%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;15%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
...
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;14%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;14%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;14%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;14%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;14%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;15%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;15%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
...
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;14%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;14%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;14%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;14%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
&lt;font color=&quot;#ff0000&quot;&gt;true&lt;/font&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;14%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
&lt;font color=&quot;#ff0000&quot;&gt;true&lt;/font&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;15%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;15%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
...
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;p&gt;
If you crunched through all the possibilities, you'd find that the first, second, and fourth possibilities are all
that's needed. The third expression will find no faults that won't be found by one of the others, so you needn't try
it. (As the expressions grow more complicated, the savings due to unneeded cases grow quickly.)
&lt;/p&gt;
&lt;p&gt;
Of course, no one sane would build such a table. Fortunately, you don't have to. It's easy to memorize the required
cases for simple expressions. (See the next section.) For more complex expressions, such as &lt;font
size=&quot;+0&quot;&gt;A&amp;amp;&amp;amp;B||C&lt;/font&gt;, see &lt;a href=&quot;../../examples/extrnlcntrbtns/test/tstatmtch.htm&quot; target=&quot;_blank&quot;&gt;Test
Ideas for Mixtures of ANDs and ORs&lt;/a&gt;, which lists test ideas for expressions with two or three operators. For even
more complex expressions, a &lt;a href=&quot;http://www.testing.com/tools/multi/README.html&quot; target=&quot;_blank&quot;&gt;program&lt;/a&gt; can be
used to generate test ideas.
&lt;/p&gt;
&lt;h3&gt;
&lt;a id=&quot;SimpleExpressionTables&quot; name=&quot;SimpleExpressionTables&quot;&gt;&lt;/a&gt;&lt;b&gt;Tables for Simple Boolean Expressions&lt;/b&gt;
&lt;/h3&gt;
&lt;p&gt;
If the expression is &lt;font size=&quot;+0&quot;&gt;A&amp;amp;&amp;amp;B&lt;/font&gt;, test with:
&lt;/p&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;table
style=&quot;BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid&quot;
cellspacing=&quot;0&quot; bordercolordark=&quot;#808080&quot; cellpadding=&quot;4&quot; width=&quot;85%&quot; bordercolorlight=&quot;#808080&quot; border=&quot;1&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th scope=&quot;col&quot; width=&quot;50%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
A
&lt;/p&gt;
&lt;/th&gt;
&lt;th scope=&quot;col&quot; width=&quot;50%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
B
&lt;/p&gt;
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;50%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;50%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;50%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;50%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;p&gt;
If the expression is &lt;font size=&quot;+0&quot;&gt;A||B&lt;/font&gt;, test with:
&lt;/p&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;table
style=&quot;BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid&quot;
cellspacing=&quot;0&quot; bordercolordark=&quot;#808080&quot; cellpadding=&quot;4&quot; width=&quot;85%&quot; bordercolorlight=&quot;#808080&quot; border=&quot;1&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th scope=&quot;col&quot; width=&quot;50%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
A
&lt;/p&gt;
&lt;/th&gt;
&lt;th scope=&quot;col&quot; width=&quot;50%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
B
&lt;/p&gt;
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;50%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;50%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;50%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;50%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;p&gt;
If the expression is &lt;font size=&quot;+0&quot;&gt;A&lt;sub&gt;1&lt;/sub&gt; &amp;amp;&amp;amp; A&lt;sub&gt;2&lt;/sub&gt; &amp;amp;&amp;amp; ... &amp;amp;&amp;amp;
A&lt;sub&gt;n&lt;/sub&gt;&lt;/font&gt;, test with:
&lt;/p&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;table
style=&quot;BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid&quot;
cellspacing=&quot;0&quot; bordercolordark=&quot;#808080&quot; cellpadding=&quot;4&quot; width=&quot;85%&quot; bordercolorlight=&quot;#808080&quot; border=&quot;1&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td width=&quot;100%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
A&lt;sub&gt;1,&lt;/sub&gt; A&lt;sub&gt;2&lt;/sub&gt;, ..., and A&lt;sub&gt;n&lt;/sub&gt; are all true
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;100%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
A&lt;sub&gt;1&lt;/sub&gt; is false, all the rest are true
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;100%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
A&lt;sub&gt;2&lt;/sub&gt; is false, all the rest are true
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;100%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
...
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;100%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
A&lt;sub&gt;n&lt;/sub&gt; is false, all the rest are true
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;p align=&quot;left&quot;&gt;
If the expression is &lt;font size=&quot;+0&quot;&gt;A&lt;sub&gt;1&lt;/sub&gt; || A&lt;sub&gt;2&lt;/sub&gt; || ... || A&lt;sub&gt;n&lt;/sub&gt;&lt;/font&gt;, test with:
&lt;/p&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;table
style=&quot;BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid&quot;
cellspacing=&quot;0&quot; bordercolordark=&quot;#808080&quot; cellpadding=&quot;4&quot; width=&quot;85%&quot; bordercolorlight=&quot;#808080&quot; border=&quot;1&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td width=&quot;100%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
A&lt;sub&gt;1,&lt;/sub&gt; A&lt;sub&gt;2&lt;/sub&gt;, ..., and A&lt;sub&gt;n&lt;/sub&gt; are all false
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;100%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
A&lt;sub&gt;1&lt;/sub&gt; is true, all the rest are false
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;100%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
A&lt;sub&gt;2&lt;/sub&gt; is true, all the rest are false
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;100%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
...
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;100%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
A&lt;sub&gt;n&lt;/sub&gt; is true, all the rest are false
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;p&gt;
If the expression is &lt;font size=&quot;+0&quot;&gt;A&lt;/font&gt;, test with:
&lt;/p&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;table
style=&quot;BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid&quot;
cellspacing=&quot;0&quot; bordercolordark=&quot;#808080&quot; cellpadding=&quot;4&quot; width=&quot;85%&quot; bordercolorlight=&quot;#808080&quot; border=&quot;1&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td width=&quot;100%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
A
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;100%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;100%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;p&gt;
So, when you need to test &lt;font size=&quot;+0&quot;&gt;a&amp;amp;&amp;amp;!b&lt;/font&gt;, you can apply the first table above, invert the sense
of b (because it's negated), and get this list of &lt;a class=&quot;elementLinkWithUserText&quot;
href=&quot;./../../../xp/guidances/concepts/test-ideas_list,8.834380241450745E-306.html&quot; guid=&quot;8.834380241450745E-306&quot;&gt;Test
Ideas&lt;/a&gt;:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
A true, B false
&lt;/li&gt;
&lt;li&gt;
A true, B true
&lt;/li&gt;
&lt;li&gt;
A false, B false
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
&lt;a id=&quot;RelationalExpressions&quot; name=&quot;RelationalExpressions&quot;&gt;&lt;/a&gt;&lt;b&gt;Relational Expressions&lt;/b&gt;
&lt;/h3&gt;
&lt;p align=&quot;left&quot;&gt;
Here's another example of code with a fault:
&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre&gt;
if (finished &amp;lt; required) {
siren.sound();
}
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p align=&quot;left&quot;&gt;
The &lt;font size=&quot;+0&quot;&gt;&amp;lt;&lt;/font&gt; should be a &lt;font size=&quot;+0&quot;&gt;&amp;lt;=&lt;/font&gt;. Such mistakes are fairly common. As with
boolean expressions, you can construct a table of test values and see which ones detect the fault:
&lt;/p&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;table
style=&quot;BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid&quot;
cellspacing=&quot;0&quot; bordercolordark=&quot;#808080&quot; cellpadding=&quot;4&quot; width=&quot;85%&quot; bordercolorlight=&quot;#808080&quot; border=&quot;1&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th scope=&quot;col&quot; width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
finished
&lt;/p&gt;
&lt;/th&gt;
&lt;th scope=&quot;col&quot; width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
required
&lt;/p&gt;
&lt;/th&gt;
&lt;th scope=&quot;col&quot; width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
code as written...
&lt;/p&gt;
&lt;/th&gt;
&lt;th scope=&quot;col&quot; width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
the correct code would have...
&lt;/p&gt;
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
1
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
5
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
sounds the siren
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
sounded the siren
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
5
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
5
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
&lt;font color=&quot;#ff0000&quot;&gt;does not sound the siren&lt;/font&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
&lt;font color=&quot;#ff0000&quot;&gt;sounded the siren&lt;/font&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
5
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
1
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
does not sound the siren
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
not sounded the siren
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;p&gt;
More generally, the fault can be detected whenever &lt;font size=&quot;+0&quot;&gt;finished=required&lt;/font&gt;. From analyses of plausible
faults, we can get these rules for test ideas:
&lt;/p&gt;
&lt;p&gt;
If the expression is A&amp;lt;B or A&amp;gt;=B, test with
&lt;/p&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;table
style=&quot;BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid&quot;
cellspacing=&quot;0&quot; bordercolordark=&quot;#808080&quot; cellpadding=&quot;4&quot; width=&quot;85%&quot; bordercolorlight=&quot;#808080&quot; border=&quot;1&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td width=&quot;100%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
A=B
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;100%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
A slightly less than B
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;p&gt;
If the expression is A&amp;gt;B or A&amp;lt;=B, test with
&lt;/p&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;table
style=&quot;BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid&quot;
cellspacing=&quot;0&quot; bordercolordark=&quot;#808080&quot; cellpadding=&quot;4&quot; width=&quot;85%&quot; bordercolorlight=&quot;#808080&quot; border=&quot;1&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td width=&quot;100%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
A=B
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;100%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
A slightly larger than B
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;p&gt;
What does &quot;slightly&quot; mean? If A and B are integers, A should be one less than or larger than B. If they are floating
point numbers, A should be a number quite close to B. (It's probably not necessary that it be the the closest floating
point number to B.)
&lt;/p&gt;
&lt;h3&gt;
&lt;a id=&quot;CombinedExpressions&quot; name=&quot;CombinedExpressions&quot;&gt;&lt;/a&gt;&lt;b&gt;Rules for Combined Boolean and Relational Expressions&lt;/b&gt;
&lt;/h3&gt;
&lt;p&gt;
Most relational operators occur within boolean expressions, as in this example:
&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre&gt;
if (finished &amp;lt; required) {
siren.sound();
}
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;
The rules for relational expressions would lead to these test ideas:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;font size=&quot;+0&quot;&gt;finished&lt;/font&gt; is equal to required
&lt;/li&gt;
&lt;li&gt;
&lt;font size=&quot;+0&quot;&gt;finished&lt;/font&gt; is slightly less than &lt;font size=&quot;+0&quot;&gt;required&lt;/font&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
The rules for boolean expressions would lead to these:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;font size=&quot;+0&quot;&gt;finished &amp;lt; required&lt;/font&gt; should be true
&lt;/li&gt;
&lt;li&gt;
&lt;font size=&quot;+0&quot;&gt;finished &amp;lt; required&lt;/font&gt; should be false
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
But if &lt;font size=&quot;+0&quot;&gt;finished&lt;/font&gt; is slightly less than &lt;font size=&quot;+0&quot;&gt;required&lt;/font&gt;, &lt;font size=&quot;+0&quot;&gt;finished
&amp;lt; required&lt;/font&gt; is true, so there's no point in writing down the latter.
&lt;/p&gt;
&lt;p&gt;
And if &lt;font size=&quot;+0&quot;&gt;finished&lt;/font&gt; equals &lt;font size=&quot;+0&quot;&gt;required&lt;/font&gt;, &lt;font size=&quot;+0&quot;&gt;finished &amp;lt;
required&lt;/font&gt; is false, so there's no point in writing down that latter one either.
&lt;/p&gt;
&lt;p&gt;
So, &lt;b&gt;if a relational expression contains no boolean operators (&lt;font size=&quot;+0&quot;&gt;&amp;amp;&amp;amp;&lt;/font&gt; and &lt;font
size=&quot;+0&quot;&gt;||&lt;/font&gt;), ignore the fact that it's also a boolean expression.&lt;/b&gt;
&lt;/p&gt;
&lt;p&gt;
Things are a bit more complicated with combinations of boolean and relational operators, like this one:
&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre&gt;
if (count&amp;lt;5 || always) {
siren.sound();
}
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;
From the relational expression, you get:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;font size=&quot;+0&quot;&gt;count&lt;/font&gt; slightly less than 5
&lt;/li&gt;
&lt;li&gt;
&lt;font size=&quot;+0&quot;&gt;count&lt;/font&gt; equal to 5
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
From the boolean expression, you get:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;font size=&quot;+0&quot;&gt;count&amp;lt;5&lt;/font&gt; true, always false
&lt;/li&gt;
&lt;li&gt;
&lt;font size=&quot;+0&quot;&gt;count&amp;lt;5&lt;/font&gt; false, always true
&lt;/li&gt;
&lt;li&gt;
&lt;font size=&quot;+0&quot;&gt;count&amp;lt;5&lt;/font&gt; false, always false
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
These can be combined into three more specific test ideas. (Here, note that &lt;font size=&quot;+0&quot;&gt;count&lt;/font&gt; is an
integer.)
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;font size=&quot;+0&quot;&gt;count=4&lt;/font&gt;, always false
&lt;/li&gt;
&lt;li&gt;
&lt;font size=&quot;+0&quot;&gt;count=5&lt;/font&gt;, always true
&lt;/li&gt;
&lt;li&gt;
&lt;font size=&quot;+0&quot;&gt;count=5&lt;/font&gt;, always false
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
Notice that &lt;font size=&quot;+0&quot;&gt;count=5&lt;/font&gt; is used twice. It might seem better to use it only once, to allow the use of
some other value-after all, why test &lt;font size=&quot;+0&quot;&gt;count&lt;/font&gt; with 5 twice? Wouldn't it be better to try it once
with 5 and another time with some other value such that &lt;font size=&quot;+0&quot;&gt;count&amp;lt;5&lt;/font&gt; is false? It would be, but
it's dangerous to try. That's because it's easy to make a mistake. Suppose you tried the following:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;font size=&quot;+0&quot;&gt;count=4&lt;/font&gt;, always false
&lt;/li&gt;
&lt;li&gt;
&lt;font size=&quot;+0&quot;&gt;count=5&lt;/font&gt;, always true
&lt;/li&gt;
&lt;li&gt;
&lt;font size=&quot;+0&quot;&gt;&lt;b&gt;count&amp;lt;5&lt;/b&gt;&lt;/font&gt; &lt;b&gt;false&lt;/b&gt;, &lt;font size=&quot;+0&quot;&gt;always&lt;/font&gt; false
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
Suppose that there's a fault that can &lt;i&gt;only&lt;/i&gt; be caught with &lt;font size=&quot;+0&quot;&gt;count=5&lt;/font&gt;. What that means is
that the value 5 will cause &lt;font size=&quot;+0&quot;&gt;count&amp;lt;5&lt;/font&gt; to produce false in the second test, when the correct
code would have produced true. However, that false value is immediately or'd with the value of always, which is true.
That means the value of the whole expression is correct, even though the value of the relational subexpression was
wrong. The fault will go undiscovered.
&lt;/p&gt;
&lt;p&gt;
The fault doesn't go undiscovered if it's the &lt;i&gt;other&lt;/i&gt; count=5 that is left less specific.
&lt;/p&gt;
&lt;p&gt;
Similar problems happen when the relational expression is on the right-hand side of the boolean operator.
&lt;/p&gt;
&lt;p&gt;
Because it's hard to know which subexpressions have to be exact and which can be general, it's best to make them all
exact. The alternative is to use the &lt;a href=&quot;http://www.testing.com/tools/multi/README.html&quot; target=&quot;_blank&quot;&gt;boolean
expression program&lt;/a&gt; mentioned above. It produces correct test ideas for arbitrary mixed boolean-and-relational
expressions.
&lt;/p&gt;
&lt;h3&gt;
&lt;a id=&quot;TestIdeasWithoutCode&quot; name=&quot;TestIdeasWithoutCode&quot;&gt;&lt;/a&gt;&lt;b&gt;Test ideas without Code&lt;/b&gt;
&lt;/h3&gt;
&lt;p&gt;
As explained in &lt;a class=&quot;elementLinkWithType&quot;
href=&quot;./../../../xp/guidances/concepts/test-first_design,6.556259235358794E-306.html&quot;
guid=&quot;6.556259235358794E-306&quot;&gt;Concept: Test-first Design&lt;/a&gt;, it's usually preferable to design tests before
implementing code. So, although the techniques are motivated by code examples, they'll usually be applied without code.
How?
&lt;/p&gt;
&lt;p&gt;
Certain design artifacts, such as statecharts and sequence diagrams, use boolean expressions as guards. Those cases are
straightforward-simply add the test ideas from the boolean expressions to the artifact's test idea checklist. See &lt;a
class=&quot;elementLinkWithUserText&quot;
href=&quot;./../../../xp/guidances/guidelines/test_ideas_for_statechart_and_flow_diagrams,1.0347051690476123E-305.html&quot;
guid=&quot;1.0347051690476123E-305&quot;&gt;Guideline: Test Ideas for Statechart and Activity Diagrams&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
The trickier case is when boolean expressions are implicit rather than explicit. That's often the case in descriptions
of APIs. Here's an example. Consider this method:
&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre&gt;
List matchList(Directory d1, Directory d1,
FilenameFilter excluder);
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;
The description of this method's behavior might read like this:
&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;
Returns a List of the absolute pathnames of all files that appear in both Directories. Subdirectories are
descended. [...] Filenames that match the &lt;font size=&quot;+0&quot;&gt;excluder&lt;/font&gt; are excluded from the returned list. The
excluder only applies to the top-level directories, not to filenames in subdirectories.
&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
The words &quot;and&quot; and &quot;or&quot; do not appear. But when is a filename included in the return list? When it appears in the
first directory &lt;b&gt;and&lt;/b&gt; it appears in the second directory &lt;b&gt;and&lt;/b&gt; it's either in a lower level directory
&lt;b&gt;or&lt;/b&gt; it's not specifically excluded. In code:
&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre&gt;
if (appearsInFirst &amp;amp;&amp;amp; appearsInSecond &amp;amp;&amp;amp;
(inLowerLevel || !excluded)) {
add to list
}
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;
Here are the test ideas for that expression, given in tabular form:
&lt;/p&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;table
style=&quot;BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid&quot;
cellspacing=&quot;0&quot; bordercolordark=&quot;#808080&quot; cellpadding=&quot;4&quot; width=&quot;85%&quot; bordercolorlight=&quot;#808080&quot; border=&quot;1&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th scope=&quot;col&quot; width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
appearsInFirst
&lt;/p&gt;
&lt;/th&gt;
&lt;th scope=&quot;col&quot; width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
appearsInSecond
&lt;/p&gt;
&lt;/th&gt;
&lt;th scope=&quot;col&quot; width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
inLower
&lt;/p&gt;
&lt;/th&gt;
&lt;th scope=&quot;col&quot; width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
excluded
&lt;/p&gt;
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;br /&gt;
The general approach for discovering implicit boolean expressions from text is to first list the actions described
(such as &quot;returns a matching name&quot;). Then write a boolean expression that describes the cases in which an action is
taken. Derive test ideas from all the expressions.
&lt;/p&gt;
&lt;p&gt;
There's room for disagreement in that process. For example, one person might write down the boolean expression used
above. Another might say that there are really two distinct actions: first, the program discovers matching names, then
it filters them out. So, instead of one expression, there are two:
&lt;/p&gt;
&lt;dl&gt;
&lt;dt&gt;
discover a match:
&lt;/dt&gt;
&lt;dd&gt;
happens when a file is in the first directory &lt;b&gt;and&lt;/b&gt; a file with the same name is in the second directory
&lt;/dd&gt;
&lt;dt&gt;
filter a match:
&lt;/dt&gt;
&lt;dd&gt;
happens when the matching files are in the top level &lt;b&gt;and&lt;/b&gt; the name matches the &lt;font
size=&quot;+0&quot;&gt;excluder&lt;/font&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;p&gt;
These different approaches can lead to different test ideas and thus different tests. But the differences are most
likely not particularly important. That is, the time spent worrying about which expression is right, and trying
alternatives, would be better spent on other techniques and producing more tests. If you're curious about what the
sorts of differences might be, read on.
&lt;/p&gt;
&lt;p&gt;
The second person would get two sets of test ideas.
&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;
test ideas about discovering a match:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
file in first directory, file in second directory (true, true)
&lt;/li&gt;
&lt;li&gt;
file in first directory, file not in second directory (true, false)
&lt;/li&gt;
&lt;li&gt;
file not in first directory, file in second directory (false, true)
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
test ideas about filtering a match (once one has been discovered):
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
matching files are in the top level, the name matches the &lt;font size=&quot;+0&quot;&gt;excluder&lt;/font&gt; (true, true)
&lt;/li&gt;
&lt;li&gt;
matching files are in the top level, the name doesn't match the &lt;font size=&quot;+0&quot;&gt;excluder&lt;/font&gt; (true, false)
&lt;/li&gt;
&lt;li&gt;
matching files are in some lower level, the name matches the &lt;font size=&quot;+0&quot;&gt;excluder&lt;/font&gt; (false, true)
&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;p&gt;
Suppose those two sets of test ideas are combined. The ones in the second set only matter when the file is in both
directories, so they can only be combined with the first idea in the first set. That gives us the following:
&lt;/p&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;table
style=&quot;BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid&quot;
cellspacing=&quot;0&quot; bordercolordark=&quot;#808080&quot; cellpadding=&quot;4&quot; width=&quot;85%&quot; bordercolorlight=&quot;#808080&quot; border=&quot;1&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th scope=&quot;col&quot; width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
file in first directory
&lt;/p&gt;
&lt;/th&gt;
&lt;th scope=&quot;col&quot; width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
file in second directory
&lt;/p&gt;
&lt;/th&gt;
&lt;th scope=&quot;col&quot; width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
in top level
&lt;/p&gt;
&lt;/th&gt;
&lt;th scope=&quot;col&quot; width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
matches excluder
&lt;/p&gt;
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;p&gt;
Two of the test ideas about discovering a match do not appear in that table. We can add them like this:
&lt;/p&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;table
style=&quot;BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid&quot;
cellspacing=&quot;0&quot; bordercolordark=&quot;#808080&quot; cellpadding=&quot;4&quot; width=&quot;85%&quot; bordercolorlight=&quot;#808080&quot; border=&quot;1&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th scope=&quot;col&quot; width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
file in first directory
&lt;/p&gt;
&lt;/th&gt;
&lt;th scope=&quot;col&quot; width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
file in second directory
&lt;/p&gt;
&lt;/th&gt;
&lt;th scope=&quot;col&quot; width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
in top level
&lt;/p&gt;
&lt;/th&gt;
&lt;th scope=&quot;col&quot; width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
matches excluder
&lt;/p&gt;
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
-
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
-
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
-
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
-
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;p&gt;
The blank cells indicate that the columns are irrelevant.
&lt;/p&gt;
&lt;p&gt;
This table now looks rather similar to the first person's table. The similarity can be emphasized by using the same
terminology. The first person's table has a column called &quot;inLower&quot;, and the second person's has one called &quot;in top
level&quot;. They can be converted by flipping the sense of the values. Doing that, we get this version of the second table:
&lt;/p&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;table
style=&quot;BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid&quot;
cellspacing=&quot;0&quot; bordercolordark=&quot;#808080&quot; cellpadding=&quot;4&quot; width=&quot;85%&quot; bordercolorlight=&quot;#808080&quot; border=&quot;1&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
appearsInFirst
&lt;/p&gt;
&lt;/th&gt;
&lt;th width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
appearsInSecond
&lt;/p&gt;
&lt;/th&gt;
&lt;th width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
inLower
&lt;/p&gt;
&lt;/th&gt;
&lt;th width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
excluded
&lt;/p&gt;
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td width=&quot;25%&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p align=&quot;center&quot;&gt;
-
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p align=&quot;center&quot;&gt;
-
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p align=&quot;center&quot;&gt;
false
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p align=&quot;center&quot;&gt;
true
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p align=&quot;center&quot;&gt;
-
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p align=&quot;center&quot;&gt;
-
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;p&gt;
The first three rows are identical to the first person's table. The last two differ only in that this version doesn't
specify values that the first does. This amounts to an assumption about the way the code was written. The first assumed
a complicated boolean expression:
&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre&gt;
if (appearsInFirst &amp;amp;&amp;amp; appearsInSecond &amp;amp;&amp;amp;
(inLowerLevel || !excluded)) {
add to list
}
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;
The second assumes nested boolean expressions:
&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre&gt;
if (appearsInFirst &amp;amp;&amp;amp; appearsInSecond) {
// found match.
if (inTopLevel &amp;amp;&amp;amp; excluded) {
// filter it
}
}
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;
The difference between the two is that the test ideas for the first detect two faults that the ideas for the second do
not, because those faults don't apply.
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
In the first implementation, there can be a misparenthesization fault. Are the parentheses around the &lt;font
size=&quot;+0&quot;&gt;||&lt;/font&gt; correct or incorrect? Since the second implementation has no &lt;font size=&quot;+0&quot;&gt;||&lt;/font&gt; and no
parentheses, the fault cannot exist.
&lt;/li&gt;
&lt;li&gt;
The test requirements for the first implementation check whether the second &lt;font size=&quot;+0&quot;&gt;&amp;amp;&amp;amp;&lt;/font&gt;
should be an &lt;font size=&quot;+0&quot;&gt;||&lt;/font&gt;. In the second implementation, that explicit &lt;font
size=&quot;+0&quot;&gt;&amp;amp;&amp;amp;&lt;/font&gt; is replaced by the implicit &lt;font size=&quot;+0&quot;&gt;&amp;amp;&amp;amp;&lt;/font&gt; of the nested &lt;font
size=&quot;+0&quot;&gt;if&lt;/font&gt; statements. There's no &lt;font size=&quot;+0&quot;&gt;||&lt;/font&gt;-for-&lt;font size=&quot;+0&quot;&gt;&amp;amp;&amp;amp;&lt;/font&gt; fault,
per se. (It might be the case that the nesting is incorrect, but this technique does not address that.)&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;</mainDescription>
</org.eclipse.epf.uma:ContentDescription>