Forum Discussion

Soni's avatar
Soni
Occasional Contributor
8 years ago

comparing drop down list items with data from excel sheet

I have a scenario in which I want to verify that the items from the drop down list match the data in the excel sheet. I would appreciate some pointers on how to implement this if someone has done something similar.

Can this be done through a keyword test? Or does some part of this need to be scripted?

4 Replies

  • sanaumar's avatar
    sanaumar
    New Contributor

    Hi, I think you should script this, see if the below logic works for you.

     

    Take all the values one by one from the drop down and get this write in Excel column (using excel driver of test complete), and then compare with the values that are already written in Excel.

     

    Best Regards,

    • Colin_McCrae's avatar
      Colin_McCrae
      Community Hero

      It depends on the type of dropdown. There are many types.

       

      Most will have the entire available list stored as property somewhere. But not all.

       

      I just had to write a custom function for a DB data driven one. It retrieves each option on the fly as it needs it. So in order to get the full list to check (I don't want to go down it one by one as that can trigger other behaviour in the GUI) I have to:

       

      1) Extract the SQL query it uses to populate itself. (Which is stored as a property)

      2) Extract the display field used from the resulting dataset. (Also stored as a property)

      3) Run the query and keep only the text from the required field. (I already had SQL functions I could easily plug this into which helped)

       

      Long way for a shortcut. But no other way of checking it without activating things.

       

      It's an extreme example. But it demonstrates the point that not all dropdown type objects are as simple as they look.

       

      (It's a Delphi "TwwDBLookupCombo" in case anyone is wondering. There are other DB lookup ones but they retrieve and store the full list as property when they render.)

       

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    Keyword test is fine.  Try Property Checkpoint and see how it works for you.  Use it to compare the drop-down object with the value from the excel sheet (see attached).

     

     

     

  • Soni's avatar
    Soni
    Occasional Contributor

    I want to check if the entire drop down list options are correct, by matching them with the values stored in the Excel sheet column. How do I get all the values from the dropdown list in a keyword test?