Selenium with FitNesse – Acceptance testing Framework

Selenium Integration with FitNesse Acceptance testing framework

FitNesse is a web server, a wiki, and an automated testing tool for software. FitNesse is a software development collaboration tool. FitNesse is designed to support acceptance testing rather than unit testing in that it facilitates detailed readable description of system function.

FitNesse enables customers, testers, and programmers to learn what their software should do, and to automatically compare that to what it actually does do. It compares customers’ expectations to actual results.
In other words,
FitNesse is a lightweight, open-source framework that makes it easy for software teams to:
1. Collaboratively define Acceptance Tests
2. Run those tests and see the results

Working of FitNesse

Getting started:

  • We can easily create and edit pages
  • It requires no configuration or setup.
  • Just run it and then direct your browser to the machine where it is running

The Overview of Integrating the Selenium Remote Control with FitNesse:

  • Create an object for Selenium in a code.
  • Pass the required parameters
  • Start the selenium server and run the script by using FitNesse tool

Now we will get started in preparing the test environment for both FitNesse as well as Selenium


  1. Get the latest version of the jar file “FitNesse jar” from the below site
  2. Download Here.

  3. Place it in your local drive and consider it as Base location
  4. Unpack jar by typing the below command after navigating to the Base location via command prompt
    Java –jar fitNesse.jar
  5. Once we got the folder “FitNesseRoot” and unpack process is over, close the command prompt.
  6. Create a new folder “Libraries” in the Base location (it is used to place our selenium stuff related jars)

Selenium part:
Create a new project in Eclipse. You can also refer my post on creating a new project structure

package SamplePackage;

import com.thoughtworks.selenium.DefaultSelenium;

public class FirstClass
  DefaultSelenium selenium;
//Constructor method
public FirstClass(String host, int port, String browser, String baseURL)
    this.selenium = new DefaultSelenium(host, port, browser, baseURL);

public boolean open(String URL) {;
    return true;

public boolean type(String locator, String value) {
    boolean elementFound = this.seleniumInstance.isElementPresent(locator);
    if (elementFound) {
      this.seleniumInstance.type(locator, value);
    return elementFound;
public boolean click(String locator) {
    boolean elementFound = this.seleniumInstance.isElementPresent(locator);
    if (elementFound) {;
    return elementFound;
public boolean verifyResultPage(String locator) {
    boolean elementFound = this.seleniumInstance.isElementPresent(locator);
    return elementFound;

public boolean close() {
    return true;
public boolean stop() {
    return true;


Convert the program files as Jar file with name “SampleJarFile” using Eclipse IDE export option

Integration of FitNesse and Selenium

1) Place the jar files “SampleJarFile.jar” and “Selenium-Server.jar” in the folder “Libraries” which is in the FitNesse Base location

2) Start the FitNesse Server from the base location by using below command in the command prompt
java -cp fitnesse.jar fitnesseMain.FitNesseMain -p 8080 -e 0 -o %1 %2 %3 %4 %5

Here, I have given the port no as 8080. If you are getting any message like “Port 8080 is already in use.”
Then use some other ports. Say 8081, 8082, 8083…

3) Open the browser and type the below address url to view the FitNesse wiki page

4) You can see the FrontPage of the wiki page.

5) Click on “add child” next to the text “FrontPage” and you will get the light box to create the page.

6) Enter our first wiki page with the name as “FirstWikiPage” and select “Normal” option from the left pane. (Note: you have use camel letter to name the wiki pages)

7) Click on “Add” button

8) Click on the “FirstWikiPage” link and Navigate to that page

9) To get the Tree Hierarchy structure for our test execution, we are going to create Test suite and Tests

10) First Click on the “add child” link next to the text “FirstWikiPage”

11) Enter the Test suite name as “FirstTestSuite” and select “Suite” option from the left pane

12) Click on “Add” button

13) Now, the Test suite will be listed under “FirstWikiPage”

14) In the Test suite page “FirstTestSuite”, we have to define the Test system of the FitNesse framework and also we need to mention Class path of the selenium scripts.

15) Click on the link “FirstTestSuite” and it will open the corresponding page

16) Click on “Edit” button from the left page and Paste the below comments
!contents -R3 -g -p -f -h

!define TEST_SYSTEM {slim}

Class Path
!path Libraries \*.jar

17) Now inside the page “FirstTestSuite” we have to create
a. Tests page (activites which we need to verify in the application)
b. SetUp page (Initial step to perform before Tests page execution)
c. TearDown page (Final step to perform after Tests page execution)
Note: Once we created the SetUp and TearDown page. It will display for all the tests by default.

18) Create the test page with the name “FirstTestCase”, SetUp page with the name “SetUp” and TearDown page with the name “TearDown”

19) When creating the test page you have to select the“test” option and when creating the “SetUp” & “TearDown” page you have select the “Normal” option.

20) Write the comments as below with respect to the pages
a) Set Up page
!|import |
| SamplePackage |

!define BrowserType1 {*iexplore}

|start|First Class|localhost|4444|${BrowserType1}| |

b) TearDown page

c) FirstTestCase page

|type;| id=gbqfq|Test |
|click;| id=gbqfba|
|verifyResultPage;| css=em|

And Save it. That’s all now you have created the sample scripts which open the browser, type the searchkeyword, click the Search button and verify the result is displayed or not

How to Execute Selenium tests via FitNesse ?

After completing the creation of the page, navigate to the page “FirstTestCase”.
The page will be looked like below,

Start the selenium server and Click on “Test” button from the left pane of the page “FirstTestCase”.
It will automatically invoke the browser and it performs action defined in the fitNesse page.

3 Responses to “Selenium with FitNesse – Acceptance testing Framework”
  1. Sam says:

    Great stuff, thanks.

  2. shan says:

    hi manoj.. great stuff and thanks for sharing it…
    can we integrate selenium webdriver with Fitnesse?
    if yes can u please share some code with webdriver

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: