A PDF checkpoint is a test operation that recognizes text content of a PDF document using optical character recognition and verifies that the recognized text matches the expected text. This can be helpful when testing an application that provides its output as a PDF file. You can use PDF checkpoints to make sure the application provides the expected output and therefore, works correctly.
In keyword tests, you perform PDF checkpoints with the PDF Checkpoint operation:
In scripts — by using the
Your TestComplete version must be 14.20 or later.
Your computer must have access to the ocr.api.dev.smartbear.com web service.
If you have firewalls or proxies running in your network, they should allow your computer to access the web service. This web service is used to recognize the text content of PDF files.
Your firewall must allow traffic through port 443.
You need an active license for the TestComplete Intelligent Quality add-on.
The Intelligent Quality add-on must be enabled in TestComplete.
You can enable the add-on during TestComplete installation. If you did not enable the add-on during the installation, you can do this at any moment later via the File > Install Extensions dialog. Select File > Install Extensions from the TestComplete main menu and enable the Intelligent Quality > Intelligent Quality Core plugin in the resulting dialog.
PDF to Text support must be enabled in TestComplete.
By default, it is enabled automatically if you enable the Intelligent Quality add-on during TestComplete installation.
If you experience issues with PDF support in your tests, select File > Install Extensions from the TestComplete main menu and make sure the PDF to Text plugin is enabled (you can find it in the Intelligent Quality group). If the plugin is disabled, enable it. In the confirmation message, click the link to read a third-party license agreement. If you agree to the license terms, click Enable OCR.
During the test run, TestComplete:
Gets the PDF file whose contents you want to verify.
Recognizes the text content of the file using optical character recognition.
Compares the text content with the baseline content that the
Stores > Files collection contains.
Reports the results.
If the actual and the stored text contents are reported equal, the checkpoint posts a success message to the test log.
Otherwise, the checkpoint posts an error message to the test log. It also posts the comparison summary to the Details panel and detailed comparison results:
If you use a third-party diff utility to compare files, the checkpoint will also post the comparison report generated by that utility to the test log.
For a detailed description of the results PDF checkpoints generate, see Analyzing PDF Verification Results.
To compare PDF files byte-by-byte, use file checkpoints.
To check whether PDF file text matches an elaborate pattern, you can use the
PDF.ConvertToText method to get the text content and then use regular expressions and various scripting objects that TestComplete provides to validate the content. You can find examples in Working With PDF Files.
If the expected contents of your tested PDF file have changed, you may want to update your PDF 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 PDF Checkpoints.