I was looking for PDF Checkpoint, I got File Content Checkpoint!!
At the time when UFT 11.50 was about to launch, I read about the new upcoming features in UFT at so many places. One of the most interesting feature for me was PDF Checkpoint. I was waiting for this to explore. I am glad that team at HP is working hard to improve the quality and focusing on the missing features to include in newer versions. PDF Comparison and manipulation is an area in test automation, in which I have seen lots of requirement for tests and challenges in automating the scenarios. I have actually developed an API earlier to manipulate PDF files. Where I tried to cover most of the automation requirement. Never the less, I am not going to discuss about the API I developed, rather I wanted to see what all we are going to have with this new checkpoint in UFT 11.50. I was looking for PDF Checkpoint as soon as I got UFT installed on my system. But I didn’t find it. What I could find was a whole list of checkpoints as it is in QTP 11. By taking a closer look at all the checkpoints, I found that it is a new checkpoint that has been introduced in UFT 11.50 as ‘File Content Checkpoint’ which can be used to insert checkpoint for Text, Word, HTML, RTF and PDF file types.
As the name suggests- File Content Checkpoint can be used to compare the content of a file generated run-time (actual file) with the content of the source (expected file). Okay, So that means we can compare two pdf files for our tests. The next question comes in my mind that what all content we can compare? Can we compare images and tables in PDF too? The answer was, No. File Content checkpoint can be used to compare the textual content only. It can be used on text in one line, multiple lines, or the entire document, as needed. I was sad there is not much as I was expecting, I will have to again rely on my API for other manipulating PDF files but happy to find that at least we now have the most commonly used testing i.e. comparing PDFs is in place in UFT. Rather we can now compare other file types too.
How it Works
UFT converts the document you select as source into text format and displays the content, using which you can configure your checkpoint. Checkpoint can be configured in File Content Checkpoint Properties Dialog box. If a file content checkpoint step fails during a run session, the Captured Data pane in the Run Results Viewer displays a side-by-side comparison of the generated document and the source document, enabling you to visually compare the differences between the documents, including lines or sections that were added or removed.
How to Create a File Content Checkpoint
Go to Design > Checkpoint > File Content Checkpoint or Click the Insert Checkpoint or Output Value button in the toolbar and select File Content Checkpoint.
The Source File for Checkpoint dialog box opens. Browse and select the relevant file, and click Open. The File Content Checkpoint Properties Dialog box appears. Here, you can change the name of the checkpoint. If you have mistakenly chosen the wrong source file, you can specify it here. The Content of the file will be shown in File Content Editor. You can select one line, multiple or all lines you want to verify.
As you hover over a line, a check box and a regular expression icon are displayed in the sidebar to the left of that line. Click the check box to select (or clear) the line for verification.
You can specify a regular expression for as well for verification for the content. Click the Treat Line as Regular Expression / Plain Text button, this will add backslashes prior to all special characters in that line and you can modify the regular expression. You can also add parameters for the content as you do in other checkpoints. Select the Content you want to parameterize, right click and select ‘Add Parameters to the Line’ option or Select the Button from the toolbar. Choose appropriate parameters as required at the Parameter configuration option dialog. File Content Editor has the toolbar button or right click menu option to evaluate the regular expressions. It also has the feature to preview the comparison. If the source file contains multiple pages, the File Content Editor is divided into separate pages. You can expand or collapse the pages, select or clear entire pages for verification, and so on.
Here is a video on how to use File Content Checkpoint taken from HP Blog – The Future of Testing Blog
So overall, this is impressive. We can now do file comparisons using this inbuilt checkpoint. Specially for PDF files, it was very much required. You might want to try LearnQuickTestPDF API as well and let me know how it works for you. I am in process to add some new features like comparing images. If you have any specific requirement, let me know via the comments section below or contact me using this Contact form.