Fitnesse Testing Framework

13,978 views 28 slides May 22, 2012
Slide 1
Slide 1 of 28
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28

About This Presentation

No description available for this slideshow.


Slide Content

FitNesse
On the Road to Success
by ajit Koti

What we will cover today
What is FitNesse?
Tradition Approach
Quick introduction
Quick Demo
How it works
Different types of tables
Conclusion

Traditional Approaches for acceptance
testing
Manual Acceptance testing. User
exercises the system manually using
his creativity.
Acceptance testing with “GUI Test
Drivers” (at the GUI level). These
tools help the developer do
functional/acceptance testing through a
user interface such as a native GUI or
web interface. “Capture and Replay”
Tools capture events (e.g. mouse,
keyboard) in modifiable script.
Disadvantages:
expensive, error prone,
not repeatable, …
Disadvantages:
expensive, error prone,
not repeatable, …

Framework for Integrated Testing
FitNesse, a wiki using Fit
Defining Acceptance Tests, checking that “We are
building the right thing”
Creating a feedback loop between customers,
testers and programmers
Provides a one-click test environment
Fit / FitNesse

What is FitNesse?
FitNesse is a software development collaboration tool
Great software requires collaboration and communication.
FitNesse is a tool for enhancing collaboration in software
development.
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.
It's an invaluable way to collaborate on complicated
problems (and get them right) early in development

What is Fit?
The Framework for Integrated Test (Fit) is the most well-
known implementation (open source framework) of the
table-based acceptance testing approach.
Fit lets customers and analysts write “executable”
acceptance tests using simple HTML tables.
Developers write “fixtures” to link the test cases with the
actual system itself.
Fit compares these test cases, written using HTML tables,
with actual values, returned by the system, and highlights
the results with colors and annotations.

Now some Demos
Simple Calculator
Discount Calculator

What we will cover today
What is FitNesse?
How it works
 Using Fit
 Fit table
 Fixture
 Test Runner
Different types of tables
Conclusion

Using Fit
Just two steps are required to automate user
acceptance tests using Fit:
Express a test case in the form of a Fit table.
Write the glue code, called a Fixture, that bridges
the test case and system under test.
That's it!
You are all set to execute the tests automatically for
the rest of the application’s lifetime.

Fit table
A Fit table is a way of expressing the business
logic using a simple HTML table.
Fit tables help developers better understand the
requirements and are used as acceptance test
cases.
Customers and Analysts create Fit tables using a
tool like Word, Excel, or even a text editor

Fixture
A fixture is an interface between the test
instrumentation (in our case, the Fit framework),
test cases (Fit tables), and the system under test.
Fixtures are procedures/functions/classes
usually written by developers.
In general, there is a one-to-one mapping between
a Fit table and fixture.

Test Runner
The Test runner
compares the
customer-set
expectations with the
actual results and
reports any errors by
color-coding the table
rows. 75572638Wigan
100 expected
-------------------
93 actual
213538Dummy
93213538Chelsea
541622038Aston Villa
83523138Arsenal
rating()lostdrawnwonplayedteam name
sample.VerifyRating
“red for failures and green for passed tests”

How it works
The text is interpreted so it can trigger the
fixtures that call the System-Under-Test
(SUT)
Fit interprets the results and display
Pass/Fail in each cell
Proper syntax is key
Not so hard to learn…
…after you get going

The Fit picture
User Story
Fit Table
Fixture
Customer/
Analyst (i, o)
System
i
o’
Developer
o ≠ o’
Test Runner
Output Table
O = expected output
O’ = actual output

Fixture Class
Public Class Calculator

Public Number1 As Double
Public Number2 As Double
Private _oSUTCalculator As
DemoSUT.SUTCalculator
Public Sub New()
_oSUTCalculator = New
DemoSUT.SUTCalculator
End Sub
Public Function Product() As Double
Return _oSUTCalculator.Multiply(Number1,
Number2)
End Function
End Class
System Under Test
Public Class SUTCalculator
Public Function Multiply( _
ByVal firstNumber As Double, _
ByVal secondNumber As Double) _
As Double
Return firstNumber * secondNumber
End Function
End Class
Table, Fit, and
Fixture together
Fixture and SUT
working together

What we will cover today
What is FitNesse?
How it works
Different types of tables
 Decision Table
 Query table
 Script Table
 Table Table
Conclusion

Different styles of Tables
Test System
Fit
Slim

Fit Tables
ColumnFixture
This is the style you may end up using most: rows of data represent
inputs and expected outputs.
RowFixture
This is good for testing queries that should return an exact set of
values (order-independently)
.ActionFixture
This style allows you write a script that emulates a series of events
(such as controls manipulated on a user interface).
Comment Tables
Sometimes you want a tablular comment that is not executed as a
test.

The SLIM Test System
Slim (Simple List Invocation Method) is an alternative to Fit. Rather than
running all the HTML processing, comparisons, and colorizing in the
System Under Test (SUT), Slim keeps all that behavior on in FitNesse.
What executes in the SUT is a very tiny kernel that implements the
Slim Protocol. This protocol is a bare bones RPC system that allows
FitNesse to call functions in the SUT.
Different table styles in Slim
Decision Table
Query Table
Subset Query Table
Ordered query Table
Script Table
Table Table

Decision Table
Decision Tables are a common way to get test data into a
System Under Test.
A Decision table has three parts
One Title Row - Names the fixture to execute, optionally
includes constructor parameters
One Heading Row - Names of columns, which map to
either setter methods or method calls (if they end in ?)
Zero or more Data Rows - rows of data used to either
provide data into a system or data used to compare to
values returned from the fixture

Query table
A Query table is a means of performing a single query
and verifying the results.
They can pass parameters into the constructor of their
fixture.
They expect a method, query, which returns a List of a List
of a List of strings.
.

Script Table
Script tables are a convenient way to introduce code-
like sequences into your tests.
They derive their design from Smalltalk keyword messages but other
than that, they behave like other Slim tables:
They are backed with a fixture
They have one or more method invocations, one per line.
There are several keywords you can start a line with such as show and
check.
The full method name is in parts, alternating with parameters passed in
to the backing fixture.
The method name starts in cell 1 if the line does not start with one of a
small set of pre-defined keywords (check, reject, ...). Otherwise, it
begins in cell 2.

Table Table

What we will cover today
What is FitNesse?
How it works
Different types of tables
Conclusion
 How to get help
 Q& A

Conclusions
Manual acceptance testing is expensive, error prone and
not repeatable.
Fit/Fitnesse is a tool to write, organize and execute table-
based tests.
Fit tables help to clarify “textual requirements”.
Fit tables “are requirements verifiable and executable”.
Fit is compatible with Junit.
The motivation of Fit/Fitnesse testing is demonstrating
working functionalities while the motivation of Junit is
finding faults

How to get help
Fitnesse on the web
To install FitNesse
WORKING WITH FITNESSE WIKI PAGES
VIDEO TUTORIALS
A great book “ Fit for Developing Software” with its samples

Q & A

Thank You
Tags