In the last chapter of this tutorial, we discussed writing a FitNesse test page. In this chapter, we are going to discuss and learn about creating a FitNesse test suite. Basic steps are quite similar to creating the test script. s
Understanding the System under Test
Before we can begin our testing on any project, we need to understand its FRD (Functional Requirement Document), SRS (Software Requirement Specification), etc. After going through these documents, we need to proceed with writing the test cases. In the example of the last chapter, we wrote a FitNesse test page to test a basic calculator system that was developed in Java language which only does arithmetic operations such as addition, subtraction, multiplication, and division. In the actual practice, the software system is much complex which has a large of modules and hence numerous functionalities to test that cannot be accommodated on a single FitNesse test page. Obviously, in order to cover all such functionality, we need to write multiple numbers of test page which can be clubbed under one FitNesse page known as FitNesse test suite.
Considering that, our basic calculator that was tested before has the additional functionalities of a scientific calculator to do logarithms and trigonometric functions. In this scenario, such a system under test has an additional number of classes to cover logarithm and trigonometric functions. We are going to create a test suite of such scientific calculator in this chapter.
System Under Test
The system under test is defined as the entire software application which does a number of functions that accepts inputs from end-user and deliver a meaningful output. In the current example, the system under test is a scientific calculator that has the following additional programs as shown below. Please note that while conducting user acceptance test, the entire system under test is considered as a black box.
Java System For Logarithmic Function
- This Java class has two methods “logarithm10” and “logarithm” that covers logarithm functionalities for base 10 and base e respectively as shown below.
Java System For Trigonometric Function
- This Java class has three methods “sine”, “cosine” and “tangent” that covers trigonometric sine, cosine and tangent functionalities respectively as shown below.
Writing Java Fixture For FitNesse
We have a system or software application ready to test, and as a usual process, the testing team has finished writing the test cases which are reviewed and approved by the supervisor. Next is to start working on the FitNesse tool. In FitNesse tool, we first need to write Java code Fixtures to cover test for all possible test cases. We are going to add an additional fixture for scientific calculator as shown below.
Creating A New FitNesse Test Suite
After we have finished writing the Java code fixture, now we can start working on the development of actual Java FitNesse Test suite. In this FitNesse test suite, we are going to create a suite with three FitNesse test pages. The first page is to test basic arithmetic function, the second page is to test trigonometric functions and the third page is to test logarithmic function. Below are the steps to accomplish that.
Step 1: Create a static page in FitNesse and write the script for all the test pages mentioned before as shown below. Click on the Save button to commit changes on FitNesse page.
Step 2: Now write the test script for each new FitNesse test page in a similar way we did in the last tutorial for Calculator System. Shown below is the FitNesse test script for Trigonometric function, here we are testing for three getter methods such as “sineTest”, “cosineTest” and “ tangentTest”.
Shown below is the test script for Logarithmic function, here we are getting for the getter methods such as “logarithm10Test” and “logarithmexpTest”.
Step 3: Click on the save button present at the bottom of the FitNesse test page to commit the changes on both of the new FitNesse test pages. The final suite page which is currently a static page will look as shown below. Next mouse over the “Tools” menu present at the top right-hand side of the page and click on the “Properties” option.
Step 4: When clicked on the “Properties” option, below screen will be available. Select the option as “Static” and check the radio button as shown below. Once completed, click on the “Save Properties” button to change the current status of the page from static to FitNesse suite page.
Step 5: Shown below is the FitNesse test suite page which has a suite button present at the top right corner of the page and all the three FitNesse test pages developed earlier.
Step 6: We are all set to create a FitNesse use and just a click away to trigger the scientific calculator suite that has clubbed all the three FitNesse test (“Calculator Systems”, “Trigonometric Function” and “Logarithmic Function”) created before. Click on the “suite” button on the current page, it will trigger all of these three tests in alphabetic order of the FitNesse test name, therefore, “Calculator Systems” test is executed first, followed by “Logarithmic Function” and “Trigonometric Function” in alphabetic order. All three test will be completed and below suite, the screen will be visible which concludes all the test present in the suite of a scientific calculator.
Using the edit button present at the top right corner we can add more FitNesse test pages if needed. Also, there is an Add button present on the same page which allows adding static page, test page, and suite page. Yes, it is possible to create a suite within another suite page following the recursive approach. A static page if added on the suite page won’t be executed as a FitNesse test. All these features make the maintenance of the FitNesse page very comprehensive.
Alternatively, if we run each of the above tests then they can be executed as an individual FitNesse test as shown below.
Below is the individual FitNesse test for “Calculator Systems”.
Below is the individual FitNesse test for “Trigonometric Function”.
Below is the individual FitNesse test for “Logarithmic Function”.
⇓ 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!!!