Tuesday, 21 April 2015

Automation Framework Types in QTP

Automation Framework Types in QTP:

Automation framework is designed to ease the process of test automation using QTP. Automation framework helps from scalability point of view. It is very easy to automate the test cases using automation framework rather than ad hoc approach.
There are mainly 3 types of Automation Frameworks in QTP
Keyword Driven Framework
Data Driven Framework
Hybrid Framework
Keyword Driven Framework  :
In Keyword Driven Framework , Importance is given to functions than Test Data. when we have to test multiple functionality we can go for keyword frameworks. Each keyword is mapped to function in QTP library and application.
DATA Driven Framework :
In data driven framework, importance is given to test data than multiple functionality of application. We design data driven framework to work with applications where we want to test same flow with different test data.
Hybrid Framework -
This is the combination of keyword and data driven frameworks.
After analyzing the  application, you can decide what kind of framework best suits your needs and then you can design automation framework in QTP.
Please find below Some QTP Interview Questions from CTS
1. The following example uses the SetNextRow method to change the active row to the next row in the run-time Data Table. DataTable.SetNextRow
2. Browser("Welcome:= Mercury").Page("Welcome:= Mercury").WebEdit(EditDesc).Set "MyName"
3. DotNetFactory (System.Environment, System.DateTime, System.Collection)
var_my= DotNetFactory.CreateInstance("System.Environment")
msgbox var_my.CurrentDirectory
Dim SystemDate , oDate
Set SystemDate = Dotnetfactory.CreateInstance("System.DateTime")
Set oDate = SystemDate.Parse("Fri, 9 Oct 2009")
FormattedDate = oDate.Day & "/" & oDate.Month & "/" & oDate.Year
msgbox FormattedDate
The .NET SortedList class provides a hash table with automatically sorted key/value pairs.
The following code creates a SortedList and populates it with some key/value pairs:Set objSortedList = Dotnetfactory.CreateInstance ( "System.Collections.Sortedlist" )
4. How to create environment variable - Environment.Value("MyVariable")=10
5. How to access Environment Variable - MyValue=Environment.Value("MyVariable")
RepositoriesCollection Object in QTP
 RepositoriesCollection Object is used to associate or disassociate shared object repositories to QTP at run time
At the beginning of a run session, the RepositoriesCollection object contains the same set of object repository files as the Associated Repository Files tab of the Action Properties dialog box. The operations you perform on the RepositoriesCollection object affect only the run-time copy of the collection.
You use the RepositoriesCollection object to associate or disassociate shared object repositories with an action during a run session.
RepositoriesCollection Methods
   
Add   - Add .tsr file to current action in test
Find  - Find the index position of .tsr file in collection
MoveToPos  - Change the position of  repository
Remove   - Remove repository from current action in test
RemoveAll  - Remove all repositories from current action in test
RepositoriesCollection Properties
 
Count   - Get the total number of .tsr files associated to current action in test
Item   - gets the path of the tsr file located in the specified index position.
 We can add any number of .tsr files to current action in test at run time.
Example -
RepPath = "c:\Mercury\my.tsr"
RepositoriesCollection.RemoveAll()
RepositoriesCollection.Add(RepPath)
Pos = RepositoriesCollection.Find(RepPath)
RepositoriesCollection.Remove(Pos)
RepositoriesCollection.Add(RepPath)    ' add tsr filr
Window("Microso").WinObject("my").Click
Pos = RepositoriesCollection.Find(RepPath)

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.