Relevant Codes (by Anshoo Arora)

A Test Development Resource for HP QuickTest Professional.

Upcoming: Automation Framework

by Anshoo Arora on September 29, 2009

RelevantCodes[1]One is now available for download.

I have been planning for a while now to release a framework for our community. I even started on a few ideas, but I felt it would be best if I received some feedback from you guys. Please use the comment section of this post to share your ideas of what you would like to see included in the framework. Also, it will also help me if you could suggest an application that you would like to be automated, because in the end, without your help and your great ideas, this won’t be possible.

PS. You can post as anonymous if you like, but, I would really like to know who suggested what so I can pay credit where its deserved.

{ 53 comments… read them below or add one }

1 suni September 30, 2009 at 3:22 am

Hi Anshoo,

This is what we have been waiting for …
The frameworks i downloaded from google are very complex and difficult to implement , we should understand the framework to Implement. We should start the Framework first with directory structure that contains all the QTP stuff(Datasheets,Library,documents,Scripts,Environment xml files,results,logs,Recovery Scenaros).Then the driver script calling all the sub and main functions implemented for all the validations and reporting ).That is what my framework is which is dependant on Domain.Application,Tool.

And in general many managers does not understand basic framework definition and are putting pressure on the resources to come up with generic framework independant of application,tool,This is what i hear from my frinds and in interview as well.I never implemented proper framework that does not mean i am not automation resource.

We will implement the framework for one application that is accessible by all and can be implemented in their project

Cheers
Suni

Reply

2 Anshoo Arora September 30, 2009 at 5:44 pm

We should start the Framework first with directory structure that contains all the QTP stuff(Datasheets,Library,documents,Scripts,Environment xml files,results,logs,Recovery Scenaros).

This is an excellent idea. I didn’t think of it like this. I was under the impression that putting the entire framework out at once would be the best course of action. But, you’re right. I will try to create documentation for everything in a way that the entire package is quite easy to understand.

the driver script calling all the sub and main functions implemented for all the validations and reporting ).

I am going to reuse a scaled down and simplified version of my driver script from one of my projects, to make sure its easy to follow, even for people new to framework development. I am not looking to create a perfect structure, but a collection of ideas so people can use it to define their own ideology of what their framework should be.

We will implement the framework for one application that is accessible by all and can be implemented in their project

Agreed. If a few people can come out and suggest an application that they’re familiar with, and would like to see automated, that’ll be extremely helpful.

I hope more people find this post, and suggest a few ideas because without the support of everyone, this won’t be possible.

Thanks- Anshoo

3 Satishkumar Dega November 19, 2009 at 2:15 am

Hi Anshoo,
What is automation framework who write this automation frame work in a company what is role of auotmation tester work.what are the advantages and disadvantages explain me.
I need ur help regarding hoe to write automation frame work .I need step by step explaintion.
For example the sample http://newtours.demoaut.com to write a auto mation frame wok for this application I will understand .
And in general many managers does not understand basic framework definition and are putting pressure on the resources to come up with generic framework independant of application,tool,This is what i hear from my frinds and in interview as well.I never implemented proper framework that does not mean i am not automation resource.

I need ur help regrading this

4 alkaa October 1, 2009 at 5:01 am

Wouldn’t be better if you start from hybrid framwork, with explaining key word and data driven framwork? All the testers have alot suspense about this kind of frame work. and we have very less information about environment and functions please throw light on both the topics too.

Reply

5 Anshoo Arora October 1, 2009 at 6:37 pm

Alkaa, yes, it would be best to begin with a hybrid framework because it gives a glimpse of what’s possible with other sorts of frameworks – since it is nothing but a collection of concepts. That’s also what I had in mind too :)

very less information about environment and functions please throw light on both the topics too

This is an excellent suggestion. You’re absolutely right and I should create a Post discussing how functions and procedures can be used in everyday automation. The same concepts would obviously trasfer when the framework is ready, eventually making it easier for everyone.

6 alkaa October 1, 2009 at 5:02 am

Hello,

We can also parameterize the environment and variable. Kindly throw some light on that issue too. till the time no one has discussed on that topics.

Reply

7 Anshoo Arora October 1, 2009 at 6:38 pm

We can also parameterize the environment and variable.

Do you mean parametrize Environment Variables & normal variables or parametrize values to be driven to the application? If its the former then, I think this has been discussed several times on a few forums, and if you want, I can find and direct you to those thread, or if its easier for you – I can try to create a new post on this website as well.

Also, if you would like to create multiple variables during run-time, it can be done through the Execute statement. For example:

Execute "x = 5"
MsgBox x

