From last week, I had the printer test doing these tasks:
- Opening a text file
- Printing it to the OneNote printer using the Insert | File Printout command
- (Printing to the active page – the page OneNote is currently showing)
The challenge was to verify the file was printed correctly. One of the verifications the script does is to look in the OffineCache_Files folder to see if the correct number of files were created. I wrote about that last week so I won’t go into more detail here.
A second verification the script does it checking the proper number of items get created on the page. In this case, I should get three new embedded files added to the page. I get two pages of the printout (since it is two pages long) added to the page, and a little 2K PNG file. At first, I didn’t really understand what this little image file was for, but looking at it quickly showed it was the icon representation for the actual text file. It also includes the name of the file underneath it to give the user a reminder for which file was actually printed:
So I use the extensibility API to check to see that three new items get added to the page. (Actually, the object model uses the extensiblity API and I use the OM. Just want to be accurate). There are also some file size checks I added to ensure the files are not bogus.
There are other verifications that can be done in further scripts. Ensuring the link reports the correct location of the printed file and verifying the XPS and TXT files did not get corrupted during printing are two functionality tests that seem pretty obvious. There are also performance implications, security testing and so on to consider. Automation is never done.
Questions, comments, concerns and criticisms always welcome,