Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Use of Class Concept in QTP
#1
Not Solved
Hi,

I want to implement the class concept in my framework/Script. Anyone of you have any idea how to use it and what is the importance of using this concept in scripting language like VB.

Regards,
Sankalp
Reply
#2
Not Solved
It is similar to the usage as in Java.
Define methods in a class and then call the methods using the objects created for that class.
Example
Code:
set classObj=new ExampleClass
classObj.fnExample
Class ExampleClass
Function  fnExample()
       msgbox "This is fn in class"
End Function
End Class
Reply
#3
Not Solved
Hi Ravi,
Thnks for the reply. But could you please elaborate the importance and usage with respect to QTP.

Regards,
Sankalp
Reply
#4
Not Solved
Hi Ankur/Saket,

Could you please help me over this as this is bit urgent and quite important/interesting for me.

Regards,
Sankalp
Reply
#5
Not Solved
It is basically used for achieving
1.Encapsulation(or information hiding)
2.Inheritance
3.Polymorphism

Encapsulation
--The encapsulation is the inclusion within a program object of all the resources need for the object to function - basically, the methods and the data. In OOP the encapsulation is mainly achieved by creating classes, the classes expose public methods and properties. The class is kind of a container or capsule or a cell, which encapsulate the set of methods, attribute and properties to provide its indented functionalities to other classes.

Inheritance
--Ability of a new class to be created, from an existing class by extending it, is called inheritance.

Polymorphism
--Polymorphisms is a generic term that means 'many forms'. More precisely Polymorphisms means the ability of a same function exibhiting different forms based on context.The function only differes in the arguments and has the same name in all the classes where it is used.
Reply
#6
Not Solved Wink 
Hi,

The concept of Class comes under Object Oriented Programming. OOPS contains some very good features like
  • Object
  • Class
  • Abstraction
  • Encapsulation
  • Inheritance
  • Polymorphism


It is very useful for developers to write a smart code. A code which is short, secure, reusable and much more manageable.

We can apply the same things for QTP as well.

Reply
#7
Not Solved
Hi,
Thnks for the reply. I think we can use encapsulation is QTP but inheritance and Polymorphism is not supported by QTP.
But the thing I am looking for is some real kind of example using OOPs concept in QTP which can enhance the modularity and resuability of my scripts.

Regards,
Sankalp
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  DP Encapsulation Within Class Object TheGlovner 2 1,846 10-12-2018, 02:11 PM
Last Post: TheGlovner
  Dynamic obj rep - get text in the class (html) marcio cravo moreira 0 2,146 05-26-2015, 06:58 PM
Last Post: marcio cravo moreira
  can class be a variable in DP wyrdo 1 2,505 08-07-2013, 01:33 PM
Last Post: anil2u
Sad QTP Script | how to get object of some open window just using its class type,Java sophia.sabir 1 8,900 08-07-2013, 01:26 PM
Last Post: anil2u
  Concept of Init Function of class Star 1 4,674 07-31-2009, 04:30 PM
Last Post: Saket

Forum Jump:


Users browsing this thread: 1 Guest(s)