This is a migrated thread and some comments may be shown as answers.

If/Else condition assistance needed

4 Answers 178 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Nithu
Top achievements
Rank 1
Nithu asked on 23 Apr 2012, 02:01 PM
Hi, I am fairly new to using Test Studio and am still in the trial version. I am trying to evaluate Test Studio on a web application that we are going to use and are looking for an automation tool to implement. 
         The test i am using is a data driven test and most of the fields in the application are drop-downs. So i need to read through one of my drop-down selection, and based on the value selected in the drop-down, i need to run through certain fields. I tried  to use the extract selection and get the value of the drop down into a databind variable and then assign that to a variable which i tried to use in the IF statement but i am getting a "Object reference not set to an instance of an object. at ArtOfTest.WebAii.Design.Execution.ExecutionUtils.WaitForAllElements(IAutomationHost host, AutomationDescriptor descriptor, Int32 timeout). at ArtOfTest.WebAii.Design.Execution.ExecutionEngine.ExecuteStep(Int32 order)"
          Can you please provide me any input on how to clear this issue?

Thanks,
Nithu

4 Answers, 1 is accepted

Sort by
0
Byron
Telerik team
answered on 23 Apr 2012, 10:59 PM
Hello Nithu,

We would need more information about your test and application in order to help you on this issue. It sounds like you are using a coded step to incorporate your IF statement. What steps are you data driving? You may wish to confirm you are correctly referencing the element in your code. Can you please provide access to your application and test project files? 

Regards,
Byron
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Nithu
Top achievements
Rank 1
answered on 24 Apr 2012, 02:37 PM
Hi Bryon,
Thanks for the prompt reply.


Primary_Excess is a column name in the excel spreadsheet that i used to data bind.

IF Data("Primary_Excess").ToString().Equals("Excess") THEN
[MPL_HappyPath_CodedStep5] : Select 'ByText' option '4,000,000' on 'AttachmentPointSelect'
ELSE

I can walk you through my test if you have a desktop sharing service or something. What i am trying to accomplish here is, i have a web application in which most of the fields are drop down selections. So i am using an excel spreadsheet to drive the test. There is one field that is displayed based on a previous drop down selection, which is the reason i am trying to use a IF statement. 
In the application, "Primary or Excess" is the field which when equals the value "Excess" displays another field named "AttachmentPoint". Otherwise the "AttachmentPoint" field is not available.

Please let me know if i can provide you more details.

Thank you,
Nithin
0
Byron
Telerik team
answered on 25 Apr 2012, 06:54 PM
Hi Nithu,

Thanks for clarifying your testing scenario. It appears that you could accomplish this test recording without using code. Specifically, you could use the recording toolbar and elements menu to build a verification step that would check the current selection of the drop down menu in question, then create a logical step that would use the verification as the "if" condition.

In the case of a drop down menu, the Drop Down verification using the Select attribute will verify the current selected value of the drop down menu. 




Once you create the verification step, you set it as the "if" condition for the logical step, then drag the "then" step onto either the  If or Else step to complete the logical relationship. This way, you can test different menu scenarios without using any coded steps. 


Kind regards,
Byron
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Nithu
Top achievements
Rank 1
answered on 26 Apr 2012, 12:56 PM
Thanks Bryon for the reply. That helped. 
Tags
General Discussions
Asked by
Nithu
Top achievements
Rank 1
Answers by
Byron
Telerik team
Nithu
Top achievements
Rank 1
Share this question
or