Forum Discussion

lrix's avatar
lrix
Occasional Contributor
14 years ago

Data Driven loop - Boolean Data Type

Hi



I'm struggling to use a boolean data type when creating a data driven loop in the Keyword Tests.



1. Create keyword test

2. Select relevant rows to loop

3. Right Click and "Make Data Loop"

4. Create New Variable

5. Select "Table Variable" and click Next.

6. In update values, create 2 columns.  (Column 1 to contain the value of an item in a combobox.  Column 2 to contain a boolean to check the Enabled value of a field).

6. Table Generation -- here's where I get confused.  If I have the Data Type column as "Use Value" and "Value or Settings" as False or True, then the subsequent test run for those items works fine.  But I don't want all Falses or all Trues obviously, so in the next screen (the data table itself) I'll overwrite some of the values with True.



The tests will then fail along the lines of "Expecting "true"; actual true".  Why is it now seeing my True as a string, and how do I make it see it as a boolean as it did do with the dafault value?



Many thanks.
  • Hello,


    TestComplete treats the table variable's values you modify on the Variable's Default Value page of the Data-Driven Loop wizard as strings, and this behavior is expected. Sorry for the inconvenience.




    To treat those variable values as boolean values, you need to convert them, for example, by using the aqConvert.VarToBool method.


    To call this method from a keyword test, please use the Call Object or Run Code Snippet operations.




    Please let us know if you need anymore assistance.


    Thank you.