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

  • Create a test case to fill up Name and Password. Name it as TC_IF THEN ELSE
  • Create a test case just to click on Log in button. Name it as ‘TC_IF THEN ELSE – Click Log in’
  • 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:

  • First getText of the Name field
  • Use the recovery test as shown in the screenshot
  • 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.

Hope this topic is useful.

About This Site

The main aim of this site is to share knowledge with fellow software test specialists who are keen to grow both technically and professionally.

Categories