Forum Discussion

crazycabo's avatar
13 years ago

How do I refer to object properties when testing their contents?

I am trying to test if a C1FlexGrid cell has its' Font.Bold property set to true or false. I can successfully use [object].C1FlexGrid.GetCellStyleDisplay(x,y) in order to assign the contents to an object variable, where [object] is my application object.



I have tried to use something like 'If KeywordTests.[test name].Variables.[object variable name]("Font.Bold","true") = "true" Then' in order to check the value, but that does not work. I'm trying to use this in a keyword If...Else statement.



Any help would be great!

Thanks
  • Hi Brian,



    What kind of issue do you face using the If...Then operation? I've successfully created a simple keyword test implementing your scenario using the If...Then and Else operations (attached). The test works with the Unbound C1FlexGrid sample. I used the following code expression as the Value1 parameter of the If...Then operation: KeywordTests.Test1.Variables.Var1.Font.Bold



    To check the property value, you can also use the Property Checkpoint operation. The sample I've created demonstrates this approach too.



    Note that I've created a sample test using TestComplete 9. So, you need to upgrade your version if you are using a previous one.



    I hope this helps.