Software Testing Class

Tutorial 4: Writing The Fitnesse Fixtures – With Fitnesse Java Example

Today we are talking about next topic in FitNesse tutorial series about Fitnesse Fixtures.

As discussed in the previous tutorials of this series, for every test we run, it has associated Java fixture which generates the actual output or result. Results are compared against the expected output on the FitNesse page. If result matches the expected output, the test is marked as passed and FitNesse page shows that result in green color. If result does not match the expected output, the test is marked as failed and FitNesse page shows that result in red color.

fitnesse-fixtures

These colors are visible to the tester who is running the acceptance test on a particular application using FitNesse tool. In this tutorial, we are going to discuss in detail about the Java Fixture or code and how the request and response mechanism takes place through FitNesse web page.

FitNesse Request-Response Model:

For any test that we execute on FitNesse for a particular application under test, below are the steps involved.

In the above screenshot there are 4 right and 2 wrong assertions, therefore on the equal number of places in decision table getters columns are colored with green and red color respectively.

This completes FitNesse request response model explanation.

Java Fixture Rules in FitNesse:

In this section we are going to focus on the Java FitNesse fixtures. Below are the rules to write these.

package test;

public class TestMath {

    int firstNum;
    int secondNum;

    public int getFirstNum() {
        return firstNum;
    }

    public void setFirstNum(int firstNum) {
        this.firstNum = firstNum;
    }

    public int add() {
        int c = firstNum + secondNum;
        return c;
    }

    public int substract() {
        int c = firstNum - secondNum;
        return c;
    }

}

}

Above three rules are the most important rules to be kept in mind while writing any Java fixture for FitNesse test. After making sure on these rules, remaining rules for Java FitNesse fixtures are the basic Java programming rules which includes the import of required Java classes, packaging of these classes and compiling java files into binary class files.

Not only this, in order to make Java FitNesse fixtures look good, do the following standard practices.


⇓ Subscribe Us ⇓


If you are not regular reader of this website then highly recommends you to Sign up for our free email newsletter!! Sign up just providing your email address below:


 

Check email in your inbox for confirmation to get latest updates Software Testing for free.


  Happy Testing!!!
 
Exit mobile version