Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is there a way to create dynamic objects by declaring the type of object as parameter
#1
Solved: 7 Years, 1 Month, 2 Weeks ago Question 
Hey guys, need some ideas about creating dynamic functions and objects which could be used across different platforms, e.g. web, java, windows, etc...
Below is an example of what I am trying to achieve (not even sure this would be possible). So for e.g. I have a check function which in case = true then reports Pass, otherwise reports Fail.
Code:
Public Sub ObjByTitle_Exist(objType, objTitle)
    Set objDesc = Description.Create  
    objDesc("micclass").value = objType
    objDesc("title").value = (objTitle & ".*")


    If objType(objDesc).Exist(5) Then
        ''' Report Pass
    Else
        ''' Report Fail
    End If
End Sub


The intention of such a thing is to be used across different platforms where when using it I just throw in the object type and the system will identify it and do whatever is needed or possible with that specific object.

Then I am looking to use it in this way:
Code:
'in Java:
ObjByTitle_Exist "JavaDialog", "DialogTitle"

'in Windows:
ObjByTitle_Exist "SwfDialog", "DialogTitle"

Another example would be for e.g. I have an SwfButton and a WebButton - no I am trying to access any of those buttons by using a function like the one above - I could create 2 different function for each object type, but this would extend the framework way too much. Any ideas if kind of a combined framework could be created or one to be used across multiple environments would be great?!
Reply
#2
Solved: 7 Years, 1 Month, 2 Weeks ago
I guess you are talking about different applications altogether when you refer to different environments.

Technically yes, it should be possible. I would suggest you to weight the pro-and-cons of doing this by doing a simple POC on a small module in all environments.
  • See if it is helping you get productive.
  • check if maintenance would be easy.
  • How easy will it be to onboard a new team mate in your project.
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#3
Solved: 7 Years, 1 Month, 2 Weeks ago
(10-11-2017, 07:41 PM)Ankur Wrote: I guess you are talking about different applications altogether when you refer to different environments.

Technically yes, it should be possible. I would suggest you to weight the pro-and-cons of doing this by doing a simple POC on a small module in all environments.
  • See if it is helping you get productive.
  • check if maintenance would be easy.
  • How easy will it be to onboard a new team mate in your project.

That is true Ankur, two or more different applications with a common piece of framework. If this is technically possible, then how would this be achievable, can you please give an example based on my code above? We're having tons of applications built using different technologies (.Net, Java, Web, etc..). Now some are integrated and there are test cases which are interacting with multiple apps - hence why I am looking for such a solution (common framework) as otherwise I'll have to build some frameworks for each of these application types. Looking to combine those into one.

Thank you.
Reply
#4
Solved: 7 Years, 1 Month, 2 Weeks ago
(10-11-2017, 07:41 PM)Ankur Wrote: I guess you are talking about different applications altogether when you refer to different environments.

Technically yes, it should be possible. I would suggest you to weight the pro-and-cons of doing this by doing a simple POC on a small module in all environments.
  • See if it is helping you get productive.
  • check if maintenance would be easy.
  • How easy will it be to onboard a new team mate in your project.

Hi Ankur, any examples here? More detailed ideas, suggestions would help a lot and would be much appreciated.

Thank you.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Need help in creating dynamic object string using Childobjects Keshub Mathur 0 1,608 09-11-2017, 05:52 PM
Last Post: Keshub Mathur
  Optional parameter in function amit25007 6 5,428 01-06-2016, 03:29 PM
Last Post: venkatesh9032
  How to make a function for an object that has a large number of parent objects Shroomsday 1 2,399 01-28-2014, 11:15 PM
Last Post: jacosta
Sad QTP Script | how to get object of some open window just using its class type,Java sophia.sabir 1 8,872 08-07-2013, 01:26 PM
Last Post: anil2u
  impossible to pass a parameter of type 64 bytes in a webservices dosreis 0 2,168 06-21-2013, 01:55 AM
Last Post: dosreis

Forum Jump:


Users browsing this thread: 1 Guest(s)