Wednesday, September 24, 2008

Using Ant

Introduction

The focus of this assignment was to use QA tools to debug some sample code. For the assignment I used Ant along with Checkstyle, PMD, FindBugs, and JUnit.

Installation

First of all, I downloaded Ant, Findbugs, Checkstyle, JUnit, and PMD along with stack-6.0.911.zip. I unzipped all the files to a single directory. One of the biggest obstacles that I encountered was just installing the tools that I needed. I often found myself googling for instructions. Once I got the first few tools installed the rest of them were easy cause they followed similar steps. Much of it had to do with setting up environmental variables.

QA Testing

Afterwards I ran through the gamut of tools to test that if they all worked. The commands that I used were:
  • ant clean compile
  • ant -f checkstyle.build.xml
  • ant -f dist.build.xml
  • ant -f findbugs.build.xml
  • ant -f javadoc.build.xml
  • ant -f junit.build.xml
  • ant -f pmd.build.xml
Once those ran correctly I opened up Eclipse and started on the process of debugging the Stack project. Fixing the bugs that Checkstyle found were the easiest cause it gave suggestions on what should be changed. Junit found issues relating to how a stack returned the top element. Instead of returning the top element of a stack, the program was returning the bottom element. FindBugs told me to use Integer.valueOf(int) instead of new Integer(int) which I never knew until know that it was an issue. There was a problem with the testIllegalPop() so I removed the try/catch block and added @Test(expected = EmptyStackException.class). PMD told me to add the final keyword to certain variables and I also had to change a few ArrayList to an interface List.

Conclusion

At first I was fustrated at getting all these tools up and running but now after using them I realized that these things will make my life much easier. I wouldn't be surprised if one day I would abhor the thought of not being able to use them in my programming.

Here is a distribution of the project: stack-johnzhou-6.0.924.zip

No comments: