SlideShare a Scribd company logo
FitNesse With Scala



         Meetu Maltiar
     Principal Consultant
   Email: meetu@knoldus.com
    Twitter:@meetumaltiar
FitNesse
It is an open-source automated framework created
  for software testing

It is excellent tool for collaboration in
  software development enabling developers,
  testers and customers to collaborate by
  writing tests

FitNesse is based on Ward Cunningham's framework
  for Integration Test (FIT) now developed by
  Robert C Martin
FitNesse Getting Stared

Download fitnesse-standalone.jar from fitnesse.org


Starting Fitnesse is by executing the jar file:
java -jar fitnesse-standalone.jar -p 9090
Note: Doing first time will create directories


You can now access FitNesse on URL: localhost:9090
FitNesse Overview
                    FitNesse


                                         Slim                System
     Tests             Wiki                       Fixtures
                                         Runner              Under Test
                               Results

Customer readable
Tests
FitNesse Overview..
FitNesse works by executing Wiki pages which
call custom written Fixtures

Fixtures act as a bridge between wiki pages
and the System Under Test

Fixtures can be written many programming
languages like java, Scala...
Tests And suites
FitNesse has Suite. It is a collection of
Tests. When we execute one Suite all tests
are run in a Suite.

For creating a TaxCalculationSuite, go to
localhost:9090/TaxCalculationSuite.

FitNesse is smart enough to open a new Suite
page. Save it by not adding any contents.
FitNesse With Scala
FitNesse With Scala
FitNesse Wiki Test

To create FitNesse wiki test, hover on
add button and select “Test”

It will open a new test page. Provide
TaxCalculationTest name for the Test for
now, and save it.
FitNesse With Scala
FitNesse With Scala
FitNesse With Scala
FitNesse Wiki Test

Writing Wiki Test page is simple. We
create wiki tables. Each row in a table
is separated by a pipe character.

For example a table header of id, name
and age is created like this
|id|name|age|
FitNesse Wiki Test
For TaxCalculation test we want to calculate
tax on annual salary.

Here is a simple rule of Tax. If annual
income is more than 100,000 it is 15%, or
else it is 10%.

The test in FitNesse Wiki must provide input
to Fixture code in Scala and we must assert
to compare output matched with actual
results.

|the tax for annual income|200000|is|30000|
FitNesse Wiki Test
|the tax for annual income|200000|is|30000| is a specification of intent
from a Tester or customer. Now, we can build support around this.

For us developers, we need to specify jars, classes and Fixture class
that we will be executing methods on.

For finding libraries and classes we use !path in FitNesse wiki.
!define TEST_SYSTEM {slim}
!path /Users/meetumaltiar/.sbt/boot/scala-2.9.1/lib/scala-library.jar
!path ../lib/fitlibrary-20080812.jar

Add above content at top of the test page and save. You will notice
proper classpath set.
FitNesse Wiki Test
We will have to load a specific class on which the
methods will be executed.

If our Fixture scala class is TaxCalculationFixture
in com.knoldus.fixture package. Then, we will have to
write following in FitNesse Wiki


|import|
|com.knoldus.fixture|

!|script | TaxCalculationFixture|
FitNesse Wiki Test
We need to write our test having assertions. We
will use DoFixture semantics in our Wiki.

|import|
|com.knoldus.fixture|

!|script | TaxCalculationFixture|
|the tax for annual income|200000|is|30000|

Above definition means that we have a method in
scala class TaxCalculationFixture:

def theTaxForAnnualIncomeIs(annualIncome:
Double, tax: Double): Boolean
FitNesse Wiki Test
|import|
|com.knoldus.fixture|

!|script | TaxCalculationFixture|
|the tax for annual income|200000|is|30000|

If we use DoFixture then each odd column is
a part of a method and each even column is
parameter to the method.

If method is written in camel case we can
write method in FitNesse wiki like a DSL
Completed Wiki Test
!define TEST_SYSTEM {slim}
!path /Users/meetumaltiar/.sbt/boot/scala-2.9.1/lib/scala-library.jar
!path ../lib/fitlibrary-20080812.jar


|import|
|com.knoldus.fixture|

!|script | TaxCalculationFixture|
|the tax for annual income|200000|is|30000|
|the tax for annual income|100000|is|10000|
FitNesse With Scala
FitNesse With Scala
Using DoFixture
To start with add a dependency of
fitnesse and fitlibrary in your SBT
project containing the fixture

libraryDependencies += "org.fitnesse" %
"fitnesse" % "20121220"

libraryDependencies += "org.fitnesse" %
"fitlibrary" % "20080812"
DoFixture
DoFixture is a Scala class extending DoFixture class
in FitLibrary

DoFixture is a Fixture and acts as a bridge between
wiki FitNesse tests and System under test

Each odd column in table in wiki corresponds to part
of method definition.

Each even column has parameters we can pass in
function defined in a DoFixture
TaxCalculationFixture
package com.knoldus.fixture

import fitlibrary.DoFixture
import com.knoldus.tax.TaxCalculatorService

class TaxCalculationFixture extends DoFixture {

  val taxCalculatorService = new TaxCalculatorService

  def theTaxForAnnualIncomeIs(annualIncome: Double, tax:
Double) =
taxCalculatorService.getTaxForAnnualIncome(annualIncome) ==
tax
}
TaxCalculatorService
package com.knoldus.tax

class TaxCalculatorService {

    def getTaxForAnnualIncome(annualIncome: Double):
Double = (annualIncome <= 100000.0) match {
      case true => annualIncome * 0.10
      case false => annualIncome * 0.15
  }
}
Running Tests
We can execute an individual FitNesse wiki
Test

We can execute all tests by running a Suite.
Running a suite will run all tests in a
Suite

We can organize Suites depending on
behavioral design of our application.
FitNesse With Scala
Code is available on Knoldus Github:
https://github.com/knoldus/ScalaFitnesse

               Thanks!!

More Related Content

PPT
2 fitnesse
PPT
Automated cceptance testing using Fitnesse & Selenium
PPT
Fitnesse - Acceptance testing
PPTX
Fundamentals of unit testing
PDF
Apex Testing Best Practices
PDF
Testlink Test Management with Teamforge
PDF
RFT Tutorial 4 How Do We Record A Script Using Rational Functional Tester - RFT
PPTX
Test Automation
2 fitnesse
Automated cceptance testing using Fitnesse & Selenium
Fitnesse - Acceptance testing
Fundamentals of unit testing
Apex Testing Best Practices
Testlink Test Management with Teamforge
RFT Tutorial 4 How Do We Record A Script Using Rational Functional Tester - RFT
Test Automation

What's hot (20)

PPT
Automation With A Tool Demo
PPTX
Bye Bye Cowboy Coder Days! (Legacy Code & TDD)
PPSX
TESTLINK INTEGRATOR
PDF
Win at life with unit testing
PPS
Introduction To Testlink
PDF
Need for automation testing
PPTX
Full Testing Experience - Visual Studio and TFS 2010
PDF
Quality Assurance
PPTX
Qa process 2012
PPTX
Test Automation Architecture in Microservices
PPTX
Test Classes in Salesforce
PPT
1.microsoft visual studio 2010 test manager
PPTX
Jenkins as the Test Reporting Framework
PPTX
Keyword-driven Test Automation Framework
PDF
Test Automation
PDF
KeytorcTestTalks #11 - Onur Başkirt, Agile Test Management with Testrail
PDF
Writing Testable Code
PDF
automation testing benefits
PPTX
Reaching for Your Quality Stretch Goals: Testing at Realtor.com
PPT
Automation test scripting guidelines
Automation With A Tool Demo
Bye Bye Cowboy Coder Days! (Legacy Code & TDD)
TESTLINK INTEGRATOR
Win at life with unit testing
Introduction To Testlink
Need for automation testing
Full Testing Experience - Visual Studio and TFS 2010
Quality Assurance
Qa process 2012
Test Automation Architecture in Microservices
Test Classes in Salesforce
1.microsoft visual studio 2010 test manager
Jenkins as the Test Reporting Framework
Keyword-driven Test Automation Framework
Test Automation
KeytorcTestTalks #11 - Onur Başkirt, Agile Test Management with Testrail
Writing Testable Code
automation testing benefits
Reaching for Your Quality Stretch Goals: Testing at Realtor.com
Automation test scripting guidelines
Ad

Viewers also liked (20)

PPTX
FitNesse, An Introduction
PPTX
Moving from Ad Hoc Testing to Continuous Test Data with FitNesse
PDF
Testing akka-actors
PDF
Methodologies for Test-Driven Development of OSGi enabled Embedded Devices - ...
PDF
TestWorks Conf 2015 Beefing up FitNesse - Arjan Molenaar
DOCX
Fitnesse user acceptance test - Presentation
PDF
Fitnesse, Watir and Ruby Based Test Automation System
PPTX
JavaLand: Quantified Social - Fitness-Geräte und -Portale mit Agorava
PDF
Coding Dojo for Testers/Testing Dojo: Designing Test Cases with FitNesse (2014)
PPTX
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
PPTX
Automatic web ui testing
PPT
Integration and Acceptance Testing
PDF
Agile Acceptance testing with Fitnesse
PPTX
Writing Acceptance Tests Using Fitnesse
PDF
Acceptance Test Driven Development
PPT
Fitnesse Testing Framework
PPTX
Continuous Integration using Hudson and Fitnesse at Ingenuity Systems (Silico...
ODP
Testing In Java
PPTX
Jira fundamentals
PDF
Introduction To Jira
FitNesse, An Introduction
Moving from Ad Hoc Testing to Continuous Test Data with FitNesse
Testing akka-actors
Methodologies for Test-Driven Development of OSGi enabled Embedded Devices - ...
TestWorks Conf 2015 Beefing up FitNesse - Arjan Molenaar
Fitnesse user acceptance test - Presentation
Fitnesse, Watir and Ruby Based Test Automation System
JavaLand: Quantified Social - Fitness-Geräte und -Portale mit Agorava
Coding Dojo for Testers/Testing Dojo: Designing Test Cases with FitNesse (2014)
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
Automatic web ui testing
Integration and Acceptance Testing
Agile Acceptance testing with Fitnesse
Writing Acceptance Tests Using Fitnesse
Acceptance Test Driven Development
Fitnesse Testing Framework
Continuous Integration using Hudson and Fitnesse at Ingenuity Systems (Silico...
Testing In Java
Jira fundamentals
Introduction To Jira
Ad

Similar to FitNesse With Scala (9)

PDF
Fitnesse With Scala
PDF
Bug bites Elephant? Test-driven Quality Assurance in Big Data Application Dev...
PPTX
Hands on training on DbFit Part-II
PPTX
Transferring Software Testing and Analytics Tools to Practice
PPT
Automated keyword driven framework using selenesse
PDF
PDF
Scala test
PPTX
WiKi Based Automation Testing: Fitness & DevOps
PDF
TAROT summerschool slides 2013 - Italy
Fitnesse With Scala
Bug bites Elephant? Test-driven Quality Assurance in Big Data Application Dev...
Hands on training on DbFit Part-II
Transferring Software Testing and Analytics Tools to Practice
Automated keyword driven framework using selenesse
Scala test
WiKi Based Automation Testing: Fitness & DevOps
TAROT summerschool slides 2013 - Italy

More from Knoldus Inc. (20)

PPTX
Angular Hydration Presentation (FrontEnd)
PPTX
Optimizing Test Execution: Heuristic Algorithm for Self-Healing
PPTX
Self-Healing Test Automation Framework - Healenium
PPTX
Kanban Metrics Presentation (Project Management)
PPTX
Java 17 features and implementation.pptx
PPTX
Chaos Mesh Introducing Chaos in Kubernetes
PPTX
GraalVM - A Step Ahead of JVM Presentation
PPTX
Nomad by HashiCorp Presentation (DevOps)
PPTX
Nomad by HashiCorp Presentation (DevOps)
PPTX
DAPR - Distributed Application Runtime Presentation
PPTX
Introduction to Azure Virtual WAN Presentation
PPTX
Introduction to Argo Rollouts Presentation
PPTX
Intro to Azure Container App Presentation
PPTX
Insights Unveiled Test Reporting and Observability Excellence
PPTX
Introduction to Splunk Presentation (DevOps)
PPTX
Code Camp - Data Profiling and Quality Analysis Framework
PPTX
AWS: Messaging Services in AWS Presentation
PPTX
Amazon Cognito: A Primer on Authentication and Authorization
PPTX
ZIO Http A Functional Approach to Scalable and Type-Safe Web Development
PPTX
Managing State & HTTP Requests In Ionic.
Angular Hydration Presentation (FrontEnd)
Optimizing Test Execution: Heuristic Algorithm for Self-Healing
Self-Healing Test Automation Framework - Healenium
Kanban Metrics Presentation (Project Management)
Java 17 features and implementation.pptx
Chaos Mesh Introducing Chaos in Kubernetes
GraalVM - A Step Ahead of JVM Presentation
Nomad by HashiCorp Presentation (DevOps)
Nomad by HashiCorp Presentation (DevOps)
DAPR - Distributed Application Runtime Presentation
Introduction to Azure Virtual WAN Presentation
Introduction to Argo Rollouts Presentation
Intro to Azure Container App Presentation
Insights Unveiled Test Reporting and Observability Excellence
Introduction to Splunk Presentation (DevOps)
Code Camp - Data Profiling and Quality Analysis Framework
AWS: Messaging Services in AWS Presentation
Amazon Cognito: A Primer on Authentication and Authorization
ZIO Http A Functional Approach to Scalable and Type-Safe Web Development
Managing State & HTTP Requests In Ionic.

Recently uploaded (20)

PPTX
O2C Customer Invoices to Receipt V15A.pptx
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
WOOl fibre morphology and structure.pdf for textiles
PDF
Architecture types and enterprise applications.pdf
PPT
What is a Computer? Input Devices /output devices
PPT
Module 1.ppt Iot fundamentals and Architecture
PDF
DP Operators-handbook-extract for the Mautical Institute
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PPTX
TLE Review Electricity (Electricity).pptx
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
A novel scalable deep ensemble learning framework for big data classification...
PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
STKI Israel Market Study 2025 version august
PPTX
Chapter 5: Probability Theory and Statistics
PDF
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
project resource management chapter-09.pdf
O2C Customer Invoices to Receipt V15A.pptx
Final SEM Unit 1 for mit wpu at pune .pptx
Hindi spoken digit analysis for native and non-native speakers
WOOl fibre morphology and structure.pdf for textiles
Architecture types and enterprise applications.pdf
What is a Computer? Input Devices /output devices
Module 1.ppt Iot fundamentals and Architecture
DP Operators-handbook-extract for the Mautical Institute
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
TLE Review Electricity (Electricity).pptx
NewMind AI Weekly Chronicles - August'25-Week II
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
gpt5_lecture_notes_comprehensive_20250812015547.pdf
A novel scalable deep ensemble learning framework for big data classification...
Getting started with AI Agents and Multi-Agent Systems
STKI Israel Market Study 2025 version august
Chapter 5: Probability Theory and Statistics
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
Developing a website for English-speaking practice to English as a foreign la...
project resource management chapter-09.pdf

FitNesse With Scala

  • 1. FitNesse With Scala Meetu Maltiar Principal Consultant Email: meetu@knoldus.com Twitter:@meetumaltiar
  • 2. FitNesse It is an open-source automated framework created for software testing It is excellent tool for collaboration in software development enabling developers, testers and customers to collaborate by writing tests FitNesse is based on Ward Cunningham's framework for Integration Test (FIT) now developed by Robert C Martin
  • 3. FitNesse Getting Stared Download fitnesse-standalone.jar from fitnesse.org Starting Fitnesse is by executing the jar file: java -jar fitnesse-standalone.jar -p 9090 Note: Doing first time will create directories You can now access FitNesse on URL: localhost:9090
  • 4. FitNesse Overview FitNesse Slim System Tests Wiki Fixtures Runner Under Test Results Customer readable Tests
  • 5. FitNesse Overview.. FitNesse works by executing Wiki pages which call custom written Fixtures Fixtures act as a bridge between wiki pages and the System Under Test Fixtures can be written many programming languages like java, Scala...
  • 6. Tests And suites FitNesse has Suite. It is a collection of Tests. When we execute one Suite all tests are run in a Suite. For creating a TaxCalculationSuite, go to localhost:9090/TaxCalculationSuite. FitNesse is smart enough to open a new Suite page. Save it by not adding any contents.
  • 9. FitNesse Wiki Test To create FitNesse wiki test, hover on add button and select “Test” It will open a new test page. Provide TaxCalculationTest name for the Test for now, and save it.
  • 13. FitNesse Wiki Test Writing Wiki Test page is simple. We create wiki tables. Each row in a table is separated by a pipe character. For example a table header of id, name and age is created like this |id|name|age|
  • 14. FitNesse Wiki Test For TaxCalculation test we want to calculate tax on annual salary. Here is a simple rule of Tax. If annual income is more than 100,000 it is 15%, or else it is 10%. The test in FitNesse Wiki must provide input to Fixture code in Scala and we must assert to compare output matched with actual results. |the tax for annual income|200000|is|30000|
  • 15. FitNesse Wiki Test |the tax for annual income|200000|is|30000| is a specification of intent from a Tester or customer. Now, we can build support around this. For us developers, we need to specify jars, classes and Fixture class that we will be executing methods on. For finding libraries and classes we use !path in FitNesse wiki. !define TEST_SYSTEM {slim} !path /Users/meetumaltiar/.sbt/boot/scala-2.9.1/lib/scala-library.jar !path ../lib/fitlibrary-20080812.jar Add above content at top of the test page and save. You will notice proper classpath set.
  • 16. FitNesse Wiki Test We will have to load a specific class on which the methods will be executed. If our Fixture scala class is TaxCalculationFixture in com.knoldus.fixture package. Then, we will have to write following in FitNesse Wiki |import| |com.knoldus.fixture| !|script | TaxCalculationFixture|
  • 17. FitNesse Wiki Test We need to write our test having assertions. We will use DoFixture semantics in our Wiki. |import| |com.knoldus.fixture| !|script | TaxCalculationFixture| |the tax for annual income|200000|is|30000| Above definition means that we have a method in scala class TaxCalculationFixture: def theTaxForAnnualIncomeIs(annualIncome: Double, tax: Double): Boolean
  • 18. FitNesse Wiki Test |import| |com.knoldus.fixture| !|script | TaxCalculationFixture| |the tax for annual income|200000|is|30000| If we use DoFixture then each odd column is a part of a method and each even column is parameter to the method. If method is written in camel case we can write method in FitNesse wiki like a DSL
  • 19. Completed Wiki Test !define TEST_SYSTEM {slim} !path /Users/meetumaltiar/.sbt/boot/scala-2.9.1/lib/scala-library.jar !path ../lib/fitlibrary-20080812.jar |import| |com.knoldus.fixture| !|script | TaxCalculationFixture| |the tax for annual income|200000|is|30000| |the tax for annual income|100000|is|10000|
  • 22. Using DoFixture To start with add a dependency of fitnesse and fitlibrary in your SBT project containing the fixture libraryDependencies += "org.fitnesse" % "fitnesse" % "20121220" libraryDependencies += "org.fitnesse" % "fitlibrary" % "20080812"
  • 23. DoFixture DoFixture is a Scala class extending DoFixture class in FitLibrary DoFixture is a Fixture and acts as a bridge between wiki FitNesse tests and System under test Each odd column in table in wiki corresponds to part of method definition. Each even column has parameters we can pass in function defined in a DoFixture
  • 24. TaxCalculationFixture package com.knoldus.fixture import fitlibrary.DoFixture import com.knoldus.tax.TaxCalculatorService class TaxCalculationFixture extends DoFixture { val taxCalculatorService = new TaxCalculatorService def theTaxForAnnualIncomeIs(annualIncome: Double, tax: Double) = taxCalculatorService.getTaxForAnnualIncome(annualIncome) == tax }
  • 25. TaxCalculatorService package com.knoldus.tax class TaxCalculatorService { def getTaxForAnnualIncome(annualIncome: Double): Double = (annualIncome <= 100000.0) match { case true => annualIncome * 0.10 case false => annualIncome * 0.15 } }
  • 26. Running Tests We can execute an individual FitNesse wiki Test We can execute all tests by running a Suite. Running a suite will run all tests in a Suite We can organize Suites depending on behavioral design of our application.
  • 28. Code is available on Knoldus Github: https://github.com/knoldus/ScalaFitnesse Thanks!!