In TestComplete, property checkpoints obtain the actual value of the tested object existing in your application and verify that the value meets the specified conditions.
Property checkpoints you create via the Create Checkpoint wizard or Quick Checkpoints use hard-coded values for verification. In other words, these checkpoints will always perform the same verification procedure checking the same object property against the same baseline value.
If a property value you want to verify in your test changes between test runs, in order for your checkpoint to be passed successfully, you may want to replace the checkpoint’s hard-coded baseline value with a parameter that obtains the desired value before each test run. That is, you may want to parameterize your property checkpoint.
This topic provides information on how to parameterize your property checkpoints:
In Keyword Tests
To parameterize your property checkpoints in keyword tests, in the Operation Parameters dialog of the Property Checkpoint operation, replace hard-coded values of the operation with keyword test parameters or with keyword, project or project suite variables containing desired values.
The image below demonstrates two Property Checkpoint operations. One of them checks the tested object’s property against the hard-coded string value, the other one - against the value stored in keyword test parameter param1.
In Scripts
To parameterize your property checkpoints in scripts, replace hard-coded parameters of the aqObject.CheckProperty
method with script routine parameters or with script, project or project suite variables holding the desired values.
For example, the following code snippet demonstrates two property checkpoints. One of them checks the tested object’s property against the hard-coded string value, and the other one - against the value stored in the script routine parameter:
JavaScript, JScript
function Test(param1)
{
…
aqObject.CheckProperty(Aliases.SampleApp.MainForm.Edit, "wText", cmpEqual, "Hard-coded baseline string");
…
aqObject.CheckProperty(Aliases.SampleApp.MainForm.Edit, "wText", cmpEqual, param1);
…
}
Python
def Test(param1):
...
aqObject.CheckProperty(Aliases.SampleApp.MainForm.Edit, "wText", cmpEqual, "Hard-coded baseline string")
...
aqObject.CheckProperty(Aliases.SampleApp.MainForm.Edit, "wText", cmpEqual, param1)
...
VBScript
Sub Test(param1)
…
Call aqObject.CheckProperty(Aliases.SampleApp.MainForm.Edit, "wText", cmpEqual, "Hard-coded baseline string")
…
Call aqObject.CheckProperty(Aliases.SampleApp.MainForm.Edit, "wText", cmpEqual, param1)
…
End Sub
DelphiScript
function Test(param1);
begin
…
aqObject.CheckProperty(Aliases.SampleApp.MainForm.Edit, 'wText', cmpEqual, 'Hard-coded baseline string');
…
aqObject.CheckProperty(Aliases.SampleApp.MainForm.Edit, 'wText', cmpEqual, param1);
…
end;
C++Script, C#Script
function Test(param1)
{
…
aqObject["CheckProperty"](Aliases["SampleApp"]["MainForm"]["Edit"], "wText", cmpEqual, "Hard-coded baseline string");
…
aqObject["CheckProperty"](Aliases["SampleApp"]["MainForm"]["Edit"], "wText", cmpEqual, param1);
…
}
Obtaining Checkpoint Parameters from External Files
The parameters you pass to property checkpoints in tests can contain data from external storages, for example, from databases or text or Excel files. TestComplete provides special features for parameterizing tests with data from external storages. For more information on this, see Parameterizing Tests Using External Data Sources.
See Also
Property Checkpoints
About Property Checkpoints
Using Variables
Parameterizing Tests
Parameterizing Tests Using External Data Sources