QTP Tutorial #6 – Understanding QTP Record and Run Settings for Our First Test

This is the 6th QTP Tutorial in our QTP training series. Please visit this post to check out list of all tutorials we covered till now. As a reminder, we have started the QTP online training article series and we’ll be covering almost all QTP tutorials with simple examples to understand the concept.

The last few QTP tutorials have been about the QTP’s Keyword view which was really crucial in getting a high-level understanding of a QTP test’s structure and also introduced us to few ways in which our tests can be tailored to meet our needs.  So I think we are ready to record our first test in its entirety.  We are going to do just that in the next few QTP training articles. Today’s topic, therefore is the first step in doing so which is the “Record and Run settings’. We are going to understand all about this, why it is important and how this can affect a test.

Record and Run Settings Dialog

When QTP is launched and we choose to record a new test, the ‘record and run settings’ dialog opens up.  Alternately a user can choose to access this window by choosing “Automation->Record and Run Settings” option from the menu. So far in our examples we have just continued with its default settings but now we will explore it further. The following is the how this dialog looks:

Record and Run Settings Dialog

As the same suggests, this is a space that QTP provides the user to set certain parameters that help the user to create a test via record and to execute the same during a run session.

QTP can record and run a test on either a windows app or a web app. The web tab is available only when the Web add-in is selected to be loaded at start up. This tab is used for Web, .NET Web Forms, PeopleSoft, and Web-based SAP objects. So there are 2 tabs to define the settings separately for each of these environments.  There will be a separate ‘Siebel’ tab available is a Siebel add-in is installed and loaded during start up.

Let’s look at the ‘Web’ tab first”:

“Web Tab” on Record and Run Settings Dialog:

The default settings are as shown in the picture above. This setting means that when a record session is started the target of the record operation can be any of the web application that is already open in a browser.  The user also has a instruct QTP to ignore certain web pages like QC or any other page with a specific URL or a specific title. The way he can do that is, “Tools->Options->Web” and define those pages in the following QTP dialog:

Web Tab on Record and Run Settings Dialog

But if the user chooses, the next option “Open the following address when a record or run session begins” the corresponding elements in the screen get enabled. Take a look at it below:

Record and Run Settings Dialog 2

The user can enter the address of any page and the choice of the browser.  The browsers that QTP 11 supports are:

QTP Browsers support

The browsers that are supported and are currently installed in your machine will only appear in the list.

------------

There is another way to set the record and run settings other than from this window and that method is through Environment variables. Since we did not yet get there, we will discuss them in detail later on. For the sake of mentioning, if the environment variables URL_env and Browser_env are set, then it overrides the URL and browser chosen in the ‘Record and Run Setting’ window. How to create these and how they work – all this will be dealt with later.

‘Do not record and run on browsers that are already open ‘– If this option is chosen all the browsers that are open prior to recording and running and also prior to launching QTP will be ignored.  It is as if these browsers don’t exist for QTP because the user can not even spy these pages to view the objects. In other words, these browsers are totally ignored and as a result deemed inaccessible to QTP.

‘Close the browser when the test closes’ – this option when chosen will close the browsers on which the record and/or run session was carried out when the test ends.

“Windows Tab” on Record and Run Settings Dialog:

This tab is for the windows based applications. The default option to record and run on any windows app opened.

Windows Tab on Record and Run Settings Dialog

If the “Record and Run only on’ option is chosen, the other options under it get activated.

  1. Applications opened by QuickTest: when this option is chosen, the applications that are opened as a result of an invoke operation performed by Quick Test are only chosen for recording
  2. Applications opened via the Desktop (by the Windows shell): This means that the application that are opened from a windows desktop are chosen
  3. Applications specified below: choosing this option will open another child window where a specific app to be opened by the QTP at the beginning of a record or run session can be defined.

Record and Run Settings options

As you can see from the above window, the path of an application and its folder should be added and QTP opens that particular app while record and/or run.

That concludes a quick introduction to various ‘record and run settings’ that can be used for a QTP test. When testing a web app, it is also important to make sure that we add the correct settings in the windows application tab too. It is crucial because, it will help us in preventing opening up of unnecessary applications and also to make sure that we do not accidentally change any of the already open windows applications. It should be noted that, the setting in the windows tab do not directly affect the testing performed on a web app.

So the recommended settings for the windows tab while testing a web app are:

Windows Tab on Record and Run Settings for web app

Once these settings are done, the test recording begins. Any operation performed on the test gets recorded in the QTP. The tester can stop the record operation once all the steps that he wished to perform on the AUT are done by clicking on the “STOP” option available in the QTP menu.

The recorded steps can then be re-performed on the AUT by choosing ‘RUN’ option from QTP. Run operation too invokes the application (web or windows) depending on the setting specified.

Conclusion

This forms the basis for performing any basic steps on the AUT using QTP. In the real world this alone isn’t sufficient. Testing as an activity is verification and validation inclusive, so we will have to tailor these basic lines of code to include certain verification and validation points. To do so, QTP provides some checkpoints and the tester can also programmatically add steps to check few things as needed.

We will discuss these checkpoints in the coming series of articles and also try to learn the best practices to be followed while test creation to ensure maximum efficiency.

Feel free to post your QTP questions on this or previously covered QTP tutorials in below comments. If you have any suggestion for improving these tutorials please contact us.

Recommended reading

23 comments ↓

#1 Reshma Paygude

I really like the way you cover the topic details. this helps us to understand the concept clearly.
waiting for next tutorial.

#2 Mythreyei

Nice explanation with relevant screen shots.

#3 Kapil

first time got so many details of the record settings :)

#4 KAUSHIK

It is very good and friendly to understand the content.

#5 Supriya

It is showing very old browsers in the supported list image shown? Does QTP automatically detects browsers on the system running the test?

#6 Swati

@Supriya: Yes, in the list, QTP lists the browsers that are installed on the machine + compatible with it.

#7 Hitesh

Contents are users friendly and understandable….Screenshots helps a lot.

#8 Thiru

Hi Swati,

First i want to say big thank you to you for this wonderfull tutorial. It really helps me a lot to understand from basic. One suggesstion, It would be grateful if you provide some set of Question and answers once you complete the each topic like Keyword View Q&A.

#9 jairist

Hi everyone

I really appreciate your work in this helpful tutorial, and at first want to say thanks, but i want to know if can i run a jar file in QTP. and how.

thanks.

#10 Swati

@jairist: You can run any file from QTP by creating a shell object and using the run statement.
Dim oShell
Set oShell = CreateObject (“Wscript.shell”)
oShell.run “java -jar C:\jdk1.3.1\test\jfc\Test2\Test2.jar”‘

I hope that helps!

#11 Rakesh

Hi i am new to qtp and i have a small doubt.
i used qtp and filled a form in a website and submitted it using vb code but the data is not stored really in the website.
that means can’t we really input the data into the website??
All this is just for to test….?
any body please give me answer

#12 aparna

nice explanation with screen shots

#13 Vibhor

windows apps are working gud. but I am not able to spy or record from any web application in QTP 10, IE 8 & windows 7. Could you please help ?

#14 Swati Seela

@Vibhor: I think your browser version is incompatible with QTP. You might want to check the help files to check that. QTP supports a really old version of IE…

#15 venkateshj

Hi Swati, This is really a great article and shared with my friends.
I can’t understand the explanation for windows tap-“record and run only” – Application opened by quick test. Can you please explain that how?

#16 Tester

Wonderful articles. Extremely user friendly with the screenshots. Great help to the beginners. Thanks a lot !

#17 Niharika

Thanks alot for the article.. really very helpful for the beginners..!!

#18 Abdul

Hello there,

I was trying to record action on above website in QTP but it does not record anything. Do you have any idea? I tried using spy object as well but still i am unable to record anything

#19 Ankita

In windows tab, application details section has a ‘+’ button to specify more than one application.

But QTP can record only one application at a time then why it has provided an option to add more than one application here?

When i tried adding more than one applications then at the time of record all the applications gets open.

Could anyone please through some light on this?

#20 Abhishek

All I want to say is – God Bless the presenter. What a gem of a person.Knows what is expected by a new comer like me and many others.Has given such detailed information.I hope I will be able to get a start up of QTP by going through your sessions.Wow.

#21 Virag

hi,
Any one know how to launch QTP through Run i.e Ctrl+R-(???-Commend)

#22 kabir172

Hi,
Can we identify web and windows objects in same test?
Please let me know.

#23 PS

Hi,

How to change the record and run settings for a business component,the defaulted values,right now,i have to put in debug mode and change it while running to a different option in record and run settings,if i open the component,i do not see the settings,only when i run the script ,i see the option and put a breakpoint and change the settings,its for a windows based application.Can i get an example on how to set the env variables to override the settings.Thank You

Leave a Comment