To create a clipboard checkpoint, you can write script code that –
-
Obtains the clipboard contents by using the
Sys.Clipboard
property. -
Compares the obtained value with the desired value using the
if... then
statement:JavaScript
if( equal(Sys.Clipboard, "My Value"))
// Success
else
// ErrorJScript
if( Sys.Clipboard == "My Value")
// Success
else
// ErrorVBScript
If Sys.Clipboard = "My Value" Then
' Success
Else
' Error
End IfDelphiScript
if Sys.Clipboard = 'My Value' then
// Success
else
// ErrorC++Script, C#Script
if( Sys["Clipboard"] == "My Value")
// Success
else
// Error
You can either write the comparison code manually, or use the Clipboard Checkpoint items of the Recording or Tools toolbar. Using an item of the Recording toolbar, you create the comparison code when recording a script. Using the Tools toolbar, you create the comparison code at design time. The whole procedure includes the following steps:
-
To create a checkpoint during the script recording, select Clipboard Checkpoint from the Recording toolbar:
In the ensuing Create Clipboard Checkpoint dialog, specify checkpoint comparison conditions, the text against which the clipboard content should be compared and click OK.
TestComplete will automatically generate the comparison code and insert it into the recorded script.
-
To create the checkpoint at design time, select Clipboard Checkpoint from the Tools toolbar. If this toolbar is hidden, right-click somewhere in the toolbar area and select Tools from the ensuing context menu:
In the ensuing Create Clipboard Checkpoint dialog, specify checkpoint comparison conditions and the text against which the clipboard content should be compared. Click OK to proceed with creating the checkpoint.
TestComplete will generate the comparison code and display it in the Copy Text to Clipboard dialog. You can modify the code in the dialog, if needed. Then, you can press Copy to copy the generated code to the clipboard and then paste it in your script.
See Also
About Clipboard Checkpoints
Creating Clipboard Checkpoints in Keyword Tests