1: What is UFT AOM?
Answer: AOM stands for Automation Object Model.The UFT AOM is a set of objects, methods, and properties that enable you to control essentially all test settings ad test options. Using the objects, methods, and properties exposed by the UFT automation object model, along with loops and conditional statements, we can perform following tasks using Automation object model:
1. Execution of Test Scripts from VB Script. This helps in execution of tests from QTP and scheduling tests to run on remote machine. Test can be run in host machine/remote machine but QTP needs to be installed in host/remote machine in which test script needs to be executed.
2. We can change configurations (Test Settings and options) at runtime of QTP tests.
3. We can save test or component using AOM.
4. Using Initialization script that launch UFT automatically can enable same settings/options executing from multiple machines.
2: We can create an object of Quick Test in VBScript using ……
a. Set qtApp = CreateObject(“QuickTest.Application”, “MyServer”)
b. Set qtApp = CreateObject(“QuickTest.Application”)
c. Set qtApp As CreateObject(“QuickTest.Application”)
d. Set qtApp as CreateObject(“Scripting.QuickTest”)
Answer: We can create an object of QuickTest in VBScript using a) or b). We need to provide server details as shown in option a), in case we need to run test on a remote machine. In case we have to run test in the same machine, we can use option b), i.e without Server Parameter.
3: How can we associate a library at runtime with QTP test using AOM?
Answer: We can add a library using AOM as follows:
Create an object of QTP object.
Set qtApp = CreateObject(“Quicktest.Application”);
Multiple libraries can be associated with test as follows:
qtApp.Test.Settings.Resources.Libraries.Add “C:\Common_Func.vbs”
qtApp.Test.Settings.Resources.Libraries.Add “C:\Business_Func.vbs”
files = “C:\Common_Func.vbs| C:\Business_Func.vbs”
qtApp.Test.Settings.Resources.Libraries.Add(files)
In addition to AOM, we can associate libraries using function LoadFunctionLibrary FileName or ExecuteFile FileName
4: Can we generate script automatically for all test settings and options: Yes/No
Answer: We can generate AOM scripts for all test settings, and test options in QTP.
a. Script for all the test settings can be generated from File>Settings>Properties
b. Script for all the test option can be generated from Tools>Options>GUI Testing>General
5: How can we associate repositories with a test in QTP using AOM?
Answer: An object Repository is associated with action in the test and not the test as whole. We can associate object repository with an action as shown in the example below:
Set Qtpapp = createObject(“Quicktest.Application”)
Qtpapp.Open “C:\SampleTest1”,False,False
Set qtrep = Qtpapp. qtApp.Open “C:\Tests\Test1″, False, False ‘ Opens a test in qtp
Set qtRepositories = qtApp. Test.Actions(“Action1”).ObjectRepositories ‘Creates an object of repository collection i.e all repositories associated with a test action
If qtRepositories.Find(“C:\ORTest.tsr”) = -1 Then ‘If OR is already associated with a test, do nothing else add the required shared object repository.
qtRepositories.Add “C:\ORTest.tsr”, 1
End If
6: Can we stop a test execution through AOM?
Answer: Yes, we can stop a test from AOM, but the question arises, why do stop test from AOM when we can stop a test using exitTest statement. Many a times,exit statement does not work in QTP 11 when the exit statement was called from inside functions called from function in vbs library. In case exitTest statement does not work we can exit a test using below code:
Set qtAppObj = CreateObject(“quicktest.application”)
qtAppObj.Test.Stop
7: Which of the following method of recovery object is used to activate recovery scenario through AOM?
a. Activate
b. Add
c. Enabled
d. Focus
Answer: we can enable a recovery scenario using enabled method of recovery object.
8: How can we connect to ALM using VBScript?
Answer: Using the below code, we can connect to ALM through VBScript using QuickTest Application object as shown below:
Set qtApp = CreateObject (“QuickTest.Application”)
If qtApp.launched <> True then
qtApp.Launch
End If
qtApp.Visible = “true”
If Not qtApp.TDConnection.IsConnected Then
qtApp.TDConnection.Connect QCurl, DomainName, ProjectName, UserName, Password, False
End If
Answer: AOM stands for Automation Object Model.The UFT AOM is a set of objects, methods, and properties that enable you to control essentially all test settings ad test options. Using the objects, methods, and properties exposed by the UFT automation object model, along with loops and conditional statements, we can perform following tasks using Automation object model:
1. Execution of Test Scripts from VB Script. This helps in execution of tests from QTP and scheduling tests to run on remote machine. Test can be run in host machine/remote machine but QTP needs to be installed in host/remote machine in which test script needs to be executed.
2. We can change configurations (Test Settings and options) at runtime of QTP tests.
3. We can save test or component using AOM.
4. Using Initialization script that launch UFT automatically can enable same settings/options executing from multiple machines.
2: We can create an object of Quick Test in VBScript using ……
a. Set qtApp = CreateObject(“QuickTest.Application”, “MyServer”)
b. Set qtApp = CreateObject(“QuickTest.Application”)
c. Set qtApp As CreateObject(“QuickTest.Application”)
d. Set qtApp as CreateObject(“Scripting.QuickTest”)
Answer: We can create an object of QuickTest in VBScript using a) or b). We need to provide server details as shown in option a), in case we need to run test on a remote machine. In case we have to run test in the same machine, we can use option b), i.e without Server Parameter.
3: How can we associate a library at runtime with QTP test using AOM?
Answer: We can add a library using AOM as follows:
Create an object of QTP object.
Set qtApp = CreateObject(“Quicktest.Application”);
Multiple libraries can be associated with test as follows:
qtApp.Test.Settings.Resources.Libraries.Add “C:\Common_Func.vbs”
qtApp.Test.Settings.Resources.Libraries.Add “C:\Business_Func.vbs”
files = “C:\Common_Func.vbs| C:\Business_Func.vbs”
qtApp.Test.Settings.Resources.Libraries.Add(files)
In addition to AOM, we can associate libraries using function LoadFunctionLibrary FileName or ExecuteFile FileName
4: Can we generate script automatically for all test settings and options: Yes/No
Answer: We can generate AOM scripts for all test settings, and test options in QTP.
a. Script for all the test settings can be generated from File>Settings>Properties
b. Script for all the test option can be generated from Tools>Options>GUI Testing>General
5: How can we associate repositories with a test in QTP using AOM?
Answer: An object Repository is associated with action in the test and not the test as whole. We can associate object repository with an action as shown in the example below:
Set Qtpapp = createObject(“Quicktest.Application”)
Qtpapp.Open “C:\SampleTest1”,False,False
Set qtrep = Qtpapp. qtApp.Open “C:\Tests\Test1″, False, False ‘ Opens a test in qtp
Set qtRepositories = qtApp. Test.Actions(“Action1”).ObjectRepositories ‘Creates an object of repository collection i.e all repositories associated with a test action
If qtRepositories.Find(“C:\ORTest.tsr”) = -1 Then ‘If OR is already associated with a test, do nothing else add the required shared object repository.
qtRepositories.Add “C:\ORTest.tsr”, 1
End If
6: Can we stop a test execution through AOM?
Answer: Yes, we can stop a test from AOM, but the question arises, why do stop test from AOM when we can stop a test using exitTest statement. Many a times,exit statement does not work in QTP 11 when the exit statement was called from inside functions called from function in vbs library. In case exitTest statement does not work we can exit a test using below code:
Set qtAppObj = CreateObject(“quicktest.application”)
qtAppObj.Test.Stop
7: Which of the following method of recovery object is used to activate recovery scenario through AOM?
a. Activate
b. Add
c. Enabled
d. Focus
Answer: we can enable a recovery scenario using enabled method of recovery object.
8: How can we connect to ALM using VBScript?
Answer: Using the below code, we can connect to ALM through VBScript using QuickTest Application object as shown below:
Set qtApp = CreateObject (“QuickTest.Application”)
If qtApp.launched <> True then
qtApp.Launch
End If
qtApp.Visible = “true”
If Not qtApp.TDConnection.IsConnected Then
qtApp.TDConnection.Connect QCurl, DomainName, ProjectName, UserName, Password, False
End If
No comments:
Post a Comment