DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workkloads.

Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Scriptless Testing in a Mobile World
  • Selenium vs Cypress: Does Cypress Replace Selenium?
  • Top 11 Selenium Testing Misconceptions You Should Know
  • Appium vs Robotium

Trending

  • Google Cloud Document AI Basics
  • Top Book Picks for Site Reliability Engineers
  • Medallion Architecture: Why You Need It and How To Implement It With ClickHouse
  • Building Scalable and Resilient Data Pipelines With Apache Airflow
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Testing, Tools, and Frameworks
  4. Integrating FitNesse with Selenium

Integrating FitNesse with Selenium

This tutorial demonstrates how to integrate testing validation tool FitNesse with Selenium to define testing criteria and display pass/fail results.

By 
Remi Andonissamy user avatar
Remi Andonissamy
·
Apr. 09, 20 · Tutorial
Likes (5)
Comment
Save
Tweet
Share
13.9K Views

Join the DZone community and get the full member experience.

Join For Free

In this article, we will understand how to integrate Selenium, an open-source functional automation tool with FitNesse with a simple example.

Scenario Outline

Harry is working in Selenium on the Demowebshop application. This is a demo application given by Tricentis for public usage. Let's assume Harry wants to test the login screen of this application with three sets of data as given below:

Username

Password

Result

remi.jullian@accenture.com

test@1234

Valid User

peter.john@accenture.com

Selenium

Invalid User


test@1234

Valid User

Let's help Harry use FitNesse and create a neat acceptance test framework defining the given sets of data, and link it with Selenium code to show whether the username/password combination has passed or failed.

Sample Acceptance Criteria - During Test Plan Stage:

Sample Acceptance Criteria - During Test Plan Stage

Sample Acceptance Criteria - During Test Plan Stage


Sample Acceptance Criteria - After Test Execution Stage: 

Sample Acceptance Criteria - After Test Execution Stage

Sample Acceptance Criteria - After Test Execution Stage


Solution Steps

FitNesse is an open-source acceptance testing framework that is used to define understandable acceptance criteria. These test cases are validated against the actual test scripts created using conventional tools like Selenium or Protractor. 

Validating acceptance tests generally takes place at the end-user site. These tests are black box in nature. We will not worry about the internal functionalities, but instead we will ensure that for valid inputs, we are getting the expected outcome. Similarly, for invalid inputs we are getting the invalid output. 

Selenium is a open-source test automation framework used to automate browsers. It supports testing in various operating systems and browsers. Selenium is used for mobile testing also. 

How to Configure FitNesse in Windows

To set up FitNesse, the prerequisites are:

1. Fitness jar (It can be downloaded from the official website of FitNesse.)

2. Java 8 and above

3. Eclipse IDE

Step 1: Download the FitNesse jar.

Fitnesse jar download

Fitnesse jar download


Step 2: In the command prompt, type java -jar fitnesse-standalone.jar -p 8080. This will setup FitNesse in port - 8080. Wait for the success message from FitNesse.

Step 3: Open any browser and type http://localhost:8080. This will launch FitNesse Server. We call this the "FitNesse Wiki."

Fitnesse wiki

Fitnesse wiki


How to Create a Test Case in FitNesse

In FitNesse, we must use the CamelCase convention to name a page. 

Step 1: Go to FitNesse Wiki home page and click “Edit.”

Step 2: Delete the default contents and add a text “LoginTestDemo” and click Save. This will create an empty test page.

Step 3: We will now add a test case “LoginTest” in the “LoginTestDemo” page. To do this, go to “LoginTestDemo” page -> Add -> TestPage and give the name “LoginTest” and save it.

LoginTest

LoginTest


Step 4: This will create a LoginTest case as a link. Click the link to add logic to our Login test case.

Step 5: In FitNesse, test cases are written in the “Datatable” format using the “|” symbol. A sample test combination is given below:

Sample test combination

Sample test combination



DemoWebShopLoginCheck is the name of the test,  urlGiven,  username , and  password are parameters, and  openURL()and  login()  are functions.

I'm creating a test case logic so that when I give the url http://demowebshop.tricentis.com with username remi.jullian@accenture.com and password test@1234. The openURL function will return “Success” if the URL opens successfully and the login function will return “Valid user” testing the credentials given against the web application. 

This data are tested again in the application using conventional tools like Selenium and the result is captured and displayed in FitNesse. 

We can create multiple test scenarios to test valid and invalid credentials by adding more rows in the test case page. 

Please refer to one sample test combination added for an invalid user.

Valid login display

Valid login display


Step 6: Once we save the test, the LoginTest case page will look like:

LoginTest case page

LoginTest case page


Step 7: We have created the test page, and to test it we must click the “Test” link in the main menu of FitNesse Wiki. 

Step 8: If we click “Test,” FitNesse will execute the page and we will now get a result saying “Could not find fixture: DemoWebShopLoginCheck” as below:

Error

Error


What is a Fixture?

The actual code available to test the login logic created in our FitNesse Wiki is called "Fixture Code." In other words, Fixture is the final code or the application to test. We will use the FitNesse wiki page to test the fixture created by the development team. 

Step 1: In our case study, we are going to write the fixture code in Java. For this, we are going to use Eclipse IDE.

Step 2: Create a Java project “FitNesse” and create a package inside called “demoWebshopLogin." Create a class file named “DemoWebShopLoginCheck.” This class file is our fixture code. 

Step 3: Import Selenium jars and the FitNesse jar to our Java project

Importing jars

Importing jars


Step 4: The sample application “Demo Web Shop” which we are going to test with the data provided in FitNesse Wiki using Selenium is as below:

Demo web shop

Demo web shop


Note: This is a demo application from http://www.demowebshop.tricentis.com. You can use this application for practicing demos. 

Step 5: Create the fixture code in Selenium to interact with the application testing both valid and invalid data and extend the fixture code to  ColumnFixture built-in class of FitNesse library. 

Create fixture code

Create fixture code


Step 6: Edit the FitNesse wiki code, mentioning the path of the fixture code class file and the package name loginCheckSelenium using the Import keyword as below:

Using the Import keyword

Using the Import keyword


Step 7: Refer all the Selenium jar files used in fixture code in the wiki page:

Selenium jar

Selenium jar


Step 8: Run the test. FitNesse will look for the fixture code and execute it through Selenium. Selenium will return the results back to the FitNesse page. 

Step 9: Outcome page defining the acceptance criteria will look like:

Outcome page

Outcome page

Conclusion

We have linked FitNesse successfully with Selenium and executed our tests and got the status back from Selenium and displayed in the FitNesse wiki. FitNesse helps to define the acceptance criteria, link it with a traditional test automation tool like Selenium, and get the results back as show whether the criteria passed or failed. This tool helps the customers/end-users to understand the acceptance criteria correctly and see finally how many defined criteria passed and failed.

FitNesse Testing mobile app Open source Fixture (tool) Test case JAR (file format)

Opinions expressed by DZone contributors are their own.

Related

  • Scriptless Testing in a Mobile World
  • Selenium vs Cypress: Does Cypress Replace Selenium?
  • Top 11 Selenium Testing Misconceptions You Should Know
  • Appium vs Robotium

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!