<div dir="ltr">Hello, <div><br></div><div>Last week I had paired with Zeljko on Wednesday and Friday. Here is what we did on Friday:</div><div><br></div><div>We continued with the review of my patch to language screenshot[1]. But this day we concentrated on getting rectangle co-ordinates for cropping, which was a bit complex.</div>
<div><br></div><div>* Zeljko introducted TDD to me and he suggested me to look into RubyToolBox[2], which would help us to justify why we selected RSpec for Unit testing. </div><div><br></div><div>* As we wanted to get the co-ordinates of the rectangle which needs to be cropped, we went ahead and created a spec file(rectangle_spec.rb), where I would write my unit tests.</div>
<div><br></div><div>* So I wrote my first test which being empty calls a function rectangle. Then I run the test to see it whether it is working or not. Then I see it failing. So now I created rectangle function in rectangle.rb</div>
<div><br></div><div>* Next we started to write actual tests, i.e "should return the co-ordinates of provided 1 rectangle", here we had 1 problem as we need to define how to represent rectangle. Hence we used the browser co-ordinates and gave a definition to our rectangle. </div>
<div><br></div><div>* After this, Zeljko suggested me to read on how to use expect[3], in RSpec. </div><div><br></div><div>* Now we had, a basic failing test which expects rectangle as the input and expects the same rectangle as the output. </div>
<div><br></div><div>* We made the first test pass and then we wrote test for 2 rectangle, one inside the other[Fig. merged_rectangles.jpg]. </div><div><br></div><div>* For 1 of my solutions, we passed the second test, but the first test failed. </div>
<div><br></div><div>* Then we modified and passed both, then wrote another tests, which is the actual scenario which comes when we have to take screenshot[Fig. rectangles.jpg]. </div><div><br></div><div>* Then we made it pass by calculating the end points of the rectangle. </div>
<div><br></div><div>* Then we decided to make some changes like every time instead of returning all co-ordinates of rectangle, we could return the diagonal points of the rectangle[4]. </div><div><br></div><div>Important point I learn't here was, how to solve problems using TDD. Thank you Zeljko, for pairing up with me and teaching me TDD. I really enjoyed Friday's pair programming.</div>
<div><br></div><div>-</div><div>[1]: <a href="https://gerrit.wikimedia.org/r/#/c/135616/">https://gerrit.wikimedia.org/r/#/c/135616/</a></div><div><br></div><div>[2]: <a href="https://www.ruby-toolbox.com/categories/testing_frameworks">https://www.ruby-toolbox.com/categories/testing_frameworks</a><div style="display:inline-block;width:16px;height:16px">
 </div></div><div><br></div><div>[3]: <a href="https://github.com/rspec/rspec-expectations">https://github.com/rspec/rspec-expectations</a><div style="display:inline-block;width:16px;height:16px"> </div></div><div><br></div>
<div>[4]: <a href="https://gerrit.wikimedia.org/r/#/c/141295/">https://gerrit.wikimedia.org/r/#/c/141295/</a><div style="display:inline-block;width:16px;height:16px"> </div></div><div><br></div><div>Regards </div>-- <br>Vikas S Yaligar<br>
(9481543789)<br>IT Department <br>NITK Surathkal<br>
<font face="yw-04b1231f2b49ebfc02591937fa6d6ece0e8f71c2-8b96ae4ce06d38853abe7308e6a3cca9--o" style></font></div>