Thursday, 8 March 2007

Automated Code Documentation for QTP Actions

Goal:
My goal was to be able to automatically produce code documentation for my QTP Test Actions to make it easier for others to re-use the actions and avoid having to manually create and maintain the documentation.
Background:
I had already selected NaturalDocs (http://www.naturaldocs.org/) for documenting my VBScript support functions. I wanted to be able to produce similar documentation for my re-usable QTP Test Actions.
Developing the solution:
Note: I often use the term Function to refer to a QTP Action.
On inspecting the QTP test script directory I found that each Action has a directory beneath the QTP Test directory and each Action directory contains a script file: Script.mts.
NaturalDocs recursively searches the specified directory looking for code files. It expects a file header and function headers in the code file. I added a file header and function header to the first Action of my QTP Test and added a function header to each of the remaining Actions. When I ran NaturalDocs it found each of the QTP Action script files and produced the documentation from the File and Function headers but because each Action has a separate script file only the first Action has the file header and hence the other Actions do not get associated with the QTP script name. To fix this problem I wrote a small perl script that concatenates all the individual Action scripts into a single file named after the QTP Test. These concatenated script files are placed in a dedicated directory and this directory is processed by NaturalDocs. This approach ensures all the QTP Actions are documented as part of their QTP Test. I added a call to this perl script in the batch file that is used to run NaturalDocs so that the concatenated files are produced each time I run NaturalDocs.
I extended the NaturalDocs configuration a little to recognise the keyword Action and document it in the same was as a Function. I had already added the keyword Parameter for documenting function parameters in my VBScript support libraries.


Problems
  • Keyword View: The large number of comment lines in the Action Header are all shown in the Keyword View. This doesn't look very good and just wastes screen space. perhaps there’s a way to configure Keyword View to no show the comment lines?
Example of documented QTP Test Actions: Screen Shot


Setup QTP automated code documentation

Friday, 23 February 2007

The First Post

This is my first post here.

I've been thinkng about a blog for a while. I've been working in software test automation for around 5 years. Mostly non gui system test in the telecoms industry but some gui web app uat recently.

Before working in software test I did a year or so in manufacturing systems development and a few years before that in manufacturing automation. Software for manufacturing robots..... now thats fun...... if you get the code wrong you'd better get your head out of the way pretty damn fast.

I've lurked on many software test groups, commenting from time to time but not very much.

I worked on a scrum (agile) project for a big telecoms instrument and monitoring system developer recently. I enjoyed that very much , it was a real eye opener working on an agile project for real - it takes a lot of work and discipline. It was fun finding ways to give test results back to the developers as rapudly as possible when they released code and it made me realise that in that environment the testers serve the developers first and foremost - giving them feedback on the code they've produced as rappidly as possible.

Even more recently I've been developing automated uat regression testing for an airline web booking app. This was my first time testing through the GUI. I've been using Mercury QTP as the main test tool for this. I've found it to be a pretty good tool for controlling the GUI and managing the test scripts but i'd have got on just as well with Watir or some other open source tool if the Mercury tools hadn't been available. It's good to have mercury test tool experience on your cv in the test automation job market though :-)

I'm starting a new job soon with a company who also use Mercury QTP. I think much of my blogging may be around getting the mercury tools to do what I want them to. For exampe this morning I successfully created automated code documentation for the QTP script actions. I've been using the open source NaturalDocs for automated code documentaion of my QTP script support functions. I finally made time to add my QTP re-usable actions to the code docs.

Well, thats enough drivel for now - I managed to acuire a snotty cold today so I've been treating it with Irish Red Breast Malt Wiskey for most of the evening - probably the cause of me actually getting this ramble off the ground.