Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you write your QTP Tests?

I am experimenting with using QTP for some webapp ui automation testing and I was wondering how people usually write their QTP tests. Do you use the object map, descriptive programming, a combination or some other way all together? Any little code example would be appreciated, Thank you

like image 303
Josh Harris Avatar asked Dec 16 '09 18:12

Josh Harris


People also ask

What is QTP testing process?

Quick Test Professional (QTP) is an automated functional testing tool to test both web and desktop applications and is based on VB scripting language. Considering the effectiveness the tool brings, it is one of the most widely used automation testing tools in the testing industry.

What is the difference between QTP and UFT?

The full type of QTP is QuickTest Professional while UFT implies Unified Functional Testing. A new tool has been developed that integrates the two most powerful testing products on a common platform of IDE. Hence by this tool, we have a powerful testing framework for API testing and GUI based applications.


1 Answers

Here's my suggestion.

1) Build your test automation requirements matrix. You can use samples from my blog

http://automation-beyond.com/2009/06/06/qa-test-automation-requirements-usability/

http://automation-beyond.com/2009/06/07/qa-test-automation-requirements-usability-2/

http://automation-beyond.com/2009/06/10/qa-test-automation-requirements-5-maintainability/

http://automation-beyond.com/2009/06/08/qa-test-automation-requirements-robustness/

http://automation-beyond.com/2009/06/09/qa-test-automation-requirements-scalability/

2) Choose your automation approach

3) Write your testing scripts according to the approach you chose

Note. QTP Repository way or Descriptive Programming belong to GUI recognition part of front-end functional test automation. They matter in terms of robustness and maintenance. Technically, it's nearly the same. In both cases you should understand GUI recognition concept well, or you will have problems no matter the approach.

  • You can store GUI object recognition properties in XML-like data structure and map the record to an English-like name. Whenever the original object's properties change, you update your record in repository, while a code still refers to a mapped name.
  • Or you can address GUI objects by directly putting same recognition properties into a function call. Whenever the original object's properties change, you have to do code change. But you don't have to maintain extra files along with your scripts.

A good framework should support both GUI-mapped and descriptive programming notations by operating at object reference level. I.e. you should keep object recognition and object interaction tasks separate.

Note that depending on context Descriptive Programming notation may slowdown performance of your scripts and it always demands extra maintenance effort while in other cases using Object Repositories only may lead to unwanted duplication of objects' descriptions or it may limit recognition of dynamically changing GUI.
I illustrate some points made above in the following article: A little QTP performance test: Object Repository vs. Descriptive Programming

Straight code examples (for a practical automation I recommend GUI Function Wrapping).

Descriptive programming - addressing objects by physical description properties.

Dim sProfile
sProfile = "Guest"

Set objWebParent = Browser("title:=Select Profile").Page("title:=Select Profile")
Set objWebObject = objWebParent.Link("text:="&sProfile) 
boolRC = objWebObject.Exist(0) 
If Not boolRC Then
'error-handling
End If
objWebObject.Click

Addressing objects by mapped GUI names

Browser("Select Profile").Page("Select Profile").Link("Guest").Click

Thank you,
Albert Gareev
http://automation-beyond.com/

like image 57
Albert Gareev Avatar answered Sep 28 '22 02:09

Albert Gareev