Since the days of mainframe computers, software engineers have had two main concerns: First, how does business communicate what it requires from an application and, second, how do engineers validate that they're building the correct software for the business need? Various methodologies and frameworks have appeared over the years to address these concerns, but not until the Framework for Integrated Tests (FIT) has a method been able to address them in a simple and intuitive way.
FIT is a general-purpose, open-ended framework that you can easily extend for expressing various sorts of tests. This article shows you how to use FIT in conjunction with Eclipse to solve several problems in software development. I begin by giving you a brief look at what FIT does to solve the problems inherent in software engineering.
FIT facilitates communication among the various stakeholders and developers in a business, focusing precisely on what must be done. This functionality helps everyone avoid unclear business needs and helps ensure that developers solve the right business problem. Also, FIT supports the inevitable restructuring of code as the system evolves, reducing the difficulty of maintaining, extending or changing code, as well as code bloat and software entropy. Finally, FIT increases overall software quality by ensuring that the team knows immediately when a component has been completed as well as when completed work has been mistakenly broken.
If you use JUnit, the all-important question is, Do I have to stop writing JUnit test cases? The answer is a resounding No. FIT isn't intended to supplement JUnit testing; rather, it functions at a higher level -- the level of integration testing (see Figure 1).
Figure 1. The FIT process flow

You can still develop JUnit tests. But in addition, you'll create FIT tests using FIT tables.
For JUnit, it was a test case. For the IBM Rational Unified Process® (RUP®), it was a use case. For FIT, it's a table. Tables play a pivotal role in delivering on the FIT promise of increased communication among stake holders, software agility, and software stability.
Tables are a simple and effective way to communicate, whether they're the final scores of a baseball game or the stock prices in your daily newspaper. For this reason, the creators of FIT have chosen tables as the weapon of choice for allowing users to communicate software behavior through examples, which reduces ambiguity and puts the onus on the user to clearly define the software system.
Agility -- allowing change to happen -- is of key importance to modern software systems. The increasing rate of competition forces business users to keep adding more features and functionalities. FIT testing helps increase agility by defining changes and ensuring that no software modifications break previously satisfied requirements. FIT tables serve as a mechanism for conveying the results of the software developed by acting as a guiding light in the development process and focusing on business value.
However, with increased agility and change comes the increased risk of losing stability. FIT tables help restore the balance required of a System Under Test (SUT) by making sure that any changes to the underlying system -- including refactoring and enhancements -- are visually conveyed immediately to the various stakeholders of that system.
Testing calculations according to a given business rule is an important part of software testing. Business needs are communicated in the form of tables and concrete examples help you understand what's required.
Example: FIT calculation table
The business rule for the calculation test in this example is:
A US scholarship worth 500 hundred dollars is awarded to students whenever their Scholastic Assessment Test (SAT) score is at least 2000, and for every 100 points over 2000. The sample data in the table is used to model the correlation between the SAT score and the scholarship awarded for several cases. For example, when the score is 2300, the scholarship is 2000 US dollars.
Table 1 is an example of a FIT table that models the expected behavior of this business rule. That rule calculates the scholarship that students receive based on their SAT scores.
Table 1. FIT calculation using a ColumnFixture table
| CalculateScholarship | |
| Score | Scholarship() |
| 1000 | 0 |
| 1999 | 0 |
| 2000 | 500 |
| 2050 | 500 |
| 2100 | 1000 |
| 2200 | 1500 |
| 2300 | 2000 |
| 2350 | 2000 |
| 2400 | 2500 |
The first row in the table shows the name of the fixture to be tested. The
fixture class acts as the driver to determine how the sample data
sets in the table are to be tested against the SUT. In this example, the fixture is
CalculateScholarship.
Because this example involves a ColumnFixture table, the second
row identifies the names of the given and the calculated field columns. In this example, the Score
column refers to the input values, and the Scholarship() column refers to the expected
calculated result.
Create a FIT fixture for the ColumnFixture table
To make the framework work with Table 1, you must create a fixture, or an intermediary
Test Adapter class that tells FIT how to talk to your software. Listing 1
shows the CalculateScholarship fixture.
Listing 1. The CalculateScholarship fixture
public class CalculateScholarship extends ColumnFixture {
public int score;
public int scholarship(){
ScholarshipSystem scholar = new ScholarshipSystem();
return scholar.calculateScholarship(score);
}
}
|
This fixture invokes the SUT ScholarshipSystem class shown in
Listing 2, and then invokes the calculateScholarship() method on it.
Listing 2. The ScholarshipSystem class
public class ScholarshipSystem {
public int calculateScholarship(int score){
int scholarship = 0;
if(score<2000)
return scholarship;
else
scholarship = 500;
scholarship = scholarship + ((score - 2000)/100) * 500;
return scholarship;
}
}
|
You can extend different types of fixtures depending on what you're testing. In the example above,
I used ColumnFixture to map the columns in the table to variables and
methods in the fixture.
The two columns in the table correspond to variables in the fixture. The second column, which contains
the expected result, corresponds to the scholarship() method in the fixture.
To calculate the answer, I used the ScholarshipSystem class as the SUT.
To demonstrate how you can use FIT in an Eclipse environment, I used the Extended FIT Eclipse plug-in, which provides a simple user interface (UI) for loading FIT input and output files. This plug-in is based on the basic FIT Library plug-in.
Installing the Extended FIT Eclipse plug-in
To install the Extended FIT Eclipse plug-in, complete these steps:
- Download the core FIT Eclipse plug-in.
- Extract the .zip file contents, and copy the .jar file into the Plugins folder of your Eclipse installation.
- Download the Extended FIT Eclipse plug-in.
- Copy the .jar file to the Plugins folder of your Eclipse installation.
- Restart Eclipse.
You should now see a new FIT menu as well as a Run FIT toolbar button (see Figure 2). If you do, you've successfully installed the Extended FIT Eclipse plug-in.
Figure 2. The Extended FIT plug-in installed in Eclipse

The Extended FIT Eclipse plug-in comes bundled with the FIT .jar file, so you don't need to install the FIT .jar file separately for running tests. However, to develop your fixtures, you might need to add the FIT .jar file to your build path.
Using the Extended FIT Eclipse plug-in
To use the Extended FIT Eclipse plug-in, you need three files:
- An input .html file that contains all the input FIT tables
- An output .html file that contains the results of the FIT test run
- A separate .jar file that contains all your custom fixture classes
Note: When creating custom fixture classes, be sure to bundle them into a .jar file using your favorite build tool. The Extended FIT Eclipse plug-in expects the location of this .jar file to run FIT tests.
When you have all the required files for the Extended FIT Eclipse plug-in, you can start running FIT tests by completing the following steps:
- Click Run FIT.
- Click Browse i/p to add the name of your input file.
- Click Browse o/p to locate your output file.
- Click Browse fixture Jar to locate your fixture .jar file.
- Click Run FIT.
FIT takes an .html file as input; as a result, the input file names are configured to be the same (see Figure 3).
Figure 3. Running tests using the Extended FIT Eclipse plug-in

Extended FIT Eclipse plug-in functioning
The Extended FIT Eclipse plug-in for Eclipse functions as a simple wrapper that acts as a delegate
to the underlying FIT library. When you click Run FIT, the Extended FIT Eclipse plug-in
invokes and runs the FIT FileRunner class by passing the selected
input and output files as parameters to it. The FIT FileRunner class
in turn parses the input file and writes the results of the FIT run into the output file that you selected.
If everything ran without a glitch, you should have the results of the run displayed in a window.
In this article, you saw how FIT allows users and engineers to bridge the communication gap regarding their software. By creating tangible examples, users can give engineers a clear vision of what they must build. You also saw how FIT and Eclipse come together in a perfect way by allowing developers to write fixtures and run FIT tables to verify their software. By extending the core FIT Eclipse plug-in, you saw how it's possible to use Eclipse to perform FIT testing for calculation-based rules, which can easily be applied to other forms of FIT testing, as well.
In the next article in this series, you'll see how the Extended Eclipse FIT plug-in was built. You'll also learn how FIT was used to test the plug-in itself in Eclipse's Plug-in Development Environment (PDE).
Learn
- FIT and Eclipse: Check out other parts in this series.
- "In pursuit of code quality:
Resolve to get FIT" (developerWorks, February 2006): Learn more about FIT.
- FIT wiki: Explore FIT at the source. Visit the FIT wiki to learn more.
- FitNesse: Learn more about FitNesse, a FIT-based wiki collaboration tool.
- Fit for Developing
Software: Framework for Integrated Tests: Read the FIT book by Ward Cunningham and Rick Mugridge (Prentice Hall, June 2005).
- AIX® and UNIX®: Want more? The developerWorks AIX and UNIX zone hosts hundreds of informative articles and introductory, intermediate, and advanced tutorials.
-
Technical events and webcasts: Stay current with developerWorks technical events and webcasts.
Get products and technologies
- Eclipse
V3.1: Download a free trial version of Eclipse V3.1.
- FIT Eclipse plug-in: Download and find more
information about the core FIT Eclipse plug-in.
- Extended FIT Eclipse
plug-in: Download and find more information about the Extended FIT Eclipse plug-in.
- IBM trial
software: Build your next development project with IBM trial software, available for download directly
from developerWorks.
Discuss
- AIX and UNIX forums: Discuss
and participate in the developerWorks AIX and UNIX forums.
- developerWorks blogs: Participate in developerWorks
blogs and get involved in the developerWorks community.
Vishnu Vettrivel is the Principal Consultant at PunditLabs, which specializes in enterprise consulting and technology, and he has many years of experience in architecting, designing, and developing mission-critical enterprise applications. Having worked extensively for Fortune 50 clients, he has helped craft strategic technical plans for many emerging technologies. You can reach him at vishnu@punditlabs.com.
Comments (Undergoing maintenance)





