Tuesday, February 7, 2012

Unit Testing Project

What’s up everybody! I’m back with more cool stories about my Global Software Development class. This time I will talk about my Unit Testing Project. Prof. Keenan assigned groups based on our skill set (everybody in the class had to fill out an online survey) and the main idea is that you never meet with your teammates in person; you have to use all kinds of collaboration and communication tools to discuss and come to agreement with your team.

So for this project we were given a Physics Library written in C# and .Net and we (my team) were supposed to code some unit tests for it. I had done Test Driven Development before, but I have never actually written the tests myself, so I was kind of excited about this project since I was going to learn a pretty useful tool.

This project was divided in two (2) phases, so let me try to explain how they went:

The first phase of this project was all about Planning & Team Synchronization. First Julie, one of my teammates, proposed herself as Team Leader and we all gladly accepted. Next, we created a Google Group (forum/mailing list) to use as our main way of communication and we built a Team Wiki Page (Google Sites) to post team info, news, project development and announcements. Finally, we all had to go through the code using something called Cyclomatic Complexity and choose 4 different methods for each member to write Unit Tests for. Each one of the methods selected had different difficulties according to the value given by the tool. These were the methods I selected:
  • Basic (2): AdvanceMath > Quaternion > Inverse (line 562)
  • Intermediate (3-4): Physics2DDotNet > Shape > CreateCircle (line 88)
  • Advanced (5-6): AdvanceMath > MathHelper > RadianMin (line 71)
  • Expert (7+): Physics2DDotNet > DistanceGrid > TryGetIntersection (line 79)

The second phase consisted on actually Writing the Unit Tests. I didn’t know that C# and .Net had a library for doing this (another new useful tool for me, sweet!), but yes they do (Microsoft.VisualStudio.TestTools.UnitTesting) so kudos to Microsoft. The whole idea with these tests was to prove that the methods selected work as advertised, so we had to try and test their functionality using regular values and corner cases. Here is a screenshot of how Visual Studio presents the results:


Well, everybody in the team did a really good job and finished their tests before the specified deadline. So great work guys, this first project was smooth sailing. I hope the other ones go this way too. =D

No comments:

Post a Comment