Sunday, August 4, 2013

Seventh week report - Unit testing and documentation

Undoubtedly this was the most challenging week of GSoC I've had so far. This was mainly due to unit testing and I added tests for the functionality implemented by me during the first half of GSoC. I already had some experiences in unit testing using PHPUnit. However this was the first time I used mocking. I was familiar with the concept and went through a couple of online resources to make myself familiar with mocking in PHPUnit. The best resource was the existing phpMyAdmin tests and it had quite a number of instances where resources such as database connection were mocked.

Mocking in PHPUnit allows setting expectations and these expectations can be set based on the method being invoked and the index of method invocation.
For ex:
I interpreted the above as setting expectation for the first invocation of 'fetchAssoc' and spend a good amount of time trying to figure out why my tests fail. After a bit of reading online I figured out that the index is not related to the method, but relates to the number of time 'any' method is invoked on the mocked object. There seemed to quite a lot of people who had interpreted it in that way; see this and this.

I did most of the documentation while implementing the features, such as documenting new configurations. So documentation wise what I did during this week was porting these updates from the code to the phpMyAdmin wiki.

1 comment:

  1. Sounds like it was a bit of a difficult time, but nice job overcoming that to complete the work. Always remember that the mailing list is available to help, even though I myself wouldn't have known the problem, you might have gotten some tips and such discussion is not looked at negatively in any way. Nice work!