TestProject - If-Then-Else

How to achieve if-then-else condition in TestProject? There are 2 ways to achieve it: 1- With the help of SDK which I personally like 2- with the help of TestProject UI features. In this section, we will see the later. 


Scenario : Click on LogIn Button if the the user enters 'Sisir' in Name field. 


Lets see how to achieve that

Step 1: Create a test case to fill up Name and Password. Name it as TC_IF THEN ELSE
Step 2: Create a test case just to click on Log in button. Name it as 'TC_IF THEN ELSE - Click Log in'
Step 3: Create a job and make sure that TC_IF THEN ELSE is added.


So how to achieve if then else? Its achieved with the help of 'Invert step result'

Let's modify TC_IF THEN ELSE test case so that:


  1. First getText of the Name field 
  2. Use the recovery test as shown in the screenshot 
  3. Finally set Invert step result to true. Why? We are purposefully failing a step so that we can use the recovery test. That's the whole purpose. 
Screenshot 1


Screenshot 2

Screenshot 3



No comments:

Post a Comment