Radio Button data driven test

9 posts, 0 answers
  1. Dimon
    Dimon avatar
    3 posts
    Member since:
    Jun 2012

    Posted 22 Jun 2012 Link to this post

    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
  2. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 22 Jun 2012 Link to this post

    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
  3. Dimon
    Dimon avatar
    3 posts
    Member since:
    Jun 2012

    Posted 23 Jun 2012 Link to this post

    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.
  4. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 26 Jun 2012 Link to this post

    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
  5. AlphestDev
    AlphestDev avatar
    1 posts
    Member since:
    Jun 2012

    Posted 30 Jun 2012 Link to this post

    Cody, Plamen,

    Thanks, it is really helpful.

    On-the-go video tutorials - good idea!

    Kind regards,
    Vyacheslav
  6. Dimon
    Dimon avatar
    3 posts
    Member since:
    Jun 2012

    Posted 01 Jul 2012 Link to this post

    Tx great it works
  7. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 02 Jul 2012 Link to this post

    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
  8. Floyd
    Floyd avatar
    2 posts
    Member since:
    Dec 2011

    Posted 07 Mar 2013 Link to this post

    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?
  9. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 12 Mar 2013 Link to this post

    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
Back to Top