here

advertisement
FitNesse in Fifty
Minutes
Chris Harbert
Resonate
1
What is FitNesse?
FitNesse is an open source collaboration and testing framework
based on the wiki concept.
Written by Robert Martin (a.k.a “Uncle Bob”), a software
consultant and prolific author who was one of the original
signers of the “Agile Manifesto”.
2
What is FitNesse?
Wiki pages are suites, tests, or static pages.
Suites are organized into hierarchies.
• TestSuites
• TestSuites.SuiteOne
• TestSuites.SuiteOne.TestOne
• TestSuites.SuiteOne.TestTwo
You can run at the suite level or at the test level.
http://yourfitnesseurl/TestSuites.SuiteOne?suite
http://yourfitnesseurl/TestSuites.SuiteOne.TestOne?test
3
When to use FitNesse?
4
Collaboration
You want to encourage more collaboration around requirements and testing.*
* Results not typical.
When to use FitNesse?
5
Documentation
You want your tests to serve as documentation. The good kind.
When to use FitNesse?
6
Share the love
You want to provide the ability to write automated tests to a technical, but non-developer audience.
Example #1: Web Test (BDD)
7
Example #1: Web Test (BDD)
8
Example #2: Database/ETL
9
Example #3: Compare Excel Files
10
Example #4: Compare Query to Excel
11
Example #5: Verify Excel File Contents
12
Example #6: Taking Screenshots
13
Example #7: HBase
14
Other Fixtures
•
•
•
•
•
•
CSV File
REST API
Command Line / SSH
JIRA (e.g. to assert the ticket status)
PDF
Check Email
15
Creating Your First Fixture
Steps
1. Identify a test (or create one) that needs a fixture
implemented.
2. Select the appropriate fixture type.*
3. Implement the methods that fixture type expects.
4. Run the test.
* Fixtures can actually implement multiple fixture types
simultaneously. In some cases, existing classes can be used as is.
16
The Basic Fixture Types
Decision Table
Supplies the inputs and outputs for decisions. This is
similar to the Fit Column Fixture
Query Table
Supplies the expected results of a query. This is similar
to the Fit Row Fixture
Subset Query Table
Supplies a subset of the expected results of a query.
Ordered query Table
Supplies the expected results of a query. The rows are
expected to be in order. This is similar to the Fit Row
Fixture
Script Table
A series of actions and checks. Similar to Do Fixture.
Table Table
Whatever you want it to be!
Import
Add a path to the fixture search path.
Comment
A table that does nothing.
Scenario Table
A table that can be called from other tables.
Library Table
A table that installs fixtures available for all test pages
Define Table Type
A helper table that defines the default table type for
named fixtures.
Source: FitNesse User Guide
17
Options for Running Tests
• From the UI
• From the Command Line
• Using the web URLs
• … with HTML response
• … with XML response  useful for integration w/ build servers,
TCM systems, etc.
18
Additional Cool Stuff and Tips
•
•
•
•
Suite filters allow you to run any tests with a given tag.
Symbols can be used to pass data around.
Use SLIM tables, not older fixtures.
Use collapsed sections to hide setup and teardown in order to
increase readability.
19
When NOT to use FitNesse?
• You’re writing finegrained unit tests.
• Only developers will
see them.
• No one can write
fixtures.
20
Caveats
• Requires developers to provide appropriate fixtures (which
may be re-usable by non-developers).
• No parallel runs (out of the box ;) ).
• Is FitNesse dead?
21
Resources
• The website, http://fitnesse.org/
• The User Guide (included in link of install)
• The repo, https://github.com/unclebob/fitnesse
22
Download