Archive for the ‘Fundamentals’ Category

Checkproperty method in QTP:


Checkproperty method in QTP:
Check property in qtpAutomation tool itself does not find and report new bug(s) efficiently.It requires a skill of automation tester to let tool perform the operation in an efficient manner.We generally verify that application performs as expected;and if not,then report warning or info or error.Power of automation is unleashed only when we understand the thin line(hypothetical) that is between manual test and automation tool(s).I call this line as Auto-Manual bridge.I work out there.

Rolling back to topic again: There are different methods and properties available for checking/verifying.Exist,checkproperty, getROProperty etc.Let’s discuss Checkproperty method.We often come across a situation to verify the status of page load, test entered on the text box and similar scenarios.Checkproperty methods is very handy to solve the above problems easily.

Example:

Syntax:object.CheckProperty (PropertyName, PropertyValue, [TimeOut])

Example 1.Check the status of page.

>Browser("micclass:=Browser").Page("micclass:=Page").Object.CheckProperty ("status","done",3000)

Example 1.Verify the text Automationlab09 has been entered on the name textbox.

>Browser(“micclass:=Browser”).Page(“micclass:=Page”).WebEdit(“name of text box”).Set “Automationlab09”
sCheck=Browser(“micclass:=Browser”).Page(“micclass:=Page”).WebEdit(“Name”).CheckProperty (“value”, “Automationlab09”)

Here (in example 1), Quick test verifies whether the status on the status bar of browser is displayed as “done” or not. It waits till the timeout period ie. 3 seconds(in milliseconds),If it is unable to verify the status within 3 seconds then it’ll use the default time period specified in test settings.If verification is successful within time period it’ll return a boolean value TRUE and report test status as “PASSED” on test results else it’ll return boolean value FALSE and report the test status as “FAILED” on test results viewer.
This is an alternative way of using checkpoint in descriptive programming.

Recording modes in QTP:low level and analog recording:-


Recording-mode-QTP
Recording modes in QTP:low level and analog  recording:-

Q.How many types of recording modes in QTP?describe  each type ? or Guidelines for Analog and Low Level  Recording in QTP blah blah blah….
Well, above question is listed on several QTP forums and most of them has remained unanswered till date. I thought that it’ll help beginners; if i shed some basic light on it.Here it goes….
Recording modes in QTP:low level and analog recording:-
Normal recording mode is your default recording mode as it records and performs operation on the test object regardless of their location on the application under test screen.
Analog recording mode:Shift+alt+f3 is a short cut for branching towards analog recording while recording. It records the exact operation and cordinates of our mouse on the screen.
eg:.WinEdit(“Edit”).Click 289, 5, micRightBtn
Finally, Low level recording mode(Ctrl+Shift+f3) is used when neither of the above technique failed to recognize your test object. It records all run time objects as a window object (Winobject).It records on the object basic level.
You can switch between Analog recording and Low revel recording in the middle of the recording session.

What is .Childobjects in QTP?


Child Objects in QTP

Child-Objects

What is .Childobjects in QTP?


GUI controls or objects are always located in container objects.Okay lets have a real life example:
Suppose you have kept your laptop on your bedroom,so in this case, your home is your parent object,your laptop is a child object and your bedroom is again a parent object of laptop.Home>>Bedroom>>Laptop
Browser[parent]
Page[child of browser and parent of text box]
Textbox[child]
Similarly,
Scenario 1.Between Browser and Page:Browser is a parent object and page is  a child object
ex 1.Find the background color of the page?
Result=Browser(“micclass:=browser”).childobject(“bgcolor”)
Msgbox result  [Please do not try this ,as this will not run,just showing example]
Scenario 2.Between browser,page and checkbox
ex 1.Check(Tick) all the checkboxes present on the page?
Set oDesc=Description.Create()
oDesc.(“micclass”).value=”WebCheckBox”
Set count= Browser(“micclass:=browser”).page(“micclass:=page”).childobject(oDesc)
for i=0 to count-1
Browser(“micclass:=browser”).page(“micclass:=page”).WebCheckBox(count(i)).set “ON”
Next
Hence ,Webedit box is a child object of the Page object, which is in turn is a child object of the Browser object.
Hope it’s is clear as of now…

