QTP 9.5 feature review - Web Extensibility Add-ins

I’ve now had a few days with Quicktest Pro 9.5, and most of that time has been spent with the new Web Extensibility feature. This feature has huge potential. I look forward to seeing how it is accepted by QTP programmers.

The basic idea is that you can create your own QTP add-in. When your add-in is loaded, Quicktest will recognize objects you defined in your add-in and make your custom methods available for them.

After I went through the tutorial in the QuickTest 9.5 documentation, I jumped into creating a Web add-in for a simple DIV in the product I am testing. I called the extension auLogin and the object auLoginForm. The first method I added was SubmitLogin. All it does is click the Login button. This seemed to be an unambitious task, but it proved more difficult than I counted on because I didn’t learn as much as I thought through the tutorial. It is also something much easier done with the single line Browser().Link(”html id:=Submit1_a”).click, but this exercise is about learning, not being efficient.

After all my work, I ended up with the ability to click the Login button with this line: Browser().auLoginForm(”micclass:=auLoginForm”).SubmitLogin

If that doesn’t do much for you, I’m not surprised, but consider that with a bit more coding, I can have a line like this:
Browser().auLoginForm(”micclass:=auLoginForm”).UserLogin “username”, “password”

That line will enter username and password then click the Login button.

Of course I already have a vbscript function that does this; so why would I want to recode everything to use this extension instead? I don’t. Maybe I would if I was doing record and playback, but that isn’t how I work. Instead, I think I will begin seeing the benefit of this on more complex objects like data grids which will have more complex methods. Of course that is all theoretical for me now. I won’t know until I actually roll up my sleeves and code up a more complex web extensibility add-in.

Problems

Until now, I have been purposefully ignoring the problems with how HP implemented web add-in extensibility in QTP 9.5, and there are many problems.

  • I don’t know Javascript. I suspect that many QTP programmers have dabbled in Javascript but are still much more comfortable coding vbscript. Unfortunately, the web extensions must be written in Javascript. Not knowing Javascript, I have had to learn Javascript at the same time that I learn how to write extensions making it more difficult.
  • You have to restart Quicktest Pro every time you make a change to an extension. QTP requires a full restart to unload or load an extension. For a novice like myself, this means a lot of restarting to test changes. HP, please work out a way to reload an extension without restarting QTP.
    ***UPDATE: See below for a great workaround to this***
  • You have to restart your Browser when you change a javascript file. Basically this is the same problem as above. Once QTP sees an object as an instance of your extension object, even if you restart QTP, the existing object will act as if no changes have been made to your Javascript file. You have to close all instances of the browser before changes will take effect.
  • Quicktest Pro 9.5 offers no way to debug the functions in your extensions.
  • Can’t edit extensions using QTP. Quicktest’s editor isn’t designed to work with javascript and xml files, so you are left to find another editor for the extensions.

These problems seem to outweigh the benefits using web extensibility add-ins, but I am an optimist, so I am not giving up yet. For now, you will be able to find me reading a Javascript book.

UPDATE:
In the comments, Motti shows us how to keep from having to restart QTP on every change and makes a pretty good case for using WebExtensibility. This will definitely help my learning curve.

Tags: , , , , , , , , , ,

4 Comments for “QTP 9.5 feature review - Web Extensibility Add-ins”

  1. Motti Says:

    Hi Will.
    As someone who was evolved in the creation of WebExtensibility I’m happy that you see the potential in this feature and I would like to address some of your remarks. I should say outright that although I do work for HP I’m writing this reply for personal reasons and that I don’t officially represent the official HP positions.

    I’d like to start with something useful, there is a flag you can add to the toolkit xml files so that you do not have to restart the browser after modifying the JavaScript files, yes this should have gone in the documentation, our bad.

    As for your other remarks (which are all good ones), here I can shed some light into why things were done this way.

    We decided to support JavaScript for extensions because JS is the lingua franca of the web, our assumption (which may be wrong) is that the people creating the extensibility are not necessarily QTP engineers, they may be the web developers that created the application, we should therefore go with the language most people who deal with web are familiar with.

    Debugging the JavaScript is certainly on our wish list, but we weren’t able to surmount the technical difficulties in time for this release.

    How useful will WebExtensibility be for people who already have a home-grown framework in use? I’m not sure. I would certainly not recommend throwing away your entire code base and redoing it as a WebExtensibility project. I do however feel that there are some benefits ,even for people who don’t use the repository, that are hard to achieve using regular function libraries and descriptive programming. E.g. WebExtensibility allows identifying objects according to more than DOM properties, you can define a custom property that requires traversal of several DOM elements in order to get its value and then use this property in the object’s description.

    This is already getting way to long for a blog reply (longer than the original post) so I’ll stop here. I do hope that the benefits in WebExtensibility will become more apparent to you in the future and I hope that at the very least you’ll be happy with the excuse to learn JavaScript ;o)

    Reply to Motti

  2. Motti Says:

    Ooops my XML got eaten up.
    <?xml version=”1.0″ encoding=”UTF-8″?>
    <Controls>
    <Settings>
    <Variable name=”cache scripts” value=”false”/>
    </Settings>

    Reply to Motti

  3. Motti Says:

    > Motti shows us how to keep from having to restart QTP on every change
    Actually the XML I show above prevents you from needing to restart IE after every change, there’s no way to do the same for QTP.
    The reason is that QTP only reads the Test Object definition file and this isn’t expected to change much even during development. A Test Object’s set of methods and properties should be determined early in the development process and doesn’t usually impact the actual implementation of the extensibility support.

    Reply to Motti

  4. Mithilesh Shirsat Says:

    Hi All,

    The major concerns which I have is the Memory Leak issue especially working with .NET applications. QTP 9.1 faced this issue, QTP 9.2 too had this issue. Does QTP 9.5 has rectified this issue or it still persist?

    Mithilesh

    Reply to Mithilesh Shirsat

Leave a Reply