Software Testing Class

Guide on the Script Table in FitNesse with an example

In “FitNesse For Beginners” tutorial series page, checkout all tutorials if you missed an article. In this table, we are going to discuss and learn about the slim testing engine using Script Table in FitNesse with an example in detail.

Script Table In FitNesse:

Script table is a series of actions and checks that are similar to Do Fixture. The first row of script table starts with word “Script” followed by the name of the fixture (known as the “actor”) and it’s constructor arguments that will be used by the rest of the table.

To work with the Library table, we need to do the following.

Script: script table | Appy | softtestclass

login with userID | Appy | and password | softtestclass

login with userID and password;| Appy | softtestclass





Few Rules To Remember While Working With Script Table:

Below are the script table rules for the FitNesse slim testing engine.

check | login message received | Appy Successfully logged in.

reject | login with userID | Appy | and password | bad password

note | This is a comment

show | number of login attempts made | 4

$symbol<-[Appy Successfully logged in.] | login message received

Explanation for Java Fixture:

Like any ordinary Java fixture, it has the following members.

Java Fixture class is shown below:

//Guide on the Script Table in FitNesse with an example
public class ScriptTable
{
private String userID;
private String password;
private String messageReceived;
private int loginAttemptsMade;

public ScriptTable(String userID, String password){
this.userID = userID;
this.password = password;
}

public boolean loginWithUserIDAndPassword(String userID, String password){
loginAttemptsMade++;
boolean result = this.userID.equals(userID) && this.password.equals(password);
if(result)
messageReceived = String.format("%s Successfully logged in.", this.userID);
else
messageReceived = String.format("%s loh in attempt Unsuccessful.", this.userID);
return result;
}

public String loginMessageReceived(){
return messageReceived;
}

public int numberOfLoginAttemptsMade(){
return loginAttemptsMade;
}
}

Screenshot for Script Table In FitNesse:

After we run the test on the script table, below the FitNesse screen will be visible.

#1) The Boolean method “loginWithUserIDAndPassword” called as Interposing Function Call has returned true, hence it is marked with green color on the page.

#2) The Boolean method “loginWithUserIDAndPassword” called as Sequential Argument Processing Function Call has returned true, hence it is marked with green color on the page.

#3) Check work is used with the method “loginMessageReceived” has returned the string “Appy Successfully logged in.” which matches the expected output. Hence, it is marked with green color on the page.

#4) Reject word is used with the method “loginWithUserIDAndPassword” called as Interposing Function Call which has an incorrect password and has returned false. It is marked with the red color on the page.

#5) Ensure word is used with the method “loginWithUserIDAndPassword” called as Interposing Function Call which has correct password and has returned true. It is marked with the green color on the page.

The note is a comment row which is simply ignored by the slim processor.

#6) Show word is used on method “number of login attempts made” which returned the count in an additional cell created in the same row.

Script Table in FitNesse

⇓ 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:


 

Check email in your inbox for confirmation to get latest updates Software Testing for free.


  Happy Testing!!!
 
Exit mobile version