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

Radio Button data driven test

8 Answers 279 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Dimon
Top achievements
Rank 1
Dimon asked on 22 Jun 2012, 09:12 PM
I have a form with seven radio buttons. i want to make data driven test for this form. How can i do this for Radio Buttons.
tx

8 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 22 Jun 2012, 09:43 PM
Hi Dimon,

Our built-in data drive feature allows you to turn on/off a specific radio button according to the data contained in the data source. We don't support finding the right radio button to select via a data driven step.

This can be done is code however. If you need assistance with this let us know. We'll need to see the HTML behind your radio buttons, along with how you want the data to look in your data source before we can give you a complete working solution.

All the best,
Cody
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Dimon
Top achievements
Rank 1
answered on 23 Jun 2012, 05:16 PM
Cody,

Thanks for your reply. Our example HTML looks as follows:

<input type="radio" value="1" name="category" />
<input type="radio" value="2" name="category" />
<input type="radio" value="3" name="category" />
<input type="radio" value="4" name="category" />
<input type="radio" value="5" name="category" />
 
<input type="text" value="" name="title" />

the Excel file example content:
category    title
2                 Second title
5                 Fifth title

We want 2 iterations for this file, first must select category radio button with value=2 and title "Second title". And the same for all excel rows.
0
Plamen
Telerik team
answered on 26 Jun 2012, 04:18 PM
Hello Dimon,

Thank you for providing the HTML. Your scenario can be accomplished by using a Data Driven Find Expression in coded step. Here's the code:
HtmlInputRadioButton button = ActiveBrowser.Find.ByExpression<HtmlInputRadioButton>("type=radio", "value=" + Data["category"].ToString());
button.Check(true, true);

Please see this video for more information on how this works.

Kind regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
AlphestDev
Top achievements
Rank 1
answered on 30 Jun 2012, 07:44 PM
Cody, Plamen,

Thanks, it is really helpful.

On-the-go video tutorials - good idea!

Kind regards,
Vyacheslav
0
Dimon
Top achievements
Rank 1
answered on 01 Jul 2012, 01:22 PM
Tx great it works
0
Plamen
Telerik team
answered on 02 Jul 2012, 08:07 AM
Hi Dimon,

Glad to hear it! Please contact us again if you have further questions.

Kind regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Floyd
Top achievements
Rank 1
answered on 07 Mar 2013, 05:47 PM
Cody,

   You say that the "build-in data drive feature allows you to turn on/off a specific radio button according to data contained in the "data driven"  I have included an image of the data driven drop-down being open for a radio button I would like to click on.  There are no options for me to choose.  How do I click on a radio button used spreadsheet data when the data doesn't appear as a selection option in the "data driven" dropdown?
0
Plamen
Telerik team
answered on 12 Mar 2013, 03:31 PM
Hello Floyd,

We already have an existing feature request to expose binding properties for a RadButton. You can track its progress here: Public URL.

The workaround is to convert the "RadButton click" step into coded step using the "Customize Step in Code" feature from the Test Step Context Menu and edit the generated code like this:
Pages.ASPNETButtonDemoRadios.ContentPlaceHolder1RadButton22Span.Checked = Convert.ToBoolean(Data["State"]);

Please see this video for more information.

All the best,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Dimon
Top achievements
Rank 1
Answers by
Cody
Telerik team
Dimon
Top achievements
Rank 1
Plamen
Telerik team
AlphestDev
Top achievements
Rank 1
Floyd
Top achievements
Rank 1
Share this question
or