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
|
1
00:00:00,160 --> 00:00:04,260
White box testing, in general, and coverage criteria in particular, involve some
2
00:00:04,260 --> 00:00:07,550
subtle concepts, so before I conclude this lesson, I want to have a
3
00:00:07,550 --> 00:00:10,960
few more quizzes to make sure that we all understand these concepts.
4
00:00:10,960 --> 00:00:13,610
The first one involves a very simple piece of code, a straight line
5
00:00:13,610 --> 00:00:16,540
of code, three statements, in which we simply read an integer and
6
00:00:16,540 --> 00:00:20,180
then prints 10 divided by the value of that integer minus 3. Now,
7
00:00:20,180 --> 00:00:22,250
let's imagine that we have a test where there consists of three
8
00:00:22,250 --> 00:00:25,250
test cases for this code, and what I'm showing in the test cases
9
00:00:25,250 --> 00:00:28,580
is the input and the expected output. So for the first one,
10
00:00:28,580 --> 00:00:31,280
the input is 1, and I expect the output to be minus 5.
11
00:00:31,280 --> 00:00:34,480
For the second one, the input is minus 1, I'm expecting to
12
00:00:34,480 --> 00:00:37,120
have 2.5. And for the third one, the input is 0, and I'm
13
00:00:37,120 --> 00:00:42,440
expecting to have minus 3.3333 as the result. Now the first question
14
00:00:42,440 --> 00:00:45,180
I want to ask, is if we considered this test suite, and we
15
00:00:45,180 --> 00:00:48,050
run it on the code, does it achieve path coverage? And remember
16
00:00:48,050 --> 00:00:50,960
that path coverage is one of the strongest coverage criteria that we saw.
|