Another example:

For y = 1 to 4
    Execute "x_" & y & " = " & y
Next

MsgBox x_1
MsgBox x_2
MsgBox x_3
MsgBox x_4

I hope this helps :)

8 Pragya October 12, 2009 at 5:52 am

Can you please throw some more light on “Execute” statement?

Reply

9 Anshoo Arora October 12, 2009 at 5:46 pm

We can use the Execute statement to evaluate something that we have as a parameter. Therefore, we can use Execute statement like this:

Execute "MsgBox ""Hello"""

or in a statement like this:

ix = 5
Execute "B" & ix & " = 100"
MsgBox B5

Note that, when we execute the 2nd line above without the help of Execute statement, we will always create an erroneous statement. That is, it will always return an error. Execute let’s us work around that. You can also read this post for more information.

10 Abrakh October 14, 2009 at 8:34 am

As frame works differ from system to system and scope of the work It will be good to take some general examples and explain it. some of them may be

Ex: 1. A live customer support professional working for cancelling orders which are hundreds each day. How we design structure, frame, report..
2. Automating a testing regression suite for a complex system involving verifying GUI, Database, 3rd party systems, including data preparation, data cleanup , batch jobs , reports, etc etc typical ….

Reply

11 Anshoo Arora October 16, 2009 at 6:59 pm

Hi Abrakh,

Are there any applications that you are aware of, which we can use to create such a framework? I’ve had several ideas over comments and e-mail, but nobody has yet recommended an application that will cover most of the concepts you described in your comment.

Once I have enough ideas and feedback from readers, I can finally begin working on it. :)

Thanks- Anshoo

12 Sridhar October 19, 2009 at 2:18 pm

Can anybody explain me about ObjectRepositoryUtil and when we can use it?

Reply

13 Anshoo Arora October 20, 2009 at 6:02 pm

Hi Sridhar,

From QTP Help:

ObjectRepositoryUtil Object Enables you to manipulate object repository files (shared and local) from outside of QuickTest Professional.

There are also several code examples available in the help, like this one:

Function EnumerateAllObjectsProperties(Root)
'The following function enumerates all the test objects under a specified object.
'For each test object, a message box opens containing the test object's name,
'properties, and property values.
 Dim TOCollection, TestObject, PropertiesCollection, Property, Msg
    Set TOCollection = RepositoryFrom.GetAllObjects(Root)
    For i = 0 To TOCollection.Count - 1
        Set TestObject = TOCollection.Item(i)
                    Msg = RepositoryFrom.GetLogicalName(TestObject) & vbNewLine
            Set PropertiesCollection = TestObject.GetTOProperties()
            For n = 0 To PropertiesCollection.Count - 1
                Set Property = PropertiesCollection.Item(n)
                Msg = Property.Name & "-" & Property.Value & vbNewLine
            Next
        MsgBox Msg
    Next
End Function

You can also view this thread at AdvancedQTP for more information: http://www.advancedqtp.com/forums/index.php/topic,1922.0.html

Also, I’m not sure what exactly you are looking for, but if you can ask specific questions about it, then I’m sure I will be able to provide more accurate answers.

14 Sridhar October 21, 2009 at 1:35 pm

Thanks for the reply Anshoo. I have another question. How to add multiple rows for a single parameter in Datatable at run time? Is there any method for the same?

Reply

15 Anshoo Arora October 21, 2009 at 5:21 pm

Hi Sridhar,

There sure is a way to add data to the DataTable at runtime. The trick is to set the row where you would like to set the data using the SetCurrentRow method of the DataTable. When SetCurrentRow statement executes, it gives focus to the next DataTable row regardless of it having data, or no data. Please see the demo below.

Below is the code I ran:

iRows = DataTable.GetSheet(dtLocalSheet).GetRowCount

For x = iRows + 1 to iRows + 5
    DataTable.SetCurrentRow(x)
    DataTable("UserName", dtLocalSheet) = "Empty"
Next

QTP Code

Below is the result in the DataTable:

QTP Results

I hope this helps..

16 Rafiq October 27, 2009 at 9:05 am

Hi Anshoo…
I came across ur blog to learn QTP…if you could help me out in Creating a Framework like Data Driven, KeyWord it would be really helpful for new comers. like u said earlier..i need to have a framework with (Driver Script, Function, Gui Properties, Datapath, Exception handling)..i need to whts happening in QTP real world.
Eg..Lets take Ebay as example and create a Framework
Thanks
Rafiq

Reply

17 Anshoo Arora October 29, 2009 at 10:28 am

