Zeenyx Academy

PDF Verification with AscentialTest

Print Friendly, PDF & Email

The ability to verify the contents of a PDF document may be an important part of a test transaction. In the past, users were required to copy the contents of a PDF onto the clipboard and then create a parsing script to verify its contents. With the release of AscentialTest v8.2, PDF documents can be verified just like pages in a target application.

Generating a snapshot from a PDF Document

The process of verifying a PDF begins with snapshot generation. To generate a snapshot for each page in a Pdf document, drag a file of type .pdf into AscentialTest:

If the document contains only a single page, a snapshot will be created and loaded into its own tab in the App Objects workspace. If the document contains multiple pages, a snapshot series will be generated with a snapshot for each page in the document.

Once the snapshots are created, follow the same steps to generate App Objects as you would for any other application type, dragging and dropping objects from either the snapshot image or the Elements panel.

Start by dragging the PDF page:

Although it is not required if your document contains only a single page, it is a good habit to always include the @PageNum attribute as part of the path for the PdfPage since it is required for multiple page documents. In the future, AscentialTest will include that attribute as part of the definition when the user drags the PdfPage to define it.

Once the page has been defined, proceed by dragging other objects that you plan to verify. You can use all of the path techniques that you may have used to define your application pages and screens, including ‘right of’, ‘below’, etc.

Defining a PDF Table

Currently, there is no table definition wizard for Pdf documents, but it is not difficult define them manually since most Pdf table definitions will follow a similar pattern. The following are two examples:

Start by dragging the PdfTable:

Then create a row class, selector and pdfbox objects which represent the columns, following the pattern in the example below:

[-] PdfTable PurchaseOrderHeader

[ ] path [1]

[-] class Row

[ ] path PdfBox group by @RowIndex

[ ] selector [String SelectByLabel]

[ ] path [@Label == SelectByLabel]

[-] PdfBox RowLabel

[ ] path [@ColIndex==1]

[ ] PdfTextGroup Text

[-] PdfBox RowData

[ ] path [@ColIndex==2]

[ ] PdfTextGroup Text

 

Here is another example where the PdfTable has a header:

 

[-] PdfTable InvoiceDetails

[-] AppObject Header

[ ] path PdfBox [@RowIndex==1]  group

[ ] PdfText Service

[ ] path [@Text==”SERVICE”]

[ ] PdfText Qty

[ ] path PdfText [@Text==”QTY”]

[ ] PdfText Price

[ ] path PdfText [@Text==”PRICE”]

[ ] PdfText Amount

[ ] path PdfText [@Text==”AMOUNT”]

[-] class Row

[ ] path PdfBox  group by @RowIndex

[-] PdfBox Service

[ ] path [below <Header.Service>]

[ ] PdfTextGroup Text

[-] PdfBox Qty

[ ] path [below <Header.Qty>]

[ ] PdfTextGroup Text

[-] PdfBox Price

[ ] path [below <Header.Price>]

[ ] PdfTextGroup Text

[-] PdfBox Amount

[ ] path [below <Header.Amount>]

[ ] PdfTextGroup Text

 

The only difference between the two examples is in the path statement of the PdfBox objects that represent the columns in the tables. In the first example, the @ColIndex attribute is used. In the second example the keyword ‘below’ is used in conjunction with Header objects.

Using PDF Verification in Steps

Building a verification step for a Pdf document is very similar to verifying information on an application page or screen. There are only two differences.

  • The action: UA.LoadPdf () must be called prior to the verification actions.
  • The action: UA.ClearPdf () must be called after the last verification action.

In the example below, there are two verification actions:

The first verify action verifies the value of the Customer Name. The second uses a selector on the RowLabel column to verify the value in the RowData column.

These two actions are representative of the types of verification that you will use to verify your PDF documents.

We look forward to your feedback on this new capability of AscentialTest.

Please contact us at [email protected] if you have any questions or need some assistance.

 

Share the Post:

Related Content

Instructional Content, Thought Leadership

A Thousand G2 Reviews Later: Software Testing Tools Are Too Expensive

Instructional Content, Thought Leadership

Build Tests, Not Frameworks

Instructional Content

AscentialTest Error Tracking and Debugging

Instructional Content

Self-Guided PowerBuilder Tutorial

Get Started For Free: 30 Day Trial

Click here to download the Host ID generator. The download package includes full instructions. Please send us your details below to speed the process along.

Our Distribution and Consulting Partners

Appeon

Cigniti

Loop Software

Marlabs

Matryxsoft Tech

Novalys

OCS Consulting

Loading...

What We Are Up To Next

TFS/Azure Integration

Check our new Azure extension for executing AscentialTest command lines in the Azure Marketplace.

We look forward to offering additional integration with Microsoft’s Team Foundation Server and Azure through defect tracking and version control soon.

Omnis Studio

Automated testing support for OMNIS Studio is coming soon. All OMNIS elements will be supported including complex grids, list boxes, tables and tree views.

Custom Objects

Add automated testing support easily for your custom application elements by responding to simple test API messages with json strings. This feature will open up the possibility of testing any GUI element and  will be offered free of charge.

Test Debugger

Set breakpoints in your automated tests, view global and local variables and execute statements to make it easier to debug tests running on any of our supported platforms.

Get a Competitive Quote

Thank you for submitting your inquiry!

We will get back to you ASAP.  We aim to respond to all inquiries within 24 hours.