Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

FitNesse to Perform UAT: Part I

DZone's Guide to

FitNesse to Perform UAT: Part I

FitNesse, a UAT tool, allows users to add and edit test cases on a Wiki page without needing to know any of the technical details.

· Agile Zone
Free Resource

Reduce testing time & get feedback faster through automation. Read the Benefits of Parallel Testing, brought to you in partnership with Sauce Labs.

FitNesse is a Wiki web server and an automated user acceptance testing tool where tests can be written on Wiki web pages and can be executed from Wiki.

Users are not supposed to understand the complex software application; they need to simply edit and create new Wiki pages and write the test cases in readable format there itself.

The origin of FitNesse was to better support Agile methodology and to perform User Acceptance Testing. In short, it's a kind of black-box testing in which a System Under Test (SUT) is considered to be a black box and is tested in terms of the outputs generated in response to predetermined inputs.

A functional guy can add the tests as per business and express them within the FitNesse tool. On the other side, the developer's job is to write the code to connect the FitNesse tool to the system that's a candidate for testing so that FitNesse can execute the test and compare the actual output to the expected output.

FitNesse Components

FitNesse looks like this: Front-end (Wiki page) <----> Fixtures (Java or any supported Code) <----> System Under Test (SUT).

Front-End (Wiki Page)

This is basically test tables that invoke the methods in fixture classes and use outputs to determine test success or failure. It's generally written by QA or Business Users.

Fixture

Fixture is basically a Java (or other supported language) code that receieves input from test tables and invoke methods in System under test classes. It's written by developers.

System Under Test (SUT)

This is the actual application which is going to test. It's written by developers.

FitNesse tests may be run on top of either Fit (which is default), using additional fixtures in FitLibrary, or Slim.

The jar fitnesse-20121220-standalone.jar is required.

Running the Fitnesse Wiki Server

To run the Wiki server, make sure that you have Java installed and execute the below command from the directory where your FitNesse jar is present:

java -jar fitnesse-20121220-standalone.jar -p 8086 

(-p here indicates port, which is 8086.)

After the execution of the above command, the server will be started as you can see below:

Image title

Now, you can see the default wiki page in any browser as below:

Image title

After getting the page, click the Edit button, enter the below line as the second-to-last line to add your test suite named MytestSuite, and save.

| [[MyTestSuite][FitNesse.MyTestSuite]]|''MyTestSuite''| 

Now you can see the front page, which has an entry for your test suite as well, as shown below:

Image title

Now, click on the MyTestSuite hyperlink and you will get another page. Click the Edit button on that new page to add all essential one-time set-up data like Jar details, importing packages, etc., as seen below:

!contents -R2 -g -p -f -h
!|${calcTest}|
|val 1|val 2|multiply?|
|8|9|72.0|

Save the page. You can now add a child test suite or test page that actually contains test data. Here, I am adding one child test suite as below:

Image title

After adding the child test suite, it will look like this:

Image title

Add the test page under Child Test Suite and give the name as TestPage1, keeping the below contents:

!contents -R2 -g -p -f -h
!|${calcTest}|
|val 1|val 2|multiply?|
|8|9|72.0|

Now, save the page. It will look like this: 

Image title

In this example, my SUT is a Calculator program.

We are having the Fixture (Java program) take the responsibility of this test. Below, the Fixture is responsible for interacting with the Wiki page that is inside experiment.jar:

package exper.test.fitnesse;
public class SimpleCalculationTest {
  private double val1;
  private double val2;
  private SimpleCalculator calculator = new SimpleCalculator();

  public double multiply(){
    calculator.setVal1(val);
    calculator.setVal2(val2);
    return calculator.multiply();
  }
  public double getVal1() {
    return val1;
  }
  public void setVal1(double val1) {
    this.val1 = val1;
  }
  public double getVal2() {
    return val2;
  }
  public void setVal2(double val2) {
    this.val2 = val2;
  }
}

Now, let's see the SUT:

package exper.test.fitnesse;

public class SimpleCalculator {

  private double val1;
  private double val2;

  public double multiply(){
    return val1 * val2;
  }

  public double getVal1() {
    return val1;
  }

  public void setVal1(double val1) {
    this.val1 = val1;
  }

  public double getVal2() {
    return val2;
  }

  public void setVal2(double val2) {
    this.val2 = val2;
  }
}

Now run the Tests using the Test button. You can see the result on the Wiki page as below:

Image title

That's all. Now, users can add and edit the test cases on the Wiki page without worrying about any of the technical details. Enjoy!

The Agile Zone is brought to you in partnership with Sauce Labs. Discover how to optimize your DevOps workflows with our cloud-based automated testing infrastructure.

Topics:
fitnesse ,user acceptance testing ,agile

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}