Strictness in QuickTest (9.0 and before), Part II

In our QTP framework, “strictness” has two dimensions: Test Level and Test Weight. Test Level refers to how loose the test is allowed to be when, say, selecting specific values from a WebList or WebRadioGroup. Test Weight refers to how important a given test is, and whether or not it will be run in the current cycle.

When we run tests, we run them at a default Test Level of 0, which is to say, “when you encounter a WebList or other input type, if the value I have specified does not exist, or only exists partially, just select a valid response and move on.”

The Test Weight is 200 (out of a possible 1000). The lower the Test Weight, the more important the test. When you run a 200-weight suite, you are essentially running a smoke test, where you want to run the least number of tests to validate that the system is up and running. This is what we run every time Cruise Control deploys a new site. A suite level of 800 or 1000 tells it to run every stinkin’ test we’ve written, and it takes much longer. That’s what we run at 2 am when nobody is here.

Let’s say I’m writing a QTP test where I create 15 new user accounts (each with different access features), log in as each, then perform existence checks on objects (buttons, checkboxes, etc) that should be enabled/disabled according to the access features. Given the number of different roles, features, and grants in our system, there can be over 800 permutations. Further, since we have between 4 and 8 hosted customer sites, this number mushrooms. As we host more customers, we want to scale our tests to be able to handle any number of customers, and we don’t want to have to change to code to do so.

Even further, we want to design the code so that we can re-use all these actions (User creation, logging in, access checking, etc.) in other scripts where we don’t want to run any checks beyond the most basic “did it work?” functionality.

Test Weight and Test Level are Environment variables, set in XML files, and altered at run-time to fit our needs (via an external utility). Each action has its own internal Test Weight, which is compared at run-time to Environment variable. If this internal Test Weight is greater than the weight of the suite being run, the action will short circuit and return to immediately without reporting anything or executing. If the internal Test Weight is less than or equal to the Environment variable, the test will execute.

Test Level is a lot more low-level. It is checked on a function-by-function basis, and the function in question always executes. The difference is, the Test Level will tell the function how to execute, then how to report its progress. An example would be (as above) a WebList, where you specify that “abc” be selected. If Test Level is 0 and “abc” doesn’t exist in the list, it will take the first non-empty string in the list and just select it without looking deeper into the matter. The idea is that if I’m testing a site in a different language, or a customer-deployed site that contains completely different information, the test will still work just fine.

Having these two dimensions on our tests ensures that we can run exactly the same scripts on multiple databases with varying degrees of thoroughness as the situation dictates.

Next, I’ll delve a little deeper into the different Test Levels we use, then I’ll post the code for this WebList.SmartSelect method, and how it implements the concept.

Tags: , , , , ,

7 Comments for “Strictness in QuickTest (9.0 and before), Part II”

  1. Jeff Says:

    I take it from this article that QTP can be integrated with Cruise Control. I spoke with Mercury this morning, and perhaps didn’t ask the correct questions, but was told by them that only TestDriector could be used to automate QTP execution. Can anyone send me any info that would tell me how to integrate the two?

    Reply to Jeff

  2. Marcus Says:

    Jeff, I’d love to send you some information about how we’re doing this, but I don’t see an email address for you!

    I’ll be posting something soon on how we utilize the QTP Automation API to do all this stuff. It’s pretty amazing a) what you can do, and b) that more people don’t do this kind of stuff, preferring instead to send Mercury hundreds of thousands of dollars to buy their little GUI-wrapped macros.

    Reply to Marcus

  3. jeff Says:

    Marcus, thanks much. jlage@funddevelopmentservices.com

    Reply to jeff

  4. Andrew Says:

    What’s the external utility you’re using to modify the Test Level and Test Weight at runtime?

    Reply to Andrew

  5. Marcus Says:

    Part of the next post I’m working on will include an example of how we’re doing it. The short version: the CGI script used to drive QTP takes Test Weight and Test Level as parameters, and an XML file containing those as environment variables is generated before the test is run.

    I’ll have example code when I post the follow-up to “Integrating QTP with non-Mercury Products”.

    Reply to Marcus

  6. srinivasarao Says:

    Hi,
    How to use XML Checkpoints in the applications like .Net , J2EE?
    How to check the XML files using XML checkpoint using QTP

    Reply to srinivasarao

  7. Diane Says:

    I have read your post on the Smart method for WebCheckBox.Select. The dilema I am facing is pulling all the items out of a weblist into the local QTP runtime table. Would you also describe the WebList.SmartSelect method and an example?
    Thank you in advance.

    Reply to Diane

Leave a Reply