Forum Discussion

linda_marshall's avatar
linda_marshall
Occasional Contributor
10 years ago

Keyword Test - population of drop down list field with value from Table Variable

I'm at the beginning stage of using TestComplete, and am just using Keyword Tests in order to get an initial success for test automation by automating the setting up of data required by a set of test scripts.  To do this, I have a Keyword Test that loops through values held in Table Variables for that test.  These values are used to complete fields populated from drop down lists.  



When the ClickItem Operation Parameters take the value from the Table Variable



- If the field is to have a value, and the value of the Table Variable is a string which equals a value in the drop down list, the field is successfully filled with that value  



- If the field is to be blank (blank is always the first item on the list) errors are encountered as follows:



  • When there is no value in the Table Variable the error message is "The combo box item's index -1 is out of bounds".


  • When the value of the Table Variable is 0 the error message is "The combo box item '0' not found"




When the ClickItem Operation Parameters take the value from a Constant



- If the field is to have a value, and the Constant is a string which equals a value in the drop down list, the field is successfully filled with that value.  



- If the field is to be blank it is successfully set to blank in the following cases:



  • When the Constant is a String with no value


  • When the Constant is an Integer value of 0


Any ideas on how I can get a blank into the drop down list field using the Table Variable?

1 Reply

  • linda_marshall's avatar
    linda_marshall
    Occasional Contributor
    I've used a workaround to 'work around' this problem, using the 'If then else' construct in the Keyword Test.  



    I've used 0 for the value of the table variable whenever there should be no value picked up for the field.  

    I then check that the variable is not equal to 0.

    -  If it's not 0, I retrieve the value of the table variable and use that to populate the field.

    - Otherwise, the first item in the picklist is selected (by using integer 0 value for ClickItem parameter) which then populates the field with a blank.



    Not a very elegant solution, but will have to do for now....