1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
1
00:00:00,190 --> 00:00:03,010
Obviously there are many possible tests that we can use to
2
00:00:03,010 --> 00:00:05,910
reach 100% branch and condition coverage. So I'm just going to show a
3
00:00:05,910 --> 00:00:08,740
possible one, which is x equal to 3 and y is
4
00:00:08,740 --> 00:00:11,410
equal to negative 2. If we specify this as case, you can
5
00:00:11,410 --> 00:00:14,900
see that the overall condition is false, because neither x is
6
00:00:14,900 --> 00:00:17,990
equal to 0 nor y is greater than 0. Therefore we will
7
00:00:17,990 --> 00:00:22,420
follow the false, false branch, and achieve 100% branch and condition coverage
8
00:00:22,420 --> 00:00:25,400
for this code. And we might require to be even more thorough,
9
00:00:25,400 --> 00:00:28,690
that all the combinations of our conditions inside each
10
00:00:28,690 --> 00:00:31,790
decision, inside each predicate, are tested. Which is what is
11
00:00:31,790 --> 00:00:36,010
called, multiple condition coverage. But because of the way
12
00:00:36,010 --> 00:00:39,050
this criterion is defined, it is combinatorial, becuse you have
13
00:00:39,050 --> 00:00:42,220
to consider all the possible combinations of conditions. And
14
00:00:42,220 --> 00:00:45,210
therefore it's extremely expensive, to the point of being impractical.
15
00:00:45,210 --> 00:00:47,610
So instead of defining that criterion, we're going to find
16
00:00:47,610 --> 00:00:51,000
another one which finds a good trade off between thoroughness
17
00:00:51,000 --> 00:00:52,815
of the tests and their cost.
|