Once the FitNesse set up is completed, next step is to write test scripts and run them properly to get the right results. In this chapter, we are going to see how to organize test scripts in FitNesse and how to run them in order. Ordering and grouping are very important when we want to have a clean set of test scripts. Let’s dig in to the organizing first.
Organizing Tests In FitNesse:
When we discuss about organizing tests in Fitnesse, there are no standard rules but logical order. Let me explain this in detail with an example. Say, you have a website which you want to test using automated scripts using FitNesse tool. You have got 4 different pages to test namely Home, About Us, and blog and Contact US. To write fixtures and use them in FitNesse, you will have to write four different autotest scripts, one for each web page OR if a web page has multiple features then you will write autoscripts for each feature to test it thoroughly and then include that script under a test suite which has all the test scripts related to that web page. It is similar to grouping of test cases where similar kind of test scripts are grouped together under the same suite. To identify each of them, “Tags” can be used. You will find this property under “properties” on the left hand side bar of FitNesse.
Now, let’s understand what is meant by “logical order”? So, when you test any software, there is always an order which should be followed for most effective testing practice.
Consider the below web page.
We have three main things to test, contact form, comment form and then social media. Fitnesse will have 3 auto test scripts namely
WebTesting.ContactAndSocialMediaTesting.ContactForm,WebTesting.ContactAndSocialMediaTesting.CommentForm,WebTesting.ContactAndSocialMediaTesting.SocialMedia
All the above three will come under one suite namely
WebTesting.ContactAndSocialMediaTesting. Here, the logical order would be to test contact form first then social media and last is comment form. Since to leave a comment, person has to sign in using any of his social account.
Running Tests In Fitnesse:
Once you have created all the auto test scripts, there are two ways to run the FitNesse tests:
- Run them as a whole suite
- Run then individually
When you run them in a whole suite form then tests run in an alphabetic order and show results accordingly. The whole suite either passes or fails. For running tests in suite, tester must follow a particular sequence. There will be a set up at the beginning and tear down at the last. SET UP will do all the necessary actions to prepare the tests to execute and TEAR DOWN will undo all the changes made to database and other places while running that particular test script. This could be understood better with an example.
When test is ran individually or you can say independently then there is no need to define any order (mainly alphabetic names of the test). Run the test and get the result.
Important things to remember while organizing and running tests on FitNesse.
- Name of the suite and Tests within that Suite: While organizing the FitNesse test from the test case documents, this should be made sure that the Test names and suite name should make some sense. In the above example, the suite name is “ContactAndSocialMediaTesting” which tells a naïve person that this testing is related to the “Contact and Media” website. Similarly, the test names are “Contact Form”, “CommetForm” and “Social Media” which is clearly reveling that what kind of test cases are in these scripts.
- The execution order of Tests in the suite: If your test suite requires a particular order of execution make sure that while you name your test, the tests which are required to be executed earlier should have their names in ascending alphabetic order. Example, the test starting with an alphabet “a” will be executed first following by the next test in an alphabetic order for the entire test suite.
- Selective run of tests in a suite (smoke test): Sometimes, we are not required to run the entire test suite, instead of few tests within that suite. FitNesse provides a provision of tags as a property of that test page. Therefore just identify the tests within a suite that are eligible for smoke test tag them and using the FitNesse action URL execute them to complete the smoke test.
- Name of the tables in the test page: The FitNesse test page has a number of tables say decision tables those have underlying Java fixtures. We need to carefully name those Java classes such that they should convey the meaning of what this decision table is actually testing and the “Social Media” which is clearly same applies to the setter and getter method names. Please note that if java fixtures are already created with unfamiliar class names, FitNesse provides a provision for alias table where we can provide the meaningful fixture name to the decision tableon that Fitnesse pagetemporarily.
- Avoid writing duplicate tests in a suite: We need to keep in mind the efficiency of the test suite and the time it takes to complete its execution. This can be made sure by writing optimized Java program for fixtures, avoid duplicate test scenarios across all FitNesse pages in the same test suite, etc.
- Use camel-cased word only when needed: FitNesse tool has its feature that anything we write as a camel-cased word on any static, test or suite page it prompts us with question mark hyperlink asking to create a new page. Therefore this should be made sure that we are writing comments as heading or test on the test page refrain from using camel-cased words unless needed.
- Avoid writing verbose test pages: This is very important that if we are testing a particular functionality using FitNesse which is quite complex and has multiple scenarios. Instead of writing all scenarios test on the same page and making it verbose, simply consider splitting the scenario into more number of tests in the same test suite. This practice will organize your tests in the best way making it modular and speed up those FitNesse test page execution.
- Modular approach following Wiki: FitNesse tool is a wiki first then a testing tool. Using the wiki feature of the FitNesse tool feel free to put as many comments on the test page such that it become self-explanatory what actually we are testing on the current page. Using such approach, we are not only doing the acceptance test but managing the organization’s data in a very efficient manner.
Over To You:
⇓ Subscribe Us ⇓
If you are not regular reader of this website then highly recommends you to Sign up for our free email newsletter!! Sign up just providing your email address below:
Happy Testing!!!
- Tutorial 1 – Introduction to FitNesse Testing Tool
- How To Download, Install And Kick Start Work On FitNesse Server?
- Tutorial 3: Getting Started With First FitNesse Project
- Tutorial 4: Writing The Fitnesse Fixtures – With Fitnesse Java Example
- Tutorial 9 – Using Slim Test Table Styles in Fitnesse
- Guide on the Script Table in FitNesse with an example
- Using Import Table, Library Table And Comment Table in FitNesse
- Formatting Cheat Sheet in Fitnesse
- BDD Style Testing using FitNesse
- Creating The Test Suite In FitNesse