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

Can radio button selection be data driven?

13 Answers 157 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Anju
Top achievements
Rank 1
Anju asked on 04 Jun 2013, 01:31 AM
Hi,

i am working on a WPF application.
    // Click on GeotechOrangeRadiobutton
     
    if(Data["Geotech (Orange)"].ToString()=="True") Applications.UIWPFexe.AddAlarmPopup.GeotechOrangeRadiobutton.Check(true);
    else
    {
                    Log.WriteLine("Geotech (Orange) is False");
    }
}

I got a previous discussion post on how to data drive the radio button and I have updated my test like wise. But when i added the details required for the already existing data driving file (.csv), those are not getting reflected in the test studio. I tried the 'Refresh ' button in test studio also, still it is not showing the added columns. Could you please let me know, what needs to be done to fix this. Do I need to create a new data file and bind it?Also how can I remove an already bound file from a test step?

I have attached the screen shot of my tests. The data binding options are not coming for my coded step, which can be seen in the attached screen shot. The 'property' and 'value' are coming blank.

Also, can we compare the dynamically generated image from the application to a stored image?

Thanks,
Anju

13 Answers, 1 is accepted

Sort by
0
Velin Koychev
Telerik team
answered on 04 Jun 2013, 02:23 PM
Hi Anju,

I am sorry to hear that you are running into this issue.

It is actually expected behavior that you won't be able to see the columns there if you are using Coded Step. You can verify the changes selecting the test and clicking Bind Test in the Data Sources ribbon.  This will not be a problem if you make sure that the name of the first column is "Geotech (Orange)".  
 
As you can read in this article, you can experience problems changing the CSV file if you are not editing the file in the right location:

Note: When adding an external data file to your project, a copy of that file is placed in your project's Data folder. This is from where the file is accessed and any changes should be made to the file in this location.
 
The default path in Windows 7 is:
C:\Users\User\Documents\Test Studio Projects\Project Name\Data

I have recorded a short video to demonstrate you can fix your problem (in the video I am not using coded steps, but it will be similar in your case) . You can see on the video that right-clicking on the test file you can select the option "Remove Data Binding"  to remove the Data Binding.

About your second question about the image verification:

In general, this is not the type of testing for which Test Studio is designed: we are focused on functional testing of the business logic contained in your application. There are several reasons for this. One of them is the inherent frailty of most user interface testing, your scenario included. That is why we recommend using Image Verification only as a last resort (I would recommend you to take a look at this article). Even if you choose this approach - Image Verification, we would recommend you to compare manually the expected and the actual image. 

You can do the verification also with coded steps. 
You can capture an image of the browser at any point in the test and save that image to the hard drive. Here's how it looks in code:

System.Drawing.Bitmap image = ActiveBrowser.Capture();
image.Save("C:\\MySavedImages\\CurrentBrowser.png", System.Drawing.Imaging.ImageFormat.Png);
Some other ways of capturing the browser state are listed in this article
After that if you choose to compare the two images with code you can follow the approach from this article

Looking forward to hearing from you. Regards,
Velin Koychev
Telerik
Free summer webinars on advanced web automation tactics hosted by Jim Holmes & Adam Goucher.
Reserve your seat today!
0
Anju
Top achievements
Rank 1
answered on 06 Jun 2013, 02:21 AM
Hi Velin,

Thanks for the detailed reply.It was really informative and now i know why the columns were not getting updated in my data source :) 
I still dint check the image capture option which you have mentioned, but thanks for that too. I will check that soon.

I just have one question regarding  removal of databinding. If we select the "Remove Data Binding" option, it removes all the data sources associated with the test. What if I want to remove only one data source out of multiple. Is there any option for that?

Thanks & Regards,
Anju
0
Velin Koychev
Telerik team
answered on 06 Jun 2013, 01:57 PM
Hi Anju,

You can add to one test project multiple data sources, however you can data bind a test with just one data source. 

If you want to remove a data sources from the test project, all you have to do is to go again in the Data folder (C:\Users\User\Documents\Test Studio Projects\Project Name\Data). Test Studio can use as a data source only the files that are located there. So if you delete a file from this folder, Test Studio will 
no longer be associated with it.

Regards,
Velin Koychev
Telerik
Free summer webinars on advanced web automation tactics hosted by Jim Holmes & Adam Goucher.
Reserve your seat today!
0
radhika
Top achievements
Rank 1
answered on 22 Sep 2014, 06:07 PM
Hi,
I'm trying to record and play a radio button with 3 possible inputs and cannot do it by using data driven test in Visual studio 2013. can you please let me know how to proceed. My HTML code is as below:

n class="field radio-field">
                        <label><input type="radio" id="FORM_IL_Purpose_r" name="FORM_IL_Purpose_r" class="w290" value="Business partner inquiry" />Business partner inquiry</label><br />
                        <label><input type="radio" id="FORM_IL_Purpose_r" name="FORM_IL_Purpose_r" class="w290" value="Customer service question" />Customer service question</label><br />
                        <label><input type="radio" id="FORM_IL_Purpose_r" name="FORM_IL_Purpose_r" class="w290" value="Loan initiation question" />Loan initiation question</label><br />


0
Ivaylo
Telerik team
answered on 25 Sep 2014, 02:14 PM
Hello Radhika,

Yes it is possible to do this using data driven find logic. Here you will need to data bind the value of the radio button. Here is a video demonstration (no audio) on how this should be done from scratch. I am using Visual Studio 2012 for this video but this should be the same with Visual Studio 2013. The test will pass through all the radio buttons since their values are in the data sheet.

Hope this helps.

P.S. Please note that it is a good practice to submit a new forum thread instead of updating existing one.

Thank you for your understanding.

Regards,
Ivaylo
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
radhika
Top achievements
Rank 1
answered on 25 Sep 2014, 03:51 PM
Thanks a lot Ivaylo for your reply. It works !!!
0
Ivaylo
Telerik team
answered on 26 Sep 2014, 01:43 PM
Hello,

Glad to hear this is working for you.

Closing this case now.

Regards,
Ivaylo
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Yan Jun
Top achievements
Rank 1
Iron
Veteran
answered on 12 Sep 2019, 02:07 AM
[quote]Ivaylo said:Hello Radhika,

Yes it is possible to do this using data driven find logic. Here you will need to data bind the value of the radio button. Here is a video demonstration (no audio) on how this should be done from scratch. I am using Visual Studio 2012 for this video but this should be the same with Visual Studio 2013. The test will pass through all the radio buttons since their values are in the data sheet.

Hope this helps.

P.S. Please note that it is a good practice to submit a new forum thread instead of updating existing one.

Thank you for your understanding.

Regards,
Ivaylo
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!

[/quote]

 

Hi Ivaylo, I was trying to open the link you have attached in this reply but I received "We were unable to locate the requested page" upon clicking on it. May I ask if the link is still valid?


0
Plamen Mitrev
Telerik team
answered on 12 Sep 2019, 12:50 PM

Hello Yan Jun,

I guess that the video was illustrating how to data bind the element's find expression, but that one is currently not available. However, you can find a tutorial on that topic here. There is also documentation that you might find helpful.

Please check the above resources and try to apply the methods to your scenario. If you need some help, please do not hesitate to ask and share more information about your test scenario. I will be happy to help you.

Regards,
Plamen Mitrev
Progress Telerik

 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Yan Jun
Top achievements
Rank 1
Iron
Veteran
answered on 17 Sep 2019, 04:01 AM

Hi Plamen,

Thanks for the suggestion! It should be the solution to my question.

However, I checked the DOM in my tested web app and found the properties of the radio button and the Text are separated (Refer to attached screenshot).

May I ask if the radio button is as shown as screenshot, it is impossible to do data driven as per your suggestion right?

0
Plamen Mitrev
Telerik team
answered on 17 Sep 2019, 07:59 AM

Hello Yan Jun,

I must admit that it is not possible to data drive the element's find expression in this application out of the box, based on the part of the DOM tree. The element that contains the text (it is actually out of the <span> also) is different than the element, against which you need to perform the actions (the radio button).

You can achieve data driven find expression in a coded step, following the details in this article. In addition to that, you need to navigate the DOM to the parent or previous element (the <input>) after locating the correct text and check the radio button. It looks to me that you can use GetPreviousSibling() to achieve that.

I hope the above details will help you automate this data driven test scenario.

Regards,
Plamen Mitrev
Progress Telerik

 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Yan Jun
Top achievements
Rank 1
Iron
Veteran
answered on 19 Sep 2019, 03:06 AM

Hi Plamen,

Thanks for the suggestion! Will proceed to check with the development team and come up with the best solution to this issue.

Thanks for helping out.

Regards,

Yan Jun

0
Plamen Mitrev
Telerik team
answered on 19 Sep 2019, 08:41 AM

Hi Yan Jun,

I am happy to be able to assist you with this scenario. Please do not hesitate to get back to me, if you have follow up questions or you need any help.

Regards,
Plamen Mitrev
Progress Telerik

 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Anju
Top achievements
Rank 1
Answers by
Velin Koychev
Telerik team
Anju
Top achievements
Rank 1
radhika
Top achievements
Rank 1
Ivaylo
Telerik team
Yan Jun
Top achievements
Rank 1
Iron
Veteran
Plamen Mitrev
Telerik team
Share this question
or