What is micclass in qtp ?


Micclass in qtp

Micclass in qtp

What is micclass in qtp ?

It stands for Mercury interactive class constant.But it is shown as Classname in QTP environment.
eg:Properties=Class name and Value=Browser,so don’t get confused.

SystemUtil.Run “iexplore.exe”,”https://automationlab09.wordpress.com”
sFetchedURL=Browser(“micclass:=Browser”).Page(“micclass:=Page”).GetROProperty(“url”)
Msgbox sFetchedURL

Following is the wrong way of it’s usage:
———————————————————–
Browser(“Class Name:=Browser”)

Correct way is:

Browser(“Micclass:=Browser”)
———————————————————-

Example:

Click on the forgot password link on the login window:

Solution 1:
Browser(“miccclass:=Browser”).Page(“micclass:=Page”).Link(“text:=Forgot Password”).Click

Solution2 :

Set oDesc = Description.Create
oDesc(“text”).Value = “forgot password”

Browser(“miccclass:=Browser”).Page(“micclass:=Page”).Link(oDesc).Click

Browser(“miccclass:=Browser”).Page(“micclass:=Page”).Link(oDesc).Click

Solution3:

Set oDesc = Description.Create

oDesc(“html tag”).value = “A”
oDesc(“text”).Value = “forgot password”
Browser(“miccclass:=Browser”).Page(“micclass:=Page”).childobjects(oDesc).Click

———————————————————–
Do’s and Dont’s:

If there is “forgot password?” instread of “forgot password” :

By default QTP treats all DP properties as regular expression patterns eg: “forgot password?” is treated as forgot password hence, it throws out an error as “Cannot identify object”.This happens because there is no such text as “forgot password” ie.?(question mark) is missing from the text.

Solution: Use regular expression in order to cope up with this problem.

Browser(“miccclass:=Browser”).Page(“micclass:=Page”).Link(“text:=forgot password\?”).Click

Solution 2 :

Set oDesc = Description.Create
oDesc(“text”).Value = “forgot password?”
oDesc(“text”).RegularExpression = False ‘It doesn’t treat the text as regular expression

Now QTP treats it as forgot password? 🙂

Cheers!!

Quick Test Pro:-An Introduction


If you would like to know what automation actually means , refer the link below:-www.satisfice.com/articles/test_automation_snake_oil.pdf [Automation Snake Oil by James Bach]

What is QTP ?

QTP–> stands for Quick Test Professional.It is an automated graphical user interface functional and regression testing tool which allows the automation of web based and client based computer applications running on Microsoft Windows.

It uses VBScript as it’s scripting language, but VBScript supports classes but not polymorphism and inheritance.Different Add-ins are available for custom testing.QTP does not support Java  appln.. unless Java add-in is installed.
QTP is usually used for “UI Based” Test Case Automation, it can automate some “Non-UI” based Test Cases. (e.g. API (Certification testing), Database Testing, etc.)
QTP is an advanced version of Winrunner,hence it works together with Winrunner and Quality center.
Limitations:It cannot be used on non-window based application,since it fetches object like Activex from Windows Appllication,and Remote desktop connection is not possible due to licensing issue.
Some well known Versions:QTP 8.2, 9.0, 9.1, 9.2, 9.5,10,11,11.5,11.52
Supported Browsers:IE
IE,Firefox,Netscape
Recording:IE
Played:IE,Firefox,Netscape,firefox3(q-10)
Versions Released Date/Year
11.52 2013
11.5 2012
11.0 2010
10.0 Feb 2009
9.5 Feb 2008
9.2 Feb 2007
9.1 Jan 2007
9.0 -2006
8.0 Jan 2004
6.5 Mar 2004

I greatly appreciate any comments on how i can improve this blog.So please feel free to write to me.

QTP Lab:- A touch of madness!