Tuesday, August 31, 2010

OSS Experience: Automatic JUnit Creation Tool

Overview

            The Automatic JUnit Creation Tool analyzes java classes to map all possible test branches. The tool has a wizard that guides users through the generation of a JUnit test. This tool is very helpful to programmers who's new to JUnit. It helps user to focus more on the test cases for their program rather than spending more time figuring out how to create a test program. This tool generates a JUnit code that can either save or copy and paste.


Creating JUnit for FizzBuzz Program with JUnit Creator (version 1.25).

 The Generated JUnit code for Fizz Buzz Program

Primitive Directive 1

            This program is very simple yet very useful and helpful. It eliminates the needs for writing a test program from scratch, which come in handy for busy programmers. The wizard covers all options that you may want to include in your test program. 
            The user interface is simple, with your program on left side and the conditions and execution paths on the right.
Automatic JUnit Creator (version 1.26).

Primitive Directive 2

           The size of the program is 7.5 mb, which make it easy to download and is available for multiple platforms such as Windows, Mac OSX, Linux and other. The package includes the library, readme and sample programs that can be use to demo the software. It requires no other configuration on the user’s computer. It can be either run by clicking the .jar file or through the terminal.
            There are two version of the program- 1.25 and 1.26. The version 1.26’s user interface is simpler with less buttons to click, but it lacks the documentation. The 1.25’s documentation is well written with step-by-step instructions and graphics in PDF format.

Primitive Directive 3

            The developer-level documentation is available in the software’s homepage. It includes the design overview that shows the packages and technologies it uses and includes the link for other information and sources about the program. 
            The author includes an instruction on how to setup the Development Environment, which uses Netbeans. The author also allows others to contribute and write into the software’s repository granted with his permission. 

Monday, August 30, 2010

Fizz Buzz Program

When I first read about writing the Fizz Buzz program, I got worried. I never wrote a Java program for almost 2 years. It took me about 45 minutes from the moment I opened Eclipse, writing the comments and getting the write results. Most of the time though were spent figuring out on how to get started on writing a java program. I had to search for my previous java assignments just to get an idea on how I used to write it. 

The program below is what I came up with. It's not very robust and as good as other programmer would do it, but it works. 

It was fun writing the code for this program mainly because it was very simple and I'm not expecting the same for the coming programs that need to be coded.  

/**
* Fizz Buzz
* A program that loops from 1 to 100. It displays Fizz if the number is divisible by 3,
* Buzz if by 5, Fizz Buzz if both and the number itself if not divisible by 3, 5 or both.
* @author Emerson Tabucol
* @date August 30, 2010
*/

import java.*;

public class FizzBuzz {
  
  
public static void main(string[] args){
      
      
for (int i = 1; i <= 100; i++){
      
          
if (((i%3) == 0) &amp;&amp; ((i%5)== 0))  { //if no. is divisible by 3 and 5
              
System.out.print("FizzBuzz"); //print Fizzbuzz
              
System.out.println(); //newline
          
          
}else if ((i%3) == 0){ //if no. is divisible by 3
              
System.out.print("Fizz"); //print Fizz
              
System.out.println(); //newline
              
          
}else if ((i%5) == 0) { //if no. is divisible by 5
              
System.out.print("Buzz"); //print Buzz
              
System.out.println(); //newline
              
          
}else{
               System.out.print
(i); //print the number
              
System.out.println(); //newline
          
}
       }
      
   }
//end main
}//end class