Monday, September 29, 2008

Testing

Introduction
For the Testing assignment, we needed to make improvements to the Stack implementation. The goal of this exercise was get to acquainted with Emma and JUnit. The task also had the class making minor adjustments to test cases and programming as a team. For this assignment I reached out through the class Google-group to search for a programming partner and John Ancheta was available to do some code fixing.

The Distribution
stack-arakaki

Working with Emma
This was my first time working with Emma and found it to be a nifty tool. I appreciate the application is letting me know which parts of the program are being neglected. However, the stack implementation contains four to five methods which seems rather trivial for a program like Emma. It would be interesting to see when a Java application has two hundred plus methods. I think when an application has so many moving parts you need Emma to check which method is being utilized.

Working with JUnit
As I have said in past blogs I do have limited experience with JUnit. So it did not take long for me to bang out a few test cases. I think I was able to help John with some of the JUnit method calls. I am a big fan of JUnit, I find writing test cases for an application only strengthens my understanding of how the tested program works. If I need to maintain the application over time I already know the program works and can quickly make the necessary adjustments. The difficulty with JUnit is trying to come up with what kind of tests should be implemented. In the past I was taught, test any method that is longer than one line and with the stack project there were several methods that more than one line of code. I know that this is only an introduction to JUnit I expect we will be writing more useful test cases in the coming future.

Pair Programming
After much thought I have come to realization that with pair programming the tasks seem to take less time to complete. John and I were able to reach 100 percent coverage in an hour. In the interest of time I suggested that we code at the same time. We perused Emma searching for which methods were not being invoked, after finding the necessary information we divvied up the tasks. From my point of view John and I worked well together if either one of us encountered a problem we discussed the issue and suggested a solution, which is how all pair programming sessions should operate.

My thoughts
For the Testing assignment I found pair programming an enjoyable experience. Although I suspect that not all coding partners are going to be like John. As for what I was feeling throughout this assignment, I felt a little fear when going through specifications for the exercise. The apprehension stemmed from my inexperience with Emma and the fear of not being able to recall JUnit code. But as I sat down and started working on the assignment the fear went away, found myself enjoying the activity of checking and fixing the stack implementation.

Conclusion
A programmer should never put all of their faith into programs like Emma. Clean and robust code is what we should all strive after but humans do make mistakes so it is to our advantage that we have development tools like Emma and JUnit. Thus far all of the assignments have been real treats to work with as I learn something new with each exercise. The Testing task exposed John and I to pair programming an area of software development that must be learned because as future programmers we need to start learning how to work within a team.