about summary refs log tree commit diff
path: root/usth/ICT2.7/P4L3 White-Box Testing Subtitles/22 - MC DC Coverage - lang_en_vs4.srt
blob: 1a971f9808c52999a2c85550390223cf004c326f (plain) (blame)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
1
00:00:00,120 --> 00:00:03,880
And this criterion is called Modified Condition/Decision Coverage,

2
00:00:03,880 --> 00:00:07,750
also called MC/DC. This criterion is very important because

3
00:00:07,750 --> 00:00:10,330
it is often required for safety critical applications.

4
00:00:10,330 --> 00:00:13,920
For example, the FAA, the Federal Aviation Administration, requires

5
00:00:13,920 --> 00:00:15,980
for all the software that runs on commercial

6
00:00:15,980 --> 00:00:19,420
airplanes to be tested according to the Modified Condition/Decision

7
00:00:19,420 --> 00:00:22,015
Coverage. So what is the key idea behind the

8
00:00:22,015 --> 00:00:25,270
MC/DC criterion? It is to test only the important

9
00:00:25,270 --> 00:00:28,710
combinations of conditions instead of all of them, and limit

10
00:00:28,710 --> 00:00:32,189
the testing cost by excluding the other combinations. And the way

11
00:00:32,189 --> 00:00:34,950
in which it works is by extending branch and decision

12
00:00:34,950 --> 00:00:38,860
coverage with the requirement that each condition should affect the decision

13
00:00:38,860 --> 00:00:41,940
outcome independently. So let's see what this means with an

14
00:00:41,940 --> 00:00:45,030
example that will also show you how you can reduce the

15
00:00:45,030 --> 00:00:46,940
number of combinations in this way. I am going to

16
00:00:46,940 --> 00:00:50,460
show you an example of how MC/DC works using this predicate

17
00:00:50,460 --> 00:00:53,870
which consists of three conditions. a, b, and c, which are all

18
00:00:53,870 --> 00:00:57,070
in and, so the overall predicate is a and b and c.

19
00:00:57,070 --> 00:00:58,980
The first thing I'm going to do is to show you how

20
00:00:58,980 --> 00:01:03,370
many test cases we will need to satisfy the multiple condition coverage

21
00:01:03,370 --> 00:01:06,440
for this simple predicate. Which means, how many test cases we will

22
00:01:06,440 --> 00:01:09,780
need to test all the possible combinations of true and false values

23
00:01:09,780 --> 00:01:12,740
for these conditions. So I'm going to populate this table. And as you

24
00:01:12,740 --> 00:01:15,870
can see, at the end we have eight test cases. Each test case

25
00:01:15,870 --> 00:01:18,650
tests a different combination of values for a, b, and c.

26
00:01:18,650 --> 00:01:21,200
I'm also showing, for each test case, the outcome of the overall

27
00:01:21,200 --> 00:01:23,930
predicate. So, for example, if we look at the first one, the

28
00:01:23,930 --> 00:01:27,200
first test case, will be such that a is true, b is

29
00:01:27,200 --> 00:01:30,210
true, and c is true. And therefore, the overall outcome of

30
00:01:30,210 --> 00:01:34,360
the predicate is true. Now lets consider the first condition, a. As

31
00:01:34,360 --> 00:01:36,300
I said a minute ago, what we want to test are the

32
00:01:36,300 --> 00:01:39,160
important combination. Which are the comibatinos

33
00:01:39,160 --> 00:01:41,930
in which a single condition independently

34
00:01:41,930 --> 00:01:45,610
effects the outcome of the overall predicate. So if we consider a

35
00:01:45,610 --> 00:01:48,490
and we look at this possible set of this cases. Let's try to

36
00:01:48,490 --> 00:01:51,850
find two test cases such that the only difference between the two

37
00:01:51,850 --> 00:01:54,960
test cases is the value of a, and the overall outcome of the

38
00:01:54,960 --> 00:01:57,790
predicate is different. If we look at the table, we can see

39
00:01:57,790 --> 00:02:00,920
that this is true for test cases one and five. If we look

40
00:02:00,920 --> 00:02:04,030
at these two cases, we can see that the overall of the predicate

41
00:02:04,030 --> 00:02:07,420
in the two cases is true and false, and that the only difference

42
00:02:07,420 --> 00:02:10,720
between the value of the conditions in the value of a. So

43
00:02:10,720 --> 00:02:13,990
these test cases satisfy exactly what we wanted. There are two test

44
00:02:13,990 --> 00:02:18,270
cases in which the value of a independently decides the overall value

45
00:02:18,270 --> 00:02:21,380
of the predicate. What we do, therefore, is to add these first

46
00:02:21,380 --> 00:02:24,740
two test cases to our set of tests down here. Now let's

47
00:02:24,740 --> 00:02:27,520
focus on b and let's try to find two test cases such

48
00:02:27,520 --> 00:02:30,280
that the value of b is the only value that changes between

49
00:02:30,280 --> 00:02:32,450
the two test cases, but the overall value of the predicate is

50
00:02:32,450 --> 00:02:34,980
different, the same thing we did for a. And in this case,

51
00:02:34,980 --> 00:02:37,610
we can see that if we select test case number one, and test

52
00:02:37,610 --> 00:02:40,420
case number three, we have exactly that situation. b is true in the

53
00:02:40,420 --> 00:02:44,250
first case, false in the second one, a and c don't change, but

54
00:02:44,250 --> 00:02:46,830
the overall value of the predicate changes. And now you can notice

55
00:02:46,830 --> 00:02:50,720
something else. That even though we selected two test cases, tested two values,

56
00:02:50,720 --> 00:02:53,950
one we already had. So, we only need three test cases overall to

57
00:02:53,950 --> 00:02:57,730
test a and b according to MC/DC. Now, let's look at our last

58
00:02:57,730 --> 00:03:00,510
condition, c. At this point, we know the game, so we

59
00:03:00,510 --> 00:03:02,780
just have to look for two test cases that satisfy our

60
00:03:02,780 --> 00:03:06,380
requirements. And in this case, one and two are suitable candidates.

61
00:03:06,380 --> 00:03:08,820
And once more, because we already have one, we just have to

62
00:03:08,820 --> 00:03:11,070
add two to our list. So as you can see from

63
00:03:11,070 --> 00:03:14,730
this example, we went from having eight test cases needed to cover

64
00:03:14,730 --> 00:03:18,600
all the possible combinations of conditions to only four test cases

65
00:03:18,600 --> 00:03:22,880
to satisfy the MC/DC criteria. So let's see where MC/DC stands in

66
00:03:22,880 --> 00:03:25,510
our substantion hierarchy. This is what we had so far

67
00:03:25,510 --> 00:03:28,430
in the hierarchy and this is where the MC/DC criterion will

68
00:03:28,430 --> 00:03:31,930
stand. MC/DC criterion is stronger than branch and condition coverage.

69
00:03:31,930 --> 00:03:35,210
Why? Because it requires every single condition to be true and

70
00:03:35,210 --> 00:03:38,400
false. And therefore, this section was a condition coverage criteria.

71
00:03:38,400 --> 00:03:41,610
And it also requires every predicate to be true and false

72
00:03:41,610 --> 00:03:44,425
and therefore, this section is branch coverage. And in addition,

73
00:03:44,425 --> 00:03:47,790
it's got the additional requirements that the true and false values,

74
00:03:47,790 --> 00:03:50,330
all the conditions have to also decide the overall

75
00:03:50,330 --> 00:03:53,190
value of the predicate. So it's stronger. Which is more

76
00:03:53,190 --> 00:03:56,130
thorough than branch and condition coverage and, as usual,

77
00:03:56,130 --> 00:03:59,380
also stronger than branch coverage, statement coverage, and condition coverage.