I would try my best, Rafiq. However, creating a Framework is quite complex and it takes a while before everything is arranged in a working order. This framework, however, will be even more complex for me to create because I would like to make sure that the concepts I implement are easily understandable to the readers. eBay is quite a complex application and I’m afraid the working structure may be too complex to understand. I was thinking of an application that is predominantly static.

Once I have enough feedback and more readers show interest, I guess, that will be a good time to start.

18 suni October 29, 2009 at 12:35 am

Hi Anshoo,

I have an idea for selecting the application for Automation Framework,as u have got to work on technologies like .net,siebel,java better u suggest few applications that is best suited for implementing all the components of Automation framework .Then we can conduct small kind of poll, the application with more votes can be choosen for developing framework,

I have been viewing the site from the scratch,I am happy the site is looking great day by day with many new qtp users.

Best wishes
Suni

Reply

19 Anshoo Arora October 29, 2009 at 10:38 am

Sounds fantastic, Suni. I will wait for a little more feedback from readers, then start a poll. I guess that’d be the easiest and the fastest way to receive input.

I have been viewing the site from the scratch,I am happy the site is looking great day by day with many new qtp users.

You’re right. This website has come a long way since it started. There is a lot more to be done, but its been difficult to shuffle time between writing articles, my job, forums and site design. I will get there in due time though, I hope..

I’m also very glad that people are enjoying what they read here. Its been extremely rewarding.

Thanks :)

20 Rafiq November 4, 2009 at 5:30 pm

Thanks Anshoo,
Yes Ebay is a complex application…you better take simple application which will have all required things to create Framework…so that as a starter we can understand easily…eagerly waiting for ur Framework

Reply

21 Anshoo Arora November 5, 2009 at 12:12 pm

I will try to start quite soon considering a few weeks that it might take to build. I have a few ideas, but I would like to hear what the readers think would be a good application to automate. I would like to do it once, and do it well and incorporate some important concepts of test automation.

22 Anshoo Arora November 5, 2009 at 12:10 pm

Which application would you guys prefer? Web or Windows? If Windows, do you guys think Calculator is a good application for this? Any thoughts on Web?

Reply

23 Asiq Ahamed November 5, 2009 at 1:45 pm

Hi Anshoo,
IBM has already written article for framework with Calculator application. I would like to prefer web application for the upcoming framework, if all the guys accept it.

Reply

24 Anshoo Arora November 5, 2009 at 5:40 pm

Sounds good, Asiq. Now if everyone can come up with a good Web Application quickly :)

25 RockyHome November 5, 2009 at 8:56 pm

非常期待你的自动化测试架构,顺便问一下Arora,你懂中文吗? ^_^ —- ^_^
forwarding to your automation-framework release,by the way, Do you understand Chinese?

Reply

26 Anshoo Arora November 5, 2009 at 9:38 pm

Unfortunately, I don’t.. However, I’m happy to know that visitors from so many different countries are visiting Relevant Codes :)

27 Ranjini November 10, 2009 at 10:26 am

Hi Anshoo,
I came across lot of forums in past few months. But i think this was an excellent site that i never visited.
Great ! Thanks for your guidance in helping lot of members like me to learn QTP.

Reply

28 Anshoo Arora November 10, 2009 at 2:30 pm

Thanks Ranjini! :)

29 Mahesh Upadhyay December 3, 2009 at 7:27 am

Hi Anshoo,

Hi Anshoo i got such a wonderfull knowledge from this site, i appreciate your dedication to help the people like us,
i am very eager to get a framework demo from you.

Thanks
Mahesh

Reply

30 Anshoo Arora December 3, 2009 at 10:29 am

Hi Mahesh,

Thank you :)

The framework is ready, but I think I would like a few people to test it out first in their environments so we can fix a few bugs before distributing it to the community. I am still thinking about this though – I also need to create documentation for all libraries and find a way to show how the table is going to work.

31 Mahesh Upadhyay December 3, 2009 at 10:30 pm

Hi Anshoo,

I am glad to test your framework on my application if you don’t have any problem, definitely i will tell you the bugs that found in your framework demo, but i know there might be low priority bug. Please let me know if you need any help from my side.

Thanks
Mahesh

Reply

32 Anshoo Arora December 5, 2009 at 11:06 pm

Thanks for the offer Mahesh. I would really appreciate that. The package comes with 3 test-cases and if those 3 run well in your environment, then 90% of the job is done. I would only need a bit of feedback on anything else that my require a bit of improvement.

Please use the contact form and include the e-mail where you would like the link to be sent. Thanks!

Now, only if a few more people who like to help me out.. :)

33 POulami December 8, 2009 at 1:41 pm

HI

Please send me the link to poulamig@rediffmail.com

Was trying to understand framewrk from sometime

Reply

34 Anshoo Arora December 8, 2009 at 9:51 pm

The framework is in its Beta stage, and its only distributed to the readers who are interested in helping me test it and find a few defects that may arise when the release goes public.

35 Asiq Ahamed December 15, 2009 at 4:04 am

Hi Anshoo,
I am ready to test it.

Reply

36 jay February 17, 2010 at 8:05 am

Hello Anshoo

Can you provide link? I would like to participate in eval. Thx

Reply

37 Anshoo Arora February 17, 2010 at 8:46 am

Hi Jay,

Unfortunately, the evaluation period is over. But, the good news is that the framework is now available for download which you can find here.

Cheers.

38 naveen khunteta April 13, 2010 at 1:47 pm

hi Anshoo,
Please give me the proper execution steps of this frame work “relevant codes”…

Reply

39 Anshoo Arora April 13, 2010 at 1:58 pm

Naveen, have you already downloaded the framework?

40 Chary Chelloji June 18, 2010 at 3:08 pm

Hello Anshoo,
This is a splendid framework. I appreciate your efforts in creating this wonderful framework. I am looking at this framework now, will get back to you shortly with my findings.

Regards
Chary Chelloji

Reply

41 Anshoo Arora June 22, 2010 at 12:33 pm

Thanks Chary :)

42 Gaurav July 14, 2010 at 5:14 am

I am in a phase of creating a minute framework – keyword driven and thus I am analysing different types of frameworks available over net. I’ll have a look at this one, try and use it and then come back to you with feedback, if any.
I have recently started reading your posts on this site and I would want to take this opportunity to thank you for serving the complete QTP world. You are doing a great Job!.

Gaurav

Reply

43 Anshoo Arora July 14, 2010 at 3:20 pm

Thank you for your kind words, Gaurav! I’m extremely glad you found the material here useful.

44 Vishwanath November 12, 2010 at 5:53 am

Hi Anshoo,

Appreciate your efforts toward automation world!!!
Can you please share the updates on your framework.
There is one complication with this framework, that being how can we write VBS logical statements using this framework
as well as how can we run a test case multiple set of data.

Regards,
Vishwanath

Reply

45 sarita January 19, 2011 at 10:36 am

Hi Anshoo

please provide me the steps to run this frame work

Reply

46 Prasad June 9, 2011 at 6:49 am

Hi Anshoo,

Can you please explain me how the Report summary is written to Results.

I am facing a problem , when i run mulitple scripts(in one excel) the summary it is shows only one test passed.Wrong number statistics in Main Results Summary .

Reply

47 Anshoo Arora June 24, 2011 at 10:52 am

Prasad: One report per test. Are you saving the results though? When you hit “F5″, make you you have “Write run results to” option checked.

48 Raja September 16, 2011 at 4:01 am

Hi Anshoo,
I was using this framework but could please eplain what is ContextManager.dll? and its significance?
Regards,
Raja

Reply

49 Anshoo Arora September 24, 2011 at 9:22 pm

Raja: ContextManager.dll offers methods related to Reporter. Please see the link below that shows a few methods offered by the ContextManagetClass: http://relevantcodes.com/Articles/Comments/context.manager.png

50 Amol September 29, 2011 at 5:23 am

I have small doubt how I can run Single Test Case for different set of record using your current framework

Reply

51 Anshoo Arora November 19, 2009 at 3:12 pm

People with different backgrounds in testing with different tools have varied definitions of what a good framework should be. That means, my definition will be different from another person working in my team. That. Is. Fine. However, you must first understand what types of frameworks there are, what they do, and how can they make automation easier for the entire team. Now, again, my previous statement can differ for a large team as compared to a very small team.

When Relevant Codes One is released, you will see that its based on a very simple principle and users can create their test cases in a table and execute them without EVER opening QTP or manipulating the libraries. I have always said this, and to reiterate, you must read about frameworks and try to come with up with an idea that works well for you. However, the more generic a framework gets, the more complex it becomes.

PS. You can learn about the types of frameworks here: http://www.ibm.com/developerworks/rational/library/591.html

Reply

52 Hariom February 3, 2010 at 7:23 am

this code is not workin..

What Root ??
what argument I need pass from calling function to make this script excutable

Reply

53 Anshoo Arora February 4, 2010 at 7:33 am

From where are you running this code? From QTP? External VBS?

Reply

Leave a Comment

{ 1 trackback }

Previous post:

Next post: