While testing, you may need to verify that a file contains relevant data. For this purpose TestComplete includes file checkpoints that verify specified files by performing a byte-to-byte comparison of these files with baseline files stored in your test project.
If the actual and the stored files are identical, the checkpoint is passed successfully. However, sometimes, even if the contents of the files are the same, verification may fail.
This topic provides information on possible causes of file verification failures along with steps you can take to make verification pass successfully:
Files Contain Variable Fragments
Verification may fail if the checked file includes some extended information that changes from one test run to another.
For example, report files often include date and time of the report and the report ID that are different for each generated report.
Another example: if you verify a Word document generated during the test run, verification will fail even if the major information in the actual and the baseline files remains the same. The cause of the failure is that the actual and the baseline files include different specific details added by Microsoft Word during the saving process.
If the file you want to verify contains altering fragments, byte-to-byte verification is ineffective. To make your file checkpoint be passed successfully, you can do the following:
-
Specify the amount of allowed dissimilarities between files.
If the files are slightly different, use the recommended value of the AllowedDifference parameter. When the checkpoint fails, TestComplete automatically calculates the parameter and displays it in the Details panel of the test log. After you specify the recommended value in the checkpoint, the files will be treated as equal while performing the next verification.
-
Exclude variable fragments from verification.
If the file contains altering fragments, find these fragments and exclude them from comparison. To find such fragments, you can use the TestComplete File Comparison Results panel in which differences are highlighted with different colors.
To verify files ignoring the found variable fragments, use regular expressions. For information on how to do this, see Verifying Files With Variable Parts.
Files are Incomplete
File verification can also fail if the actual file is engaged in another process while being verified.
For example, this can happen if there is an operation that imports data into an actual file right before the test performs a checkpoint. In this case, at the moment verification starts, some data may still be imported into the file and the checkpoint will fail.
As a solution, you can delay the test execution until the end of the importing operation. To learn how to delay test runs at some point, see Delaying Test Execution.
See Also
File Checkpoints
About File Checkpoints
Analyzing File Verification Results
Delaying Test Execution