FitNesse to Perform UAT: Part I
FitNesse, a UAT tool, allows users to add and edit test cases on a Wiki page without needing to know any of the technical details.
Join the DZone community and get the full member experience.
Join For FreeFitNesse is a Wiki web server and an automated user acceptance testing tool where tests can be written on Wiki web pages and can be executed from Wiki.
Users are not supposed to understand the complex software application; they need to simply edit and create new Wiki pages and write the test cases in readable format there itself.
The origin of FitNesse was to better support Agile methodology and to perform User Acceptance Testing. In short, it's a kind of black-box testing in which a System Under Test (SUT) is considered to be a black box and is tested in terms of the outputs generated in response to predetermined inputs.
A functional guy can add the tests as per business and express them within the FitNesse tool. On the other side, the developer's job is to write the code to connect the FitNesse tool to the system that's a candidate for testing so that FitNesse can execute the test and compare the actual output to the expected output.
FitNesse Components
FitNesse looks like this: Front-end (Wiki page) <----> Fixtures (Java or any supported Code) <----> System Under Test (SUT).
Front-End (Wiki Page)
This is basically test tables that invoke the methods in fixture classes and use outputs to determine test success or failure. It's generally written by QA or Business Users.
Fixture
Fixture is basically a Java (or other supported language) code that receieves input from test tables and invoke methods in System under test classes. It's written by developers.
System Under Test (SUT)
This is the actual application which is going to test. It's written by developers.
FitNesse tests may be run on top of either Fit (which is default), using additional fixtures in FitLibrary, or Slim.
The jar fitnesse-20121220-standalone.jar is required.
Running the Fitnesse Wiki Server
To run the Wiki server, make sure that you have Java installed and execute the below command from the directory where your FitNesse jar is present:
java -jar fitnesse-20121220-standalone.jar -p 8086
(-p here indicates port, which is 8086.)
After the execution of the above command, the server will be started as you can see below:
Now, you can see the default wiki page in any browser as below:
After getting the page, click the Edit button, enter the below line as the second-to-last line to add your test suite named MytestSuite, and save.
| [[MyTestSuite][FitNesse.MyTestSuite]]|''MyTestSuite''|
Now you can see the front page, which has an entry for your test suite as well, as shown below:
Now, click on the MyTestSuite hyperlink and you will get another page. Click the Edit button on that new page to add all essential one-time set-up data like Jar details, importing packages, etc., as seen below:
!contents -R2 -g -p -f -h
!|${calcTest}|
|val 1|val 2|multiply?|
|8|9|72.0|
Save the page. You can now add a child test suite or test page that actually contains test data. Here, I am adding one child test suite as below:
After adding the child test suite, it will look like this:
Add the test page under Child Test Suite and give the name as TestPage1, keeping the below contents:
!contents -R2 -g -p -f -h
!|${calcTest}|
|val 1|val 2|multiply?|
|8|9|72.0|
Now, save the page. It will look like this:
In this example, my SUT is a Calculator program.
We are having the Fixture (Java program) take the responsibility of this test. Below, the Fixture is responsible for interacting with the Wiki page that is inside experiment.jar:
package exper.test.fitnesse;
public class SimpleCalculationTest {
private double val1;
private double val2;
private SimpleCalculator calculator = new SimpleCalculator();
public double multiply(){
calculator.setVal1(val);
calculator.setVal2(val2);
return calculator.multiply();
}
public double getVal1() {
return val1;
}
public void setVal1(double val1) {
this.val1 = val1;
}
public double getVal2() {
return val2;
}
public void setVal2(double val2) {
this.val2 = val2;
}
}
Now, let's see the SUT:
package exper.test.fitnesse;
public class SimpleCalculator {
private double val1;
private double val2;
public double multiply(){
return val1 * val2;
}
public double getVal1() {
return val1;
}
public void setVal1(double val1) {
this.val1 = val1;
}
public double getVal2() {
return val2;
}
public void setVal2(double val2) {
this.val2 = val2;
}
}
Now run the Tests using the Test button. You can see the result on the Wiki page as below:
That's all. Now, users can add and edit the test cases on the Wiki page without worrying about any of the technical details. Enjoy!
Opinions expressed by DZone contributors are their own.
Trending
-
Demystifying SPF Record Limitations
-
Application Architecture Design Principles
-
Prompt Engineering: Unlocking the Power of Generative AI Models
-
Execution Type Models in Node.js
Comments