1 00:00:02,090 --> 00:00:04,310 In this session, I’d like to complete the one 2 00:00:04,477 --> 00:00:08,230 about the debugger and show you how to detect a bug. 3 00:00:08,397 --> 00:00:12,440 Let’s imagine we change the decrement definition 4 00:00:13,610 --> 00:00:14,350 and we make a mistake. 5 00:00:14,660 --> 00:00:17,950 Here, I put an addition instead of a substraction. 6 00:00:19,160 --> 00:00:22,000 When I run my tests, the TestDecrement returns false. 7 00:00:22,157 --> 00:00:26,440 I execute it, I look at the execution and I notice 8 00:00:26,607 --> 00:00:30,550 that indeed count returns 9 instead of 5. 9 00:00:30,717 --> 00:00:33,540 So it shows that I do have an error among these 10 00:00:33,707 --> 00:00:36,120 expressions, if I consider that the counter has been created. 11 00:00:36,690 --> 00:00:38,520 Here I’d like to execute 12 00:00:38,800 --> 00:00:42,930 the code and stop just after 13 00:00:43,630 --> 00:00:46,200 the Counter creation to see which methods 14 00:00:46,720 --> 00:00:47,840 have a problem. 15 00:00:48,650 --> 00:00:51,400 i add Self halt, this is one of the ways to propose a 16 00:00:51,567 --> 00:00:55,040 break point in Pharo. I compile again the method, I do 17 00:00:55,207 --> 00:00:59,630 Proceed, the code is executed and stops on the halt method. 18 00:01:00,580 --> 00:01:01,710 So now I click on “Over”. 19 00:01:02,370 --> 00:01:04,850 I can decide to go inside 20 00:01:05,017 --> 00:01:07,110 the count method, that’s what I do for example, 21 00:01:07,277 --> 00:01:09,790 I can see that count value is nil and Integer value is 7 22 00:01:13,500 --> 00:01:17,910 like here, and there I can click on “Over”. 23 00:01:20,770 --> 00:01:22,580 I go back, I have decrement. 24 00:01:22,747 --> 00:01:25,730 I’m going to look inside it 25 00:01:25,897 --> 00:01:27,540 because the problem must be there, and here 26 00:01:27,707 --> 00:01:29,680 I can see that decrement is equal to -1. 27 00:01:33,070 --> 00:01:35,680 I modify it, “Over”. 28 00:01:39,170 --> 00:01:41,000 And now I can click on “Proceed”. 29 00:01:42,620 --> 00:01:47,530 When I click on “Proceed” the debug is left, I remove it, 30 00:01:47,697 --> 00:01:51,490 I click on “Proceed” and my test is green.