An Excel checkpoint is a test operation that recognizes content of an Excel file and verifies that the recognized data matches the expected data. This can be helpful when testing an application that provides its output as an Excel file. You can use Excel checkpoints to make sure the application provides the expected output and, therefore, works correctly.
In keyword tests, you perform Excel checkpoints with the Excel Checkpoint operation:
In scripts — by using the Files.Excel_File_Name.CheckExcelWorkbook
method:
JavaScript, JScript
Files.DataStorageExcel1.CheckExcelWorkbook("C:\\Temp\\DataStorageExcel.xlsx");
Python
Files.DataStorageExcel1.CheckExcelWorkbook("C:\\Temp\\DataStorageExcel.xlsx")
VBScript
Call Files.DataStorageExcel1.CheckExcelWorkbook("C:\Temp\DataStorageExcel.xlsx")
DelphiScript
Files.DataStorageExcel1.CheckExcelWorkbook('C:\Temp\DataStorageExcel.xlsx');
C++Script, C#Script
Files["DataStorageExcel1"]["CheckExcelWorkbook"]("C:\\Temp\\DataStorageExcel.xlsx");
If you need to compare a specific sheet of an Excel file, use the Tables.Excel_File_Name.Check
method.
How an Excel Checkpoint Works
During the test run, TestComplete:
-
Gets the Excel file whose contents you want to verify.
-
Recognizes the content of the file.
-
Compares the content with the baseline content that the
Stores > Files
orStores > Tables
collection contains for comparison of an entire Excel file or a specific sheet respectively. -
Reports the results.
How to Create Excel Checkpoints
You can add Excel checkpoints to your test during test recording and at design time using the Create Checkpoint wizard. For detailed instructions, see Creating Excel Checkpoints.
Excel Checkpoint Results
If the actual data and the stored data are reported equal, the checkpoint posts a success message to the test log.
Otherwise, the checkpoint posts an error message to the test log and lists comparison differences in the Detail panel:
For a detailed description of the results Excel checkpoints generate, see Analyzing Excel Verification Results.
Alternatives to Excel Checkpoints
-
To compare Excel files byte by byte, use file checkpoints.
-
You can iterate through your Excel file and compare the desired data via
if … then … else
statements and comparison operators.
Updating Excel Checkpoints
If the expected contents of your tested Excel file have changed, you may want to update your Excel checkpoints to use new baseline contents. Instead of updating the baseline data stored in the Stores > Files collection manually, you can command TestComplete to update it automatically.
To learn how to do this, see Updating Excel Checkpoints.