Automation of Word & PDF
We have a huge task of automating customer letters.
These are word documents & PDF's.
These letters looks like bank statements/ mobile bills where there is a company logo , address, some regular content, specific text, contact details in the footer etc. We need to test these items in a MS Word template and PDF's
Would like to know what are the options to automate MS Word & PDF.
By automate I assume you mean verification of the letter contents?
For word I think it would depend on the format of the letter, if they are formatted in a predefined way using templates, tables and the likes these should be something you could do using the Word COM object.
PDFs will be a lot harder. I the past I have copied contents of PDFs and performed InStr checks on the contents but have done nothing more adventurous than that.
If the letters are generated in bulk and you do not need UFT to generate them i.e. click on the print letter button, you should in theory be able to lose the overhead of running the code from UFT and just use VBScript.
Word has a COM API, https://msdn.microsoft.com/en-us/library/kw65a0we.aspx, and Adobe Acrobat has an API as well, Acrobat DC SDK Documentation
One of the fallacies of test automation is thinking too much like the user. You want to think in terms of covering the risk with as little code maintenance as possible. Adding integration test coverage would cover the same risks, but be a lot easier to maintain as you won't have to rely on brittle integrations with 3rd party applications.
Post Thanks / Like - 1 Thanks, 0 Likes, 0 Dislikes
thanked for this post
Yes it has predefined templates, tables, header and footer items to be verified. Along with the content have to verify the format/allignment aswell.
Do i any suitable code snippets as i am new into this
Here's a link to MS 'Hey Scripting Guy' scrip[t repository for Word scripts:
I am able to proceed but still struggling to verify the format.
Like the document has to be validated against a template for ex:
. Header has a table and inside it there is an image. I should verify that it is a correct image and also position (top left corner)
. Similarly the Date is on the top right corner. I should verify the position also
. Content also to be verified with respect to template
Any idea how to verify this
From UFT11.5 onwards you can add PDF checkpoints.
They work just like a web page checkpoint, but on the contents of a PDF meaning you can easily markup a template for each letter type and masking and using regular expressions wherever required.
... just another Tester ...