aqObject.CheckProperty method allows you to perform a property checkpoint from script code, that is, to verify an object’s property value according to a certain condition. If the verification succeeds, the method posts a success message to the test log; otherwise it posts a failure message.
The method can test properties that have simple value types (string, number, boolean and so on) and does not support properties that contain complex values such as arrays, objects and alike. If test properties have different value types, TestComplete will try to convert the object property value to the type of the expected value and then perform verification.
|Note:||If an object has a property or method that returns a
Note that instead of using the
aqObject.CheckProperty method, you can compare property values with expected values using the appropriate scripting language operators: =, >, >=, <, <= and so on. Using the
aqObject.CheckProperty method makes sense if you need to perform complex string comparisons like "contains", "starts with" and so on, with or without letter case taken into account.
aqObject.CheckProperty(Object, Property, Condition, Value, CaseSensitive)
|CaseSensitive||[in]||Optional||Boolean||Default value: True|
The method is applied to the following object:
The method has the following parameters:
The object whose property you want to check.
The name of the property to be checked.
If the property with the given name is not found, an error occurs. Use the
aqObject.IsSupported method to verify whether the object has a certain property.
One of the following constants that specifies the property value test condition:
||0||Check whether the Property value equals Value.|
||1||Check whether the Property value is not equal to Value.|
||2||Check whether the Property value is greater than Value.|
||3||Check whether the Property value is less than Value.|
||4||Check whether the Property value is greater or equal to Value.|
||5||Check whether the Property value is less or equal to Value.|
||6||Check whether the Property value contains Value.|
||7||Check if the Property value does not contain Value.|
||8||Check whether the Property value starts with Value.|
||9||Check if the Property value does not start with Value.|
||10||Check whether the Property value ends with Value.|
||11||Check if the Property value does not end with Value.|
||12||Check whether the Property value matches the regular expression specified by Value.|
||13||Check if the Property value does not match the regular expression specified by Value.|
||14||Check if Value contains the Property value. (Similar to
||15||Check if Value does not contain the Property value. (Similar to
When testing a property value of a string type, you can use any of these conditions. For more information about string comparison rules, see the Remarks section.
When testing a numeric property value, you can use any of the following conditions:
When testing a property that has a boolean value, you can only use the
Specifies the value to test the property value against. The meaning of this parameter depends on the Condition parameter (see the table above).
If Value is string, this parameter specifies whether the method should perform case-sensitive or case-insensitive comparison; otherwise, this parameter is ignored. By default, this parameter is True, which means case-sensitive comparison; False means that the letter case is ignored.
True if the property value matches the specified condition and False otherwise.
By default, if the
Checkmethod cannot access the object whose property it should verify, or the property does not match its baseline value, the method will wait for the object to become accessible and for the property to pass the verification for the period the Auto-wait timeout setting specifies. (Go to Tools > Current Project Properties > Playback to view or modify the setting.) If the method fails to access the object, or if object property value does not match the expected value within this period, the comparison will fail.
String comparisons ("equals to", "greater than", "less than" and similar) use character codes and are not affected by the locale. For example, "b" is greater than "a", "c" is greater than "b" and so on. If the CaseSensitive parameter is True, letter case is taken into account ("a" is greater than "A"), otherwise it is ignored ("a" is equal to "A"). The comparison is performed symbol-by-symbol and finishes once a difference is found or when both strings have been compared to the end. If two strings having different lengths compare as equal to the end of one string, the longer string is considered as the greater one. For instance, "abcd" is greater than "ab".
You can use the
cmpNotInconditions to test a property’s actual value against comma-separated, pipe-separated lists, and so on, that is, to check whether the actual value equals (or does not equal) to any value stored on the list. For example, you can use the
cmpIncondition to check whether the value of the
Sys.OSInfo.Nameproperty that contains the name of the currently running operating system belongs to the comma-separated list "Win7,WinVista,Win2008":
aqObject.CheckProperty(Sys.OSInfo, "Name", cmpIn, "Win7,WinVista,Win2008")
VBScriptCall aqObject.CheckProperty(Sys.OSInfo, "Name", cmpIn, "Win7,WinVista,Win2008")
DelphiScriptaqObject.CheckProperty(Sys.OSInfo, 'Name', cmpIn, 'Win7,WinVista,Win2008');
C++Script, C#ScriptaqObject["CheckProperty"](Sys["OSInfo"], "Name", cmpIn, "Win7,WinVista,Win2008");
To verify an object property's value, you can also use the
About Property Checkpoints
Alternatives to Property Checkpoints