FitNesse Continued..
This article will discuss concept of SetUp and TearDown pages in the FitNesse. This will also look at how these pages can be applied to individual test case as well as test suite. If you are not familiar with the FitNesse, it is highly recommend that you read first part and make yourself familiar before reading this.

As their name suggest, SetUp and TearDown is used for the functions or steps that you need to execute before or after the execution of individual test case or test suite. Steps in SetUp could be related to setting up test environment, making some configuration files, creating test data, establishing database connection or anything specific to your need. In TearDown you might have steps opposite to SetUp, for example releasing database connection and bringing it to base state, removing test data and files and so on.

In order to create SetUp and TearDown test pages, it is necessary that you create a SubWiki in your FitNesse. In case you are not familiar with SubWiki, SubWiki is a hierarchical structure of pages with in your FitNesse Wiki. Creating Test Suite is a perfect example of SubWiki in FitNesse. You can create your test suite as MyTestSuite and start creating pages which extend from this page. For example, MyTestSuite.MyFirstTest will create a new page called MyFirstTest under MyTestSuite.

You need to define your SetUp and TearDown pages in the SubWiki. For the above example, you would create MyTestSuite.SetUp and MyTestSuite.TearDown pages. Name of these pages will indicate that these pages are SetUp and TearDown pages and FitNesse will automatically add these pages to any test page you create under this SubWiki. SetUp and TearDown are only included in test pages ( Test property is not selected in the page properties ) so non test pages of your SubWiki will not have SetUp and TearDown pages included at start and end. Similar to Test , there is one more page property which you will find useful Suite. If you select this property of your SubWiki main page, it will convert that page in TestSuite. This step will also add a button called suite on the SubWiki main page and all the test cases present in TestSuite can be executed from this page.  You can also create a list of test cases present in your Test Suite by using !contents on the main SubWiki page.

Steps defined in the SetUp and TearDown pages will be executed for every test you define in SubWiki. You might have some requirement where these steps should be executed before and after the execution of test suite as oppose to test case. In cases like this, you need to define SuiteSetUp and SuiteTearDown.

You can also modularize FitNesse pages by abstracting some common code and including those pages wherever you need them. You can include them using !include <pagename>. This makes FitNesse pages more maintainable.

Small tip towards the end, in case you do not know, you can improve readability of your FitNesse pages by using import feature and also you do not have to give ClassNameLikeThis in FitNesse. If you give Class Name Like This , FitNesse will understand this as well.

FitNesse and Eclipse

This section of the article will give you very brief information on how FitNesse can be used with your development environment if you are using Eclipse. One way to use FitNesse is directly adding its jar files and running the fitnesse class by defining your input and output files.  You need to define this in your run configuration with in your eclipse.

Another option that you might find very useful is this plugin. Using this plugin, you can have FitNesse instance running right inside your eclipse environment. This also gives you option of creating FitNesse root directory with in your project and launching FitNesse from there. You can also launch FitNesse on local machine or remote machine using the buttons that will be added by this plugin on the eclipse toolbar.

On the link given above, you can find a screencast explaining how this plugin can be used with in your eclipse shell.

Hope you found this article related to FitNesse useful. In the next series we will cover how FitNesse should be integrated with version control and cruise control to enable continuous integration. We will also try to cover fixtures in more detail in our next articles.

Recent Updates
Flash Objects and Selenium
Continuous Integration
Selenium Workshop
Delicious Testing
Pattern for automated testing of web applications
Exploratory Testing
 
Read More
Accessibility API Testing Article Backword BigBang Blackbox Blog Bottomup Boundary CaseStudies Certification DefectReport DistanceTest Equivalence FitNesse Geeks Graybox Guerrilla Testing Tips GUI HTA Humor Hybrid Internationalization Installation Integration Is it done? JUnit Measurement Mercury Quality Centre News One CPU better than two Patent PatternForAutomation Performace Checklist Rational Test Suite Regression Requirement Verification Research Rational Functional Tester Security Selenium Selenium Workshop SilkTest System Testing Templates TestComplete Tools Testing Types Testing Tools In News Testing Terms In News Testometer Test Plan TG Tips For Automation Top Down Integration Trait UAT UI Testing CheckList Unit Testing Usability VMWare Web Application Security Web Application Testing Checklist Whitebox Testing
Disclaimer  |  Privacy Policy  |  g e e k AT T e s t i n g G e e k DOT c o m
© Copyright 2008, www.TestingGeek.com