Author Archive

Regular Expression

Regular Expressions describes or matches a set of strings. It is often called a pattern as it describes set of strings.

Given underneath is one of the most widely used and ever confused BackLash character. The remaining expressions are serialized below that.

Using the Backslash Character

A backslash (\) instructs QuickTest to treat the next character as a literal character, if it is otherwise a special character. The backslash (\) can also instruct QuickTest to recognize certain ordinary characters as special characters. For example, QuickTest recognizes \n as the special newline character.

For example:

w matches the character w

\w is a special character that matches any word character including underscore

For example, in QTP, while entering the URL of a website,

The period would be mistaken as an indication of a regular expression. To indicate that the period is not part of a regular expression, you would enter it as follows:

mercurytours\.mercuryinteractive\.com Note: If a backslash character is used before a character that has no special meaning, the backslash is ignored. For example, \z matches z.

Expressions & Explanation

Special characters and sequences are used in writing patterns for regular expressions. The following describes the characters and sequences that can be used.


Marks the next character as either a special character or a literal. For example, “n” matches the character “n”. “\n” matches a newline character. The sequence “\\” matches “\” and “\(” matches “(“.


Matches the beginning of input.


Matches the end of input.


Matches the preceding character zero or more times. For example, “zo*” matches either “z” or “zoo”.


Matches the preceding character one or more times. For example, “zo+” matches “zoo” but not “z”.


Matches the preceding character zero or one time. For example, “a?ve?” matches the “ve” in “never”.


Matches any single character except a newline character.


Matches pattern and remembers the match. The matched substring can be retrieved from the resulting Matches collection, using Item [0]…[n]. To match parentheses characters ( ), use “\(” or “\)”.


Matches either x or y. For example, “zwood” matches “z” or “wood”. “(zw)oo” matches “zoo” or “wood”.


n is a nonnegative integer. Matches exactly n times. For example, “o{2}” does not match the “o” in “Bob,” but matches the first two o’s in “foooood”.


n is a nonnegative integer. Matches at least n times. For example, “o{2,}” does not match the “o” in “Bob” and matches all the o’s in “foooood.” “o{1,}” is equivalent to “o+”. “o{0,}” is equivalent to “o*”.


m and n are nonnegative integers. Matches at least n and at most m times. For example, “o{1,3}” matches the first three o’s in “fooooood.” “o{0,1}” is equivalent to “o?”.


A character set. Matches any one of the enclosed characters. For example, “[abc]” matches the “a” in “plain”.


A negative character set. Matches any character not enclosed. For example, “[^abc]” matches the “p” in “plain”.


A range of characters. Matches any character in the specified range. For example, “[a-z]” matches any lowercase alphabetic character in the range “a” through “z”.


A negative range characters. Matches any character not in the specified range. For example, “[m-z]” matches any character not in the range “m” through “z”.


Matches a word boundary, that is, the position between a word and a space. For example, “er\b” matches the “er” in “never” but not the “er” in “verb”.


Matches a non-word boundary. “ea*r\B” matches the “ear” in “never early”.


Matches a digit character. Equivalent to [0-9].


Matches a non-digit character. Equivalent to [^0-9].


Matches a form-feed character.


Matches a newline character.


Matches a carriage return character.


Matches any white space including space, tab, form-feed, etc. Equivalent to “[ \f\n\r\t\v]”.


Matches any nonwhite space character. Equivalent to “[^ \f\n\r\t\v]”.


Matches a tab character.


Matches a vertical tab character.


Matches any word character including underscore. Equivalent to “[A-Za-z0-9_]”.


Matches any non-word character. Equivalent to “[^A-Za-z0-9_]”.


Matches num, where num is a positive integer. A reference back to remembered matches. For example, “(.)\1” matches two consecutive identical characters.


Matches n, where n is an octal escape value. Octal escape values must be 1, 2, or 3 digits long. For example, “\11” and “11” both match a tab character. “011” is the equivalent of “01” & “1”. Octal escape values must not exceed 256. If they do, only the first two digits comprise the expression. Allows ASCII codes to be used in regular expressions.


Matches n, where n is a hexadecimal escape value. Hexadecimal escape values must be exactly two digits long. For example, “\x41” matches “A”. “\x041” is equivalent to “\x04” & “1”. Allows ASCII codes to be used in regular expressions.

Working with Excel Objects in QTP

We create framework for automating the application. For this we need the independent structure for reporting and data. Excel plays a very important role in this approach.

QTP has its own test result displaying mechanism in the predefined format. Once the test is run, the result sheet is generated which gives you the insight of the script – stating the point of failures, warnings and passes.

We create customized checkpoint in the script and it is possible to customize the result file also depending upon the checkpoint created will be passed or failed.

In most of the cases we want to create summarized or detailed report of the entire test in excels. The reason to create customized report is that one is able to keep the file in central location and to create the report in our own format.

In this article we are going to learn the interaction of Excel with VBScript.

The whole mechanism goes in the following steps:

1. Understanding the hierarchy of Excel Application.

2. Creating the Excel Object

3. Opening an existing workbook or creating the new one

4. Setting the objects for various sheets in workbook.

5. Writing and fetching the data values in the cells.

6. Saving and closing the workbook

7. Closing the application and releasing the memory

We will go through each of the above stated steps with a suitable example to understand the approach properly.

Understanding the hierarchy of Excel Application

We will not go into the details of the complete hierarchy of the Excel application but to the extend what is required.

Excel Application




Creating the Excel Object

The first step towards the process of reporting via excel is to create object of Excel. Reporting in Excel can either be done in backend, without making the application visible or u can make it appear to user once the process of writing or fetching the data is going. In either way creating of the Excel Application object is required.

It goes as:

Dim xl

Set xl = CreateObject (“Excel. Application”)

Opening an existing workbook or creating the new one

Once the excel object has been created, it means that excel application has been invoked but is not visible. So either one can perform the operations like that or make the application visible and then perform the operations.

To make the application visible:

xl.visible = true

To open a new Workbook:


To open an existing Workbook:

xl.workbooks.Open(“File Name with complete path”)

Setting and accessing the objects of sheets in workbook.

Once the workbook has been opened, either existing or new one, we need to write some data in various cells in various sheets of that workbook.

By default there are 3 sheets in a workbook and various operations can be performed on. So one need create the object to reference these sheets as it becomes easy to access them and you don’t have to mention the complete hierarchy over and over again.

Say one has to create a reference for sheet with index i, which starts from 1

Set sht1 = xl.activeworkbook.sheets(1)

One can add or delete n number of sheets from the activeworkbook

To add a sheet in workbook –


To delete a particular sheet where i represent the index which starts from 1 –


To change the name of the sheets –

xl.activeworkbook.sheeets(1).name = “Name of your choice”

To count the total number of sheets in the workbook

Cnt = xl.activeworkbook.sheets.count

Writing and fetching the data values in the cells

To write the data in Excel sheet, one should know the cell address in which the data has to be written. Same thing goes for accessing the data from the cells

To write the data in sheet2 cell address as D8, we write the following command. Cell address here is represented by row number followed by column number –

xl.activeworkbook.sheets (2).cells (8, 4) = “hello”

To fetch the data from sheet3 cell address A7 –

Val = xl.activeworkbook.sheets (3).cells (7, 1)

If one has already created the object of the particular sheet, you don’t have to write the complete hierarchy but simply –

Object.cells (row, col) = value

Saving and closing the workbook

Once the work completed you can save the newly created workbook to a specified location or save the changes made to already existing opened workbook.

To save as in case of new workbook

xl.activeworkbook.saveas “path_with_file_name.xls”

To save in case of existing workbook

To close the workbook


Closing the application and releasing the memory

To close the application


To release the memory of all the objects

Set xl = nothing



Browser(“Google”).Page(“Google”).WebEdit(“q”).Set (a)

Browser(“Google”).Page(“Google”).WebButton(“Google Search”).Click

Dim xl

Set xl = CreateObject(“Excel.Application”)

xl.visible = true

‘To open a new Workbook:


‘To open an existing Workbook:


Set sht1 = xl.activeworkbook.sheets(1)

‘To change the name of the sheets

xl.activeworkbook.sheets(1).name = “kanak”

‘To count the total number of sheets in the workbook

Cnt = xl.activeworkbook.sheets.count

msgbox  Cnt

xl.activeworkbook.sheets(2).cells(8,4) = “hello”

xl.activeworkbook.sheets(4).cells(8,4) = “step command in QTP 9.2”

wait 3

Val = xl.activeworkbook.sheets(4).cells(8,4)

msgbox Val

wait 3

Browser(“Google”).Page(“Google”).WebEdit(“q”).Set (Val)

Browser(“Google”).Page(“Google”).WebButton(“Google Search”).Click

‘xl.activeworkbook.saveas “path_with_file_name.xls”


Usability Testing

Usability Testing is a technique for ensuring that the intended users of a system can carry out the intended tasks efficiently, effectively and satisfactorily.

In a usability test, representative users try to do typical tasks with the product, while observers, including the development staff, watch, listen, and take notes. The product can be a Web site, Web application, or any other product. It does not have to be a finished product. You should be testing prototypes from early paper-based stages through fully functional later stages.

Usability can be defined as the degree to which a given piece of software assists the to accomplish a task, as opposed to becoming an additional impediment to such accomplishment. The broad goal of usable systems is often assessed using several criteria:

· Ease of learning

· Retention of learning over time

· Speed of task completion

· Error rate

· Subjective user satisfaction

Usability is the combination of fitness for purpose, ease of use, and ease of learning that makes a product effective. Usability testing focuses on determining if the product is easy to learn, satisfying to use and contains the functionality that the users desire. The movement towards usability testing stimulated the evolution of Usability Labs. Many forms of usability testing have been tried from discount usability engineering, field tests to competitive usability testing. Apart from research and development of various testing methods there have been development in the field of automated tools for evaluation of interface designs against usability guidelines. Some of the tools are DRUM, WebCAT, WebSAT etc.

Goals of Usability Testing:

Usability testing is a black-box testing technique. The aim is to observe people using the product to discover errors and areas of improvement. Usability testing generally involves measuring how well test subjects respond in four areas: efficiency, accuracy, recall, and emotional response. The results of the first test can be treated as a baseline or control measurement; all subsequent tests can then be compared to the baseline to indicate improvement.

  • Performance — How much time, and how many steps, are required for people to complete basic tasks? (For example, find something to buy, create a new account, and order the item.)
  • Accuracy — How many mistakes did people make? (And were they fatal or recoverable with the right information?)
  • Recall — How much does the person remember afterwards or after periods of non-use?
  • Emotional response — How does the person feel about the tasks completed?

Hallway testing

Hallway testing or hallway usability testing is a specific methodology of software usability testing. Rather than using an in-house, trained group of testers, just five to six random people, indicative of a cross-section of end users, are brought in to test the software the name of the technique refers to the fact that the testers should be random people who pass by in the hallway. The theory, as adopted from Jakob Nielsen’s research, is that 95% of usability problems can be discovered using this technique.

Remote testing

Remote usability testing is also known as unmoderated or asynchronous usability testing which involves the use of a specially modified on line survey, allowing the quantification of user testing studies by providing the ability to generate large sample sizes. Additionally, this style of user testing also provides an opportunity to segment feedback by demographic, attitudinal and behavioral type. The tests are carried out in the user’s own environment helping further simulate real-life scenario testing. This approach also provides a vehicle to easily solicit feedback from users in remote areas.

Requirement Definition

Requirements definition is the most crucial part of the project. Incorrect, inaccurate, or

excessive definition of requirements must necessarily result in schedule delays, wasted

resources, or customer dissatisfaction.

The requirements analysis should begin with business or organizational requirements and translate those into project requirements. If meeting stated requirements will be unreasonably costly, or take too long, the project requirements may have to be negotiated down, downscoped or down-sized, in discussions with customers or sponsors.

Any discussion of requirements analysis methods will quickly become specific to the type of project effort. Many industry areas have specific, proven techniques for obtaining thorough and accurate definition of requirements. Sometimes it is useful to write a draft users manual as a way to define requirements. While the methods may differ, the principles remain the same across all types and sizes of projects. The requirements analysis should cover the whole scope of the project. It must be comprehensive and thorough. It must consider the views and needs of all the project stakeholders.

The completed requirements analysis should be reviewed and approved by the customer or project sponsor before work continues.

The capture of user requirements is the process of gathering information about user needs.

User requirements should be realistic requirements are:

➔ Clear

➔ verifiable

➔ complete

➔ accurate

➔ feasible

Clarity and verifiability help ensure that delivered systems will meet user requirements.The specification of user requirements is the process of organising information about user needs and expressing them in a document.

A requirement is a ‘condition or capability needed by a user to solve a problem or achieve an objective’.This definition leads to two principal categories of requirements: ‘capability requirements’ and ‘constraint requirements’.

Capability requirements describe the process to be supported by software. Simply stated, they describe ‘what’ the users want to do.

The capacity attribute states ‘how much’ of a capability is needed at any moment in time.

Each capability requirement should be attached with a quantitative measure of the capacity required. For example the:

➔ number of users to be supported

➔ number of terminals to be supported

Constraint requirements place restrictions on how the user requirements are to be met. The user may place constraints on the software related to interfaces, quality, resources and timescales.

Users may constrain how communication is done with other systems, what hardware is to be used, what software it has to be compatible with, and how it must interact with human operators. These are all interface constraints.

A communications interface requirement may specify the networks and network protocols to be used.

A hardware interface requirement specifies all or part of the computer hardware the software is to execute on.

A software interface requirement specifies whether the software is to be compatible with other software (e.g other applications, compilers, operating systems, programming languages and database management systems).

Load, Performance & Stress Testing

Load, Performance & Stress testing:

Performance Test and Load / Stress Test determine the ability of the application to perform while under load. During Stress/Load testing the tester attempts to stress or load an aspect of the system to the point of failure – the goal being to determine weak points in the system architecture. The tester identifies peak load conditions at which the program will fail to handle required processing loads within required time spans. During Performance testing the tester designs test case scenarios to determine if the system meets the stated performance criteria (i.e. A Login request shall be responded to in 1 second or less under a typical daily load of 1000 requests per minute.). In both cases the tester is trying to determine the capacity of the system under a known set of conditions. The same set of tools and testing techniques can be applied for both types of capacity testing – only the goal of the test changes.

Performance Testing:

Once a clearly defined set of expectations are defined, performance testing can be done by gradually increasing the load on the system while looking for bottlenecks.

All the activities take a white-box approach. The system is inspected and monitored “from the inside out” and from a variety of angles. Measurements are taken and analyzed and tuning is done accordingly

The best time to execute performance testing is at the earliest opportunity.  Developing performance test scripts at an early stage provides opportunity to prevent serious performance problems and expectations before load testing.

Goals of Performance Testing:

Not to find bugs, but to eliminate system bottlenecks and establish a baseline for future regression tests

To determine various critical business processes and transactions while the system is under low load with a production sized database.

Load Testing:

load testing” is usually defined as the process of testing the system by feeding it the largest tasks it can operate with. Load testing is also called volume testing, or longevity/endurance testing.

Goals of Load Testing:

Expose bugs such as memory management bugs, memory leaks, buffer overflows, etc.

Copyright © 1996-2010 . All rights reserved.