[QA] Pair programming[Friday] with Zeljkof

Vikas Yaligar vikasyaligar.it at gmail.com
Sun Jun 22 17:12:41 UTC 2014


Last week I had paired with Zeljko on Wednesday and Friday. Here is what we
did on Friday:

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.

* 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.

* 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.

* 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

* 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.

* After this, Zeljko suggested me to read on how to use expect[3], in

* Now we had, a basic failing test which expects rectangle as the input and
expects the same rectangle as the output.

* We made the first test pass and then we wrote test for 2 rectangle, one
inside the other[Fig. merged_rectangles.jpg].

* For 1 of my solutions, we passed the second test, but the first test

* Then we modified and passed both, then wrote another tests, which is the
actual scenario which comes when we have to take screenshot[Fig.

* Then we made it pass by calculating the end points of the rectangle.

* 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

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.

[1]: https://gerrit.wikimedia.org/r/#/c/135616/

[2]: https://www.ruby-toolbox.com/categories/testing_frameworks

[3]: https://github.com/rspec/rspec-expectations

[4]: https://gerrit.wikimedia.org/r/#/c/141295/

Vikas S Yaligar
IT Department
NITK Surathkal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wikimedia.org/pipermail/qa/attachments/20140622/72662506/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: merged_rectangles.jpg
Type: image/jpeg
Size: 25884 bytes
Desc: not available
URL: <http://lists.wikimedia.org/pipermail/qa/attachments/20140622/72662506/attachment-0002.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rectangles.jpg
Type: image/jpeg
Size: 37192 bytes
Desc: not available
URL: <http://lists.wikimedia.org/pipermail/qa/attachments/20140622/72662506/attachment-0003.jpg>

More information about the QA mailing list