Use the Compare Files operation to compare two files or to update a file stored in the Stores | Files collection of your TestComplete project. The operation’s functioning mode is specified by the Update attribute of a stored file. By default, the operation compares two files. However, if both the Update files setting and the Update attribute are enabled, the operation updates the stored file.
The operation compares files byte by byte, and can perform strict comparison or compare files ignoring certain difference. For more information, see How File Verification Works.
When you add the operation to your test, TestComplete displays a dialog in which you specify the files to be compared, as well as comparison options.
In comparison mode, if the comparison procedure reports the files to be identical, the operation returns True.
Otherwise, the operation returns False and posts a message corresponding to the operation’s MessageType parameter to the log. If the operation uses a third-party Diff utility for file comparison (the utility and its launch parameters are specified by the Files diff utility options), the operation also posts an informative message to the test log. The message holds a link to the file comparison report generated by the utility.
In update mode, the operation always returns True and posts a checkpoint message () to the test log.
The operation is an analogue of the
Files.Compare scripting method.
The operation cannot have child operations.
The operation uses the following parameters:
File1 and File2
Specifies the names of the files to be compared or the name of the stored file and of the file that will replace it. To specify each file, you can either use the fully-qualified file name, or, if the file belongs to the Stores | Files collection of your project, use the name that the file has in this collection. To specify the name of a stored file, press the down arrow and select the desired item from the ensuing drop-down list. To specify the name of a file that is not stored in the Files collection, press the ellipsis button and specify the desired name in the ensuing Edit Parameter dialog.
If the operation works in update mode, then one of the file names must specify an element of the Files collection.
The file order is not important if the operation performs strict comparison or if the operation works in update mode. However, the file order is important if you compare files using the HashValue parameter (see below). The difference calculation algorithm takes into account which file is specified first and which file follows it. It will return a different value of the dissimilarity between two files if you change the file order. So, if you compare files with the HashValue parameter, you should specify them in the order in which you specified them to obtain the value of the allowed difference (see below).
Integer. Specifies the allowed difference between files in bytes. The allowed difference of equal files is 0. When comparing files, the operation calculates the difference between them and compares it with the HashValue parameter. If the values are equal, the operation considers the files to be equal.
To obtain the value of the difference between two files, you can use the string that is posted to the Details panel of the test log if comparison fails.
||Do not post any message.|
||Post an informative message.|
||Post a warning message.|
||Post an error message.|
For information on specifying the MessageType parameter value, see Specifying Enumeration Values in Parameters.
To modify the operation’s parameters:
Select the needed operation in your keyword test.
Click the Value cell twice (not double-click) or select the cell and press F2. This will activate the in-place editor.
Click the ellipsis button of the in-place editor. TestComplete will open the Operation Parameters dialog.
In the dialog, specify the operation parameters. For detailed information on how to work with the dialog, see Specifying Operation Parameters.
Click OK to close the dialog and apply changes.
Press Enter to confirm the changes and close the in-place editor, or press Esc to close the editor discarding any changes.
For information on file checkpoints and file comparison, see the topics of the File Checkpoints section.
File Checkpoint Operation
About File Checkpoints
Specifying Operation Parameters
Checking Operation Result