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 acceptancetesting Manual Acceptance testing. User exercises the system manually using his creativity. Disadvantages: expensive, error prone, not repeatable, … 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 Disadvantages: expensive, error prone, web interface. “Capture and Replay” not repeatable, … Tools capture events (e.g. mouse, keyboard) in modifiable script.
Fit / FitNesse 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
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. Its 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 FitJust 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.Thats 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 sample.VerifyRating compares the team name played won drawn lost rating() customer-set Arsenal 38 31 2 5 83 expectations with the Aston Villa 38 20 2 16 54 actual results and Chelsea 38 35 1 2 93 reports any errors by Dummy 38 35 1 2 100 expected ------------------- color-coding the table 93 actual rows. Wigan 38 26 7 5 75 “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 Output Table o ≠ o’ Developer Fixture Test Runner o’Customer/ iAnalyst (i, o)User Story System Fit Table O = expected output O’ = actual output
Table, Fit, and Fixture togetherFixture ClassPublic Class Calculator Fixture and SUT Public Number1 As Double Public Number2 As Double working together Private _oSUTCalculator AsDemoSUT.SUTCalculator Public Sub New() _oSUTCalculator = New System Under TestDemoSUT.SUTCalculator Public Class SUTCalculator End Sub Public Function Multiply( _ ByVal firstNumber As Double, _ Public Function Product() As Double ByVal secondNumber As Double) _ Return _oSUTCalculator.Multiply(Number1, As DoubleNumber2) Return firstNumber * secondNumber End Function End Function End ClassEnd Class
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 TablesTest 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 TableDecision 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.
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 helpFitnesse on the webTo install FitNesseWORKING WITH FITNESSE WIKI PAGESVIDEO TUTORIALSA great book “ Fit for Developing Software” with its samples