Pro-Tip: Parameterized Object Property Checkpoints in Keyword Tests
There are, perhaps, some of you who may have already discovered this. I'm a script coder and prefer to write code for my tests so I'm working on learning the ins and outs of using Keyword Tests more these days. In doing so, I ran into a problem... and a rather cool solution. It's not huge, but it might help some of y'all.
Problem:
When writing keyword tests, if you want to add a checkpoint on an Object Property, there is a limitation. It happens on this screen:
What I have highlighted in red will only take a direct string value. You cannot call a Code Expression, a variable, a test parameter, or anything else "cool" in here... only a string. If you're like me, your test cases can be used in multiple situations with perhaps data that will vary from run to run. So, there is a need for doing the check comparing the property to some data coming from another source. At first, I thought that the only recourse was to do an If-Then statement to do the comparison of an object property to a variable/parameter. This worked... but it looked clunky and didn't feel right.
Solution:
Then I realized that the Call Object Method operation can be used to call the method of ANYTHING that TestComplete recognizes as an object, including the aqObject object... which happens to have a CheckProperty method. So, instead of my if-then, I add a Call Object Method operation and, in the object field, I enter simply aqObject. When I click next, I now have the CheckProperty method available. I select that, and now I can fill in the fields using whatever values I want, including parameters, variables, code expressions, etc.
SPECIFICALLY, I can now parameterize the Value field, something I couldn't do with just a Object Property Checkpoint.
The end result is that, when I run this, in my test log, it treats it just like an Object Property Checkpoint operation complete with Checkpoint event on a pass.
Again... just discovered this recently myself, but thought I'd share. You can, obviously, do this same thing with any number of other native objects in TestComplete in keyword tests, opening up a lot more possibilities to those of us who may not be coders.