Pending Review
Last Updated: 28 Aug 2015 18:29 by Andrew
ADMIN
Cody
Created on: 15 Aug 2013 17:16
Type: Feature Request
21
Add ability to use code to drive If/Else logical blocks
Some customers would like the ability to us e code as the condition in Test Studios If/Else logical block. They don't want to do everything in code, only the condition because not every condition is a simple verify some property of some element.

Another less elegant solution to the problem is to add the ability of a GoTo step X from code.
8 comments
Andrew
Posted on: 28 Aug 2015 18:29
Earlier today I had submitted a ticket to see if this was possible. please let us know of the status.

We are laying out the framework for telerik to be used on our web application. there are many different site configurations I need to plan for and our plans were to use a coded step to check the binded database then use the if statement to check the status of a particular site option. having the ability to say " if true go to step 11" is extremely valuable to our company. 
Bernard
Posted on: 30 Apr 2015 12:57
What is the status of this Feature Request? This option would save us a lot of time and test scripts. Via this option it is for example possible to:

- create an if-else condition based on Data input from Excel.  For example: it would be possible to specify in Excel which gender to select and the test script could select the appropriate radio button accordingly
John
Posted on: 05 Nov 2014 00:33
Just wanted to bump this request with a simple data-driven example.

I would like to write my own custom function which evaluates True/False so that different steps are taken for different DataSource rows.

For example:
If (SomeDefinedList.Contains($DataSource['SomeColumn']))
{
  return false
}
else
{
  return true
}

The values in my DataSource are variations on Yes ('1', 'Y', 'Yes'), so I check them against the PositiveValues list.
Scott
Posted on: 08 Oct 2014 06:58
Here is our scenario:

I want tests to be easy to create.  Because our website is completely generated by JavaScript, and there are a lot of timing issues where things get mist in playback due to widgets not being instantiated etc.. I created some static helper classes for each of our widgets.  so now to put a value into a DropDownList you do the following in a code step:

MISTROAppFrameworkHelper.Form.FormInputs.DropDownList.EnterValue(new DropDownListArgs() {
    BaseTest = this,
    ModuleID = "AddEdit-Form",
    DataField = "tblTest_Field",
    Value = "Option 2",
});

and it just works without fail every time, as I have built all the appropriate waits and checks for classes set by widgets once they get instantiated etc.. into the helper class.  So now people creating tests don't have to be test creation experts, they just need to use these helper classes and tests will operate correctly every time.  This has greatly reduced the amount of time we spend debugging tests.

Now I want to do things like create a test that will delete a user if they exist.  So I need to check if the user exists, which I do by applying a filter to a grid, and checking to see if the filtered row is found.  I have methods in my helper class for all these tasks that verify when grid loading is completed etc... so this is easy done.

However I have no way to put a logic step in to say if the row is found then execute the remaining steps, which involve:
 - Selecting the row.
 - Pressing the delete button.
 - Pressing the confirmation button.
 - Verifying that the row has been deleted, and no error messages were shown.

I want the test to pass if:
 - The row to be deleted is not found.
 - The row to be deleted was found and was successfully deleted.

I have no way to put in a logic step.  I know I could write a coded step to call a heap of other methods ... but there is no clear indication of which step failed......  it is just one big step....

The lack of a way to implement a logic step via code is a huge drawback when all your steps are coded steps.

I hope to see this implemented asap.

Regards,

Scott
Shashi
Posted on: 12 Sep 2013 13:06
Implementing support for a coded step that returns a boolean value (which can then be invoked inside IF/ELSE, WHILE and any other operations that require a boolean parameter) would go a long way to resolve this (if not, completely solve it).  I think most/all of the above scenarios could be programmed inside the coded step.
Shashi
Posted on: 12 Sep 2013 12:29
In answer to Jim's questions, all of the above.  Other scenarios where this functionality would be used:

a) Branch based on coded Verify steps (as opposed to recorded Verify steps).
b) Branch based on comparison of an extracted variable/data source variable to a specific value (handle all comparison operators - not just equal).

In addition to IF/ELSE, if the same support can be given to WHILE operators as well, that would be even better.



David
Posted on: 11 Sep 2013 00:32
I like this request - you don't always take code paths based on the state of elements in the browser, you might want to execute a code path based on a configuration file.  We for example, run setup steps or skip them based on a flag we read in from a data source.

I think basic boolean expressions based on extracted values would be enough to start.
ADMIN
Jim
Posted on: 22 Aug 2013 18:44
Cody,

We need more use case info on this. 

An IF condition needs to evaluate a boolean state, so do customers want to invoke a boolean method or variable, then branch based on its value?

Do customers want to handle ExtractedValues varables? They're loosely typed Objects, so we don't get boolean states from them. Would working with the string representation of those as "true" or "false" fit that need?