PDF Checkpoint Operation

Applies to TestComplete 15.63, last modified on April 23, 2024

Description

Use the PDF Checkpoint operation to extract the text content of a PDF file and validate it against the expected text. You can also use the operation to replace the contents of a text file stored in your project’s Stores > Files collection with the extracted text.

To convert PDF file contents to text, the operation uses optical character recognition.

When you add the operation to your test, TestComplete displays the Checkpoint wizard that assists you in configuring the operation. To edit parameters of an existing operation, double-click it in your keyword test.

Requirements

  • 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.

Operation Result

In the comparison mode, if the recognized text content matches the expected contents, the operation returns True and posts the "checkpoint passed" message () to the test log. Otherwise, the operation returns False and posts an error message () to the test log.

The Details panel of the operation’s message in the log shows a comparison summary.

In addition, in the File Comparison Result panel of the test log, you can see the difference between the baseline and actual text data. If the operation uses a third-party Diff utility to compare files, the operation will also post the link to the comparison report generated by the utility.

In the update mode, the operation always returns True.

Scripting Analogue

The operation is an analogue of the File.CheckPDFText method.

Child Operations

The operation cannot have child operations.

Operation Parameters

The operation has the following parameters:

FileName

The fully-qualified name of the PDF file whose content you want to verify.

AllowedDifference

Integer. Specifies the allowed difference between the actual text content and the expected text content (in bytes). When validating a PDF file, the operation calculates the difference and then compares it against the AllowedDifference parameter value. If the actual number of different bytes is less than or equal to the AllowedDifference value, the operation reports the PDF files as equal.

To edit operation parameters:

  1. Double-click the operation in your keyword test. TestComplete will call the Checkpoint wizard.

  2. Follow the wizard instructions to specify operation parameters.

– or –

  1. Select the needed operation in your keyword test.

  2. Click the Value cell twice (not double-click) or select the cell and press F2. This will activate the in-place editor.

  3. Click the ellipsis button of the in-place editor. TestComplete will open the Operation Parameters dialog.

  4. In the dialog, specify the operation parameters. For detailed information on how to work with the dialog, see Specifying Operation Parameters.

  5. Click OK to close the dialog and apply changes.

  6. Press Enter to confirm the changes and close the in-place editor, or press Esc to close the editor discarding any changes.

Remarks

The operation is available in the Checkpoints and AI categories.

See Also

AI Category
Checkpoints

Highlight search results