Testing Every Item in a Drop-Down

4 posts, 0 answers
  1. MBS
    MBS avatar
    2 posts
    Member since:
    Apr 2019

    Posted 16 May Link to this post

    Hello everyone.  I'm fairly new to the Automated Testing world (and tech world) and was hoping I could find some assistance here.  I'm demo'ing Test Studio for the company I work at, and I like it a lot so far.  The one issue I've run into is this.

    I'm trying to have Test Studio test each drop-down selection on a certain page of our website.  For example, I want it to select Alabama (the first state in our drop-down), and then after select the first county in the drop down.  I'd essentially want it to loop through the counties so it tests each county to ensure the data for it loads.  Is there a way for this to be done?  Any help would be greatly appreciated!  And please let me know if more information is needed (did my best to explain the situation).

     

  2. Plamen Mitrev
    Admin
    Plamen Mitrev avatar
    153 posts

    Posted 17 May Link to this post

    Hello,

    I believe that the best approach for you would be to use the Data Driven Testing feature in Test Studio. It allow you to bind a test to a data source like Excel, CSV, XML or database and repeat the test automatically for each value. Please check the attached sample project and the suggested steps below and try to apply them to your scenario.
    1. Create a test, in my case MainTest, which navigates to the page with the dropdown.
    2. In a separate test, DataDrivenSelect from the sample project, record the select step against any value. We will later change the source of this value, so it does not matter which one you choose.
    3. You can add a verification step here, which will be executed for each selection. I added an execution delay for better visibility.
    4. Go back to the MainTest and using Test As Step add the DataDrivenSelect test.
    5. Now you need to add a data source and bind it to the DataDrivenSelect test. Go to Project tab -> Add and select the source type. Once this is done, select the test and click on the Bind Test button and chose the correct data source. You can filter the available data.
    6. Click on the "Select" step in the data driven test and bind the data source values to this step from the Properties pane.

    You can execute the MainTest from the attached sample project with Chrome or Firefox. Please make sure that you have the latest extension and the browsers are calibrated. You will notice that the execution iterates all test steps in the DataDrivenSelect with each data value.

    I hope that the above details and sample project will help you automate your scenario. Please do not hesitate to contact us again, if you need further assistance.

    Regards,
    Plamen Mitrev
    Progress Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  3. MBS
    MBS avatar
    2 posts
    Member since:
    Apr 2019

    Posted 21 May in reply to Plamen Mitrev Link to this post

    Hi Plamen.  Unfortunately I don't think I have a source type to help complete step 5.  That said, I have some of the developers writing steps in code to help loop through the state and county drop downs, so I'm hoping that helps solve this issue.  Thank you very much for your assistance.
  4. Plamen Mitrev
    Admin
    Plamen Mitrev avatar
    153 posts

    Posted 22 May Link to this post

    Hello,

    My idea with the data driven testing for this case is that you can create a new excel file, for example, with all the necessary values (states) in one column. You can add it as a data source and use it to loop the "Select" step through all the values, by binding it. I would add all actions that need to be looped for each value in a separate test and use it with the Test as Step feature, as shown in the sample project.

    You can use a coded step in your test to loop through the values, as you mentioned. Both options are possible for this scenario and I do not see any problems with them.

    I am available to continue our discussion, if you need further assistance.

    Regards,
    Plamen Mitrev
    Progress Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
Back to Top