Interview Questions:- I have taken 100’s of interview and most of the time I feel that the Candidate is not confident about the answer, have you ever thought the reason of the same or are you facing the same problem? If yes then I would recommend that you have not practiced/ learned UFT, because only learning/practice gives you the confidence to speak in the interview.
Most of the people asked me to give me some interview questions, and I always say that in UFT there are thousand’s of question which the interviewer can ask, it can be of logical or programming or scenario based? Tell me which you need? Then too…
Here I am listing out 50 most popular questions in the interview, which I feel the candidate should prepare/ know about the answers, I am dividing these questions in 3 different sections i.e basic, Intermediate and complex questions. In addition, I am listing down some of the tricky questions for each of the sections.
Basic Questions
1. What is UFT?
Answer: HP Unified Functional Testing (UFT) software, formerly known as HP QuickTest Professional
(QTP), provides functional and regression test automation for software applications and environments.
It is a record and playback automation tool, which works for web and window based application and it
comes with 3 basic add-in Web, Visual basic and Activex and if required the different addin's like Java,
Terminal Emulator,SAP, Siebel etc all you justneed to download and plug-in with the tool.
2. What is Manual Testing? What is the advantage of Automation over Manual Testing?
Answer: Manual testing is the process of manually testing Software for defects. It requires a tester to play the role of an end user and use most of all features of the application to ensure correct behavior.
• If you have to run a set of tests repeatedly automation is a huge gain
• Helps performing "compatibility testing" - testing the software on different configurations
• Can be run simultaneously on different machines thus decreasing testing time
• Long term costs are reduced
• Human errors can be eliminated.
3. What is the difference between QTP and UFT?
Answer: Difference between QTP and UFT is :-
· UFT is used to test both GUI and API testing
· HP Unified Functional Testing has enhanced and brand new functionalities that are not available in QTP
· HP Unified Functional Testing offers integration with Perfecto Mobile in order to perform Mobile Testing.
· HP Unified Functional Testing offers new Add-ins for GUI testing as such as: QT and Flex.
· UFT’s new GUI, API and BPT testing window
· OS supported by QTP and UFT
· UTF runs on OS: Windows XP/Vista/2003/7/8/8.1 and Windows Server 2008/Windows Server 2012 R2
· QTP runs on OS: Windows XP/2003/Vista/7 and Windows Server 2008
4. How UFT identifies/recognize the object?
Answer: Quick Test stores the description/properties for application objects in a file called object Repository.
As you start recording your test. UFT will add an entry for each item you interact with.
Each object Repository entry will be identified by a logical name(determined automatically by UFT), and
it will contain a set of properties like name, type, class name etc that uniquely identify each object.
Each line in the UFT will contain a reference of the object that you interacted with, a call to the appropriate method like set,click) and any parameter for that method(such as the value for a call to the set method).
The reference to objects in the script will all be identified by the logical name, rather than any physical, descriptive properties.
Test Object Model:-Test Object Model is a set of object types (i.e. copy of Application object) that UFT
uses to represent the object in our application.
Or
1. Test Object -If you think logically then the name itself is describing everything, "Test object"
means the application object which we are going to test are the Test object.or even we can say that the
objects which are stored in the object repository at the time of recording are called Test objects.
Example of test object - Text box, List Box, radio button, label, link, button.
2. Run time objects- The application object which you see at the time of running the UFT is called
Run time objects.
Most of the people asked me to give me some interview questions, and I always say that in UFT there are thousand’s of question which the interviewer can ask, it can be of logical or programming or scenario based? Tell me which you need? Then too…
Here I am listing out 50 most popular questions in the interview, which I feel the candidate should prepare/ know about the answers, I am dividing these questions in 3 different sections i.e basic, Intermediate and complex questions. In addition, I am listing down some of the tricky questions for each of the sections.
Basic Questions
1. What is UFT?
Answer: HP Unified Functional Testing (UFT) software, formerly known as HP QuickTest Professional
(QTP), provides functional and regression test automation for software applications and environments.
It is a record and playback automation tool, which works for web and window based application and it
comes with 3 basic add-in Web, Visual basic and Activex and if required the different addin's like Java,
Terminal Emulator,SAP, Siebel etc all you justneed to download and plug-in with the tool.
2. What is Manual Testing? What is the advantage of Automation over Manual Testing?
Answer: Manual testing is the process of manually testing Software for defects. It requires a tester to play the role of an end user and use most of all features of the application to ensure correct behavior.
• If you have to run a set of tests repeatedly automation is a huge gain
• Helps performing "compatibility testing" - testing the software on different configurations
• Can be run simultaneously on different machines thus decreasing testing time
• Long term costs are reduced
• Human errors can be eliminated.
3. What is the difference between QTP and UFT?
Answer: Difference between QTP and UFT is :-
· UFT is used to test both GUI and API testing
· HP Unified Functional Testing has enhanced and brand new functionalities that are not available in QTP
· HP Unified Functional Testing offers integration with Perfecto Mobile in order to perform Mobile Testing.
· HP Unified Functional Testing offers new Add-ins for GUI testing as such as: QT and Flex.
· UFT’s new GUI, API and BPT testing window
· OS supported by QTP and UFT
· UTF runs on OS: Windows XP/Vista/2003/7/8/8.1 and Windows Server 2008/Windows Server 2012 R2
· QTP runs on OS: Windows XP/2003/Vista/7 and Windows Server 2008
4. How UFT identifies/recognize the object?
Answer: Quick Test stores the description/properties for application objects in a file called object Repository.
As you start recording your test. UFT will add an entry for each item you interact with.
Each object Repository entry will be identified by a logical name(determined automatically by UFT), and
it will contain a set of properties like name, type, class name etc that uniquely identify each object.
Each line in the UFT will contain a reference of the object that you interacted with, a call to the appropriate method like set,click) and any parameter for that method(such as the value for a call to the set method).
The reference to objects in the script will all be identified by the logical name, rather than any physical, descriptive properties.
Test Object Model:-Test Object Model is a set of object types (i.e. copy of Application object) that UFT
uses to represent the object in our application.
Or
1. Test Object -If you think logically then the name itself is describing everything, "Test object"
means the application object which we are going to test are the Test object.or even we can say that the
objects which are stored in the object repository at the time of recording are called Test objects.
Example of test object - Text box, List Box, radio button, label, link, button.
2. Run time objects- The application object which you see at the time of running the UFT is called
Run time objects.
5. What is datatable? Important method of datatable?
Answer: A DataTable, similar to Microsoft Excel helps testers to create data driven test cases that can be
used to run an Action multiple times. There are two types of Datatables.
· Local Data Table - Each action has its own private data table also known as local data table which is can
also be accessed across actions.
· Global Data Table - Each test has one global data sheet that is accessible across actions.
Answer: A DataTable, similar to Microsoft Excel helps testers to create data driven test cases that can be
used to run an Action multiple times. There are two types of Datatables.
· Local Data Table - Each action has its own private data table also known as local data table which is can
also be accessed across actions.
· Global Data Table - Each test has one global data sheet that is accessible across actions.
6. What is Parameterization and Types of parameterization?
Answer: To the simplest, when you want to pass the data to the scripts/ test then we use data
parameterization
Or
When you want to test the application with multiple set of values then we use the data parameterization.
UFT provide ways to accept different test inputs to the test script. This process of providing different input
values through external parameters is called as parameterization
Types of parameterization in UFT:-
The variable value can be or the parameter types can be:
7. What is Step In, Step Out, Console, Breakpoint, Debug from step?
Answer: A debugger is a tool to help you follow the logic of your test code as it runs. Debugging is attempting
to figure out the cause of a problem in your test script, and then taking action to fix the problem.
or
Debugging, in automation testing context, is a systematic process of spotting and fixing the coding issues in
the automation scripts so that the script will be more robust and can spot the defects in the application.
There are various ways to perform debugging using break points in QTP. Break Points can be inserted just
by pressing "F9" or by using the Menu option "Run" → "Inserting/Removing Break Point".
Answer: To the simplest, when you want to pass the data to the scripts/ test then we use data
parameterization
Or
When you want to test the application with multiple set of values then we use the data parameterization.
UFT provide ways to accept different test inputs to the test script. This process of providing different input
values through external parameters is called as parameterization
Types of parameterization in UFT:-
The variable value can be or the parameter types can be:
- Data Table parameters
- Test/Action parameters
- Environment variable parameters
- Random number parameters
7. What is Step In, Step Out, Console, Breakpoint, Debug from step?
Answer: A debugger is a tool to help you follow the logic of your test code as it runs. Debugging is attempting
to figure out the cause of a problem in your test script, and then taking action to fix the problem.
or
Debugging, in automation testing context, is a systematic process of spotting and fixing the coding issues in
the automation scripts so that the script will be more robust and can spot the defects in the application.
There are various ways to perform debugging using break points in QTP. Break Points can be inserted just
by pressing "F9" or by using the Menu option "Run" → "Inserting/Removing Break Point".
Method | ShortCut | Description |
---|---|---|
Step Into | F11 | Used to execute each and every Step. Steps into the Function/Action and executes line by line. It pauses on each line after execution. |
Step Over | F10 | Used to Step over the Function. Step Over runs only the current step in the active document. |
Step Out | Shift+F11 | After Step Into the function, you can use the Step Out command. Step Out continues the run to the end of the function and then pauses the run session at the next line. |
ShortCut | Description |
---|---|
F9 | Insert/Remove BreakPoint |
Ctrl+F9 | Enable/Disable BreakPoint |
Ctrl+Shift+F9 | Clear All BreakPoint |
Use Only Menu | Enable/Disable All BreakPoints |
Run To Step:
You can instruct UFT to run from the beginning of the test or action or from the current location in the test
and to stop at a particular step. This is similar to adding a temporary breakpoint to a step.
Debug from Step:
You can instruct UFT to begin your debug session from a particular step instead of beginning the run at the
start of the test or action. Before you start debugging from a specific step, make sure that the application is
open to the location
8. What is Option Explicit, Variable, For, while, Loop, Variant?
Answer: Option Explicit Used at script level to force explicit declaration of all variables in that script. If we
use 'Option Explicit', then we must declare the variable before we use. If you don’t declare the variable, then
it returns an error message. If you don’t use 'Option Explicit' then no need of declaring the variables.
Variable: Variable is a named memory location used to hold a value that can be changed during the script execution. VBScript has only ONE fundamental data type, Variant.
A loop statement allows us to execute a statement or group of statements multiple times and following is the general from of a loop statement in VBScript.
You can instruct UFT to run from the beginning of the test or action or from the current location in the test
and to stop at a particular step. This is similar to adding a temporary breakpoint to a step.
Debug from Step:
You can instruct UFT to begin your debug session from a particular step instead of beginning the run at the
start of the test or action. Before you start debugging from a specific step, make sure that the application is
open to the location
8. What is Option Explicit, Variable, For, while, Loop, Variant?
Answer: Option Explicit Used at script level to force explicit declaration of all variables in that script. If we
use 'Option Explicit', then we must declare the variable before we use. If you don’t declare the variable, then
it returns an error message. If you don’t use 'Option Explicit' then no need of declaring the variables.
Variable: Variable is a named memory location used to hold a value that can be changed during the script execution. VBScript has only ONE fundamental data type, Variant.
A loop statement allows us to execute a statement or group of statements multiple times and following is the general from of a loop statement in VBScript.
VBScript provides the following types of loops to handle looping requirements. Click the following links to check
their detail.
their detail.
Loop Type | Description |
---|---|
for loop | Executes a sequence of statements multiple times and abbreviates the code that manages the loop variable. |
for ..each loop | This is executed if there is at least one element in group and reiterated for each element in a group. |
while..wend loop | This tests the condition before executing the loop body. |
do..while loops | The do..While statements will be executed as long as condition is True.(i.e.,) The Loop should be repeated till the condition is False. |
do..until loops | The do..Until statements will be executed as long as condition is False.(i.e.,) The Loop should be repeated till the condition is True. |
9. What is Object Repository?
Answer: Object Repository is a collection of object and properties with which UFT will be able to recognize
the objects. Object repository acts as an interface between the Test script and AUT in order to identify the objects during execution.
10. Types of Object Repository?
Answer: UFT has two types of object repositories for storing object information:
1.Shared object repository
2.Local object Repository
Shared Object Repository: A Shared Object Repository(SOR) stores objects information in a file that
can be accessed by multiple Test.Extension of file name is .tsr. This is the most familiar and efficient way
to save objects
Local Object Repository: Local Object Repository stores objects information in a file that is associated
with one specific action, so that only that action can access the stored objects. Extension of file name is .mtr
11. What is Actions? Types of Action?
Answer: Actions help divide test into "logical units" or "Business Processes". Actions help create a script
which is more modular and efficient.
There 3 types of Actions
·Reusable Actions: can be used in other Tests. They can be used in the same Test Script multiple times.
·Non-Reusable Actions: can not be used in other Tests. They can be called in the same script only once
·External action: is a reusable action stored with another test. These actions are read-only in the calling
test,but we can choose to use a local, editable copy of the Data Table information for the external action.
When a call to an external action is inserted, the action is inserted in read-only format
12. What is an Array?
Answer: Array is a special type of variable that allows you to store multiple values against a single variable
VB Script arrays are created by first assigning an array object to a variable name.
Dim arrayName(numberOfElements)
Dim FruitTypes(3)
FruitTypes(0)=”Red”
FruitTypes(1)=”White”
FruitTypes(2)=”Green”
13. Types of Array?
Answer: There are 2 types of Arrays
· Static arrays
· Dynamic arrays
Static arrays stay a fixed index size, will not be change. Ex: Dim Arr(5)
Dynamic arrays don't have a fixed index size. You can increase or decrease the index size at any time.
14. Difference between Call to copy and Call to existing action?
Answer: Call to Copy: When u insert a call to copy of action, the original action is copied in the test. Any changes u make to this action will not impact to original action. In this all the resources like source code, data table contents & object repository contents are editable.
Call to existing: It is like a link to the original action. The called action will be read only in the test. If u want
to make any changes, u have to make to the original action.In this all the resources like source code, data
table contents & object repository contents are non-editable
15. What is Function?
Answer: Function is a series of VB Script statements to perform given task or action
A simple function looks like below:-
Function Multiplication()
A=b*c
End Function
16. In what all ways you can pass the argument in Functions?
Answer: In a Function declaration, each parameter can be specified as ByRef or ByVal. If neither is
specified, the default is ByRef.
17. What is Mandatory , Assisitive and Ordinal Identifiers?
Answer: UFT uses three types of properties during object identification, these are Mandatory, Assistive
and Ordinal identifiers.
Mandatory properties: This is the list of properties for a certain class (link, edit box, button etc), where
UFT referred these properties first for object identification. Example Name, text, html id.
Assistive properties: In some cases mandatory properties are not enough to identify the object, then
UFT uses assistive properties to identify the objects. A set of non-mandatory properties will be added to
the description one after the other until there is enough information to identify the object.
Ordinal Identifier: If the assistive properties also not enough to unique identification of an object, a special ordinal identifier is added by UFT, such as the object’s location or index or creation time of the page.
18. What is Creation time in Ordianal Identifier?
Answer: If UFT unable to identify the object by Mandatory and assistive properties, then it uses ordinal
identifier to identify the object.
The Web Browser object has a third ordinal identifier type Creation Time, Indicates the order in which the browser was opened relative to other open browsers.
19. What is Index in Ordinal Identifier?
Answer: Index: Indicates the order in which the object appears in the application/page relative to other objects. UFT will assign a value to index property of an object. The value is based on the order in which
the object appears within the source code. For ex index=0, index=1 etc
20. What is smart Identification?
Answer: If UFT unable to find the object or multiple objects found with the stored object description, then UFT ignores the recognized description and uses the Smart Identification mechanism to recognize
the object.
The Smart Identification mechanism uses two types of properties:
Base Filter Properties: most fundamental properties of a particular object
Optional Filter Properties: other properties of the objects which are unlikely to change
Tricky Questions in Basic section?
21. What is the extension of Shared and Local object Repository?
Answer: Shared object repository: .tsr
Local object repository: .mtr
22. What is the extension of Recovery and library file?
Answer: Recovery file: .qrs
Library file: .vbs, .qfl, .txt
23. What is the default way of passing the arguments in function?
Answer: In VB Script, there are 2 ways to pass arguments:
ByVal or ByRef. By default it will be ByRef.
24. What is the default way of passing the arguments in Actions?
Answer: In Action arguments are passed byVal only
25. What is difference between Action and Function?
Answer:
26. Can you write the code for Factorial?
Answer:
Function Factorial(n)
F=1
For i=1 to n
f=f*i
Next
Factorial=f
End Function
Msgbox Factorial(4)
Intermediate Complex Questions
27. What is Descriptive programming? Types of Descriptive programming?
Answer: Descriptive programming is used when we perform operation without using object repository.Two types of Descriptive programming
· Static DP
· Dynamic DP
Static DP: Properties and values are passed directly
Ex: Browser(“titile:=google”).page(“name:=google”).webbutton(“name:=Google Search”,”type:= Submit”).click
Dynamic DP : Properties and values are passed by creating description object
Set oDesc = Description.Create
oDesc(“type”).value= “text”
oDesc(“name”).value= “userName”
oDesc(“html tag”).value= “INPUT”
Browser(“Browser”).Page(“Page”).WebEdit(oDesc).Set "mercury"
When to use DP:
1.Using External Function Library
2.Huge Object Repository
3.When Application is Not Ready Yet
4.Object Repository in read only or shared mode
5.Several Identical Objects needing Same Operations
28. What is Dictionary Objects?
Answer: The Dictionary object is used to store information in name/value pairs.
Dim variablename
Set variablename = CreateObject("Scripting.Dictionary")
variablename.Add (key, item)
Example:
Dim obj_datadict ' Create a variable.
Set obj_datadict = CreateObject("Scripting.Dictionary")
obj_datadict.Add "a", "Apple"
obj_datadict.Add "b", "Banana"
obj_datadict.Add "c", "Carrot"
29. What is file system object?
Answer: FileSystemObject is used to create and manipulate the files and folders in the system.
Example: To access the existing file
'Creating Text File
CreateObject("Scripting.FileSystemObject").CreateTextFile(FileName)
'Read Text File
Set fso=CreateObject("scripting.filesystemobject")
Set fl=fso.OpenTextFile(FilePath,1)
'Reading Specified number of Characters
MsgBox fl.Read(5)
'Reading Complete Data from File
MsgBox fl.ReadAll
'Read Data Line by Line
While Not fl.AtEndOfStream
MsgBox fl.ReadLine
Wend
30. What is Error Handling? Types of Error Handling?
Answer: When executing scripts we may get some errors, to continue running script from these errors we use error handling.
Types of Error Handling
· Recovery Scenario
· On Error Resume Next
· Exist method.
· Err Object Method and Properties.
31. What is Recovery Scenario?
Answer: Recovery Scenario is used to handle the unexpected or unpredictable errors.Using Recovery Scenarios you can instruct QTP to recover from unexpected events and errors that occur during a run session.
32. What all are the steps involve in Recovery scenario?
Answer: Four steps are invoved in Recovery Scenarios
1. Trigger Event:- The event that interrupts your run session. For example, a window that may pop up on screen, or a QTP run error.
2. Recovery Operations:- The operations to perform to enable QTP to continue running the test after the trigger event interrupts the run session. For example, clicking an OK button in a pop-up window, or restarting Microsoft Windows.
3. Post-Recovery Test Run Option:- The instructions on how QTP should proceed after the recovery operations have been performed, and from which point in the test QTP should continue, if at all. For example, you may want to restart a test from the beginning, or skip a step entirely and continue with the next step in the test.
4. Description about the recovery scneraio:- In this step you need to enter the description about the recovery scenario
33. What is Virtual Object?
Answer: Virtual object enable you to create and run tests on objects that are not normally recognized by QuickTest/UFT. You can define these objects as virtual objects and map them to standard classes, such as a button or a check box. QuickTest/UFT emulates the user's action on the virtual object during the run session. In the test results, the virtual object is displayed as though it is a standard class object.
Tricky Questions in Intermediate section?
34. What is the disadvantage of Descriptive Programming?
Answer:1) Maintenance: Since Object repository centrally managed, one place to change the properties of the objects
2) Required skilled resource.
36. What is the difference between Recovery Scenario and Error Handling?
Answer: Recovery scenarios are used to handle the interfacing application where you cannot predict the errors like popups etc.
Error Handling is used the handle the source code i.e. to instruct the QTP/UFT not to through the code related errors.
37. When to use Recovery Scenario and Error Handling?
Answer: Recovery scenarios used to handle the unexpected events where as Error handling is used to handle the source code errors.
38. What is the difference between Absolute and Relative Path?
Answer: Absolute path means fixed location path of the file, need to mention full path in script.
Ex: C:\QTP\Automation\Framework\Libraries\QTP_VBS.txt
Relative path means relative to the current working directory, no need to specify the full the path
Ex: \..\..\Framework\Libraries\QTP_VBS.txt
39. Write a program to reverse the string without using strReverse function?
Answer:
Using Mid Function:
Public Function strReverse()
MyText=”UFT”
For i=0 to Len(MyText)
strRev= Mid(MyText,i,1)& strRev
Next
strReverse= strRev
End Function
Using Array:
Public Function fnReverse(sRev)
'Using Split function
arr = split(sRev, " ")
For i = Ubound(arr) to 0 Step -1
sNew = sNew & " " &arr(i)
Next
fnReverse = sNew
End Function
39. Can you write the code to find the Prime Number?
Answer:
temp = 29
bFlag = True
For i=2 to temp-1
temp1 = temp Mod i
If temp1 =0 Then
bFlag = False
Exit for
End If
Next
If bFlag Then
msgbox "Prime"
Else
msgbox "Not Prime"
End If
40. Write the code to find the vowel character in the string?
Answer:
For i = 1 To Len(word)
sChar = Lcase(Mid(word, i, 1))
If sChar = "a" Or sChar = "e" Or sChar = "i" Or sChar = "o" Or sChar = "u" Then
iCnt = iCnt + 1
End If
Next
MsgBox "No. Of vowels:" & iCnt
Complex Questions?
41. What is Framework? What all are the types of Framework in UFT?
Answer: A Framework defines a set of guidelines that enforces a set of standards which makes it easy to use for the end users to work with. A set of guidelines like coding standards , test-data handling , object repository.
Answer:
43. What is Keyword driven Framework?
Answer: Keyword Driven Framework is a type of QTP Framework where for a particular test case, you would first identify a set of Keywords and then associate an action (or function) which each of these keywords.For Example: 1) Login to Application
2) Check home page
3) Logout
44. What is Data driven Framework?
Answer: Data Driven Framework is a framework which is driven by the different combinations of input and output data.
The basic expectation with this kind of test automation framework is that your test scripts should be built in such a way that it should work for different sets of data without any changes to the test script.
45. What is Hybrid Framework?
Answer: A hybrid framework is a framework that is created by combining together the features of the different types of QTP frameworks.”
Answer:
Function Factorial(n)
F=1
For i=1 to n
f=f*i
Next
Factorial=f
End Function
Msgbox Factorial(4)
Intermediate Complex Questions
27. What is Descriptive programming? Types of Descriptive programming?
Answer: Descriptive programming is used when we perform operation without using object repository.Two types of Descriptive programming
· Static DP
· Dynamic DP
Static DP: Properties and values are passed directly
Ex: Browser(“titile:=google”).page(“name:=google”).webbutton(“name:=Google Search”,”type:= Submit”).click
Dynamic DP : Properties and values are passed by creating description object
Set oDesc = Description.Create
oDesc(“type”).value= “text”
oDesc(“name”).value= “userName”
oDesc(“html tag”).value= “INPUT”
Browser(“Browser”).Page(“Page”).WebEdit(oDesc).Set "mercury"
When to use DP:
1.Using External Function Library
2.Huge Object Repository
3.When Application is Not Ready Yet
4.Object Repository in read only or shared mode
5.Several Identical Objects needing Same Operations
28. What is Dictionary Objects?
Answer: The Dictionary object is used to store information in name/value pairs.
Dim variablename
Set variablename = CreateObject("Scripting.Dictionary")
variablename.Add (key, item)
Example:
Dim obj_datadict ' Create a variable.
Set obj_datadict = CreateObject("Scripting.Dictionary")
obj_datadict.Add "a", "Apple"
obj_datadict.Add "b", "Banana"
obj_datadict.Add "c", "Carrot"
29. What is file system object?
Answer: FileSystemObject is used to create and manipulate the files and folders in the system.
Example: To access the existing file
'Creating Text File
CreateObject("Scripting.FileSystemObject").CreateTextFile(FileName)
'Read Text File
Set fso=CreateObject("scripting.filesystemobject")
Set fl=fso.OpenTextFile(FilePath,1)
'Reading Specified number of Characters
MsgBox fl.Read(5)
'Reading Complete Data from File
MsgBox fl.ReadAll
'Read Data Line by Line
While Not fl.AtEndOfStream
MsgBox fl.ReadLine
Wend
30. What is Error Handling? Types of Error Handling?
Answer: When executing scripts we may get some errors, to continue running script from these errors we use error handling.
Types of Error Handling
· Recovery Scenario
· On Error Resume Next
· Exist method.
· Err Object Method and Properties.
31. What is Recovery Scenario?
Answer: Recovery Scenario is used to handle the unexpected or unpredictable errors.Using Recovery Scenarios you can instruct QTP to recover from unexpected events and errors that occur during a run session.
32. What all are the steps involve in Recovery scenario?
Answer: Four steps are invoved in Recovery Scenarios
1. Trigger Event:- The event that interrupts your run session. For example, a window that may pop up on screen, or a QTP run error.
2. Recovery Operations:- The operations to perform to enable QTP to continue running the test after the trigger event interrupts the run session. For example, clicking an OK button in a pop-up window, or restarting Microsoft Windows.
3. Post-Recovery Test Run Option:- The instructions on how QTP should proceed after the recovery operations have been performed, and from which point in the test QTP should continue, if at all. For example, you may want to restart a test from the beginning, or skip a step entirely and continue with the next step in the test.
4. Description about the recovery scneraio:- In this step you need to enter the description about the recovery scenario
33. What is Virtual Object?
Answer: Virtual object enable you to create and run tests on objects that are not normally recognized by QuickTest/UFT. You can define these objects as virtual objects and map them to standard classes, such as a button or a check box. QuickTest/UFT emulates the user's action on the virtual object during the run session. In the test results, the virtual object is displayed as though it is a standard class object.
Tricky Questions in Intermediate section?
34. What is the disadvantage of Descriptive Programming?
Answer:1) Maintenance: Since Object repository centrally managed, one place to change the properties of the objects
2) Required skilled resource.
36. What is the difference between Recovery Scenario and Error Handling?
Answer: Recovery scenarios are used to handle the interfacing application where you cannot predict the errors like popups etc.
Error Handling is used the handle the source code i.e. to instruct the QTP/UFT not to through the code related errors.
37. When to use Recovery Scenario and Error Handling?
Answer: Recovery scenarios used to handle the unexpected events where as Error handling is used to handle the source code errors.
38. What is the difference between Absolute and Relative Path?
Answer: Absolute path means fixed location path of the file, need to mention full path in script.
Ex: C:\QTP\Automation\Framework\Libraries\QTP_VBS.txt
Relative path means relative to the current working directory, no need to specify the full the path
Ex: \..\..\Framework\Libraries\QTP_VBS.txt
39. Write a program to reverse the string without using strReverse function?
Answer:
Using Mid Function:
Public Function strReverse()
MyText=”UFT”
For i=0 to Len(MyText)
strRev= Mid(MyText,i,1)& strRev
Next
strReverse= strRev
End Function
Using Array:
Public Function fnReverse(sRev)
'Using Split function
arr = split(sRev, " ")
For i = Ubound(arr) to 0 Step -1
sNew = sNew & " " &arr(i)
Next
fnReverse = sNew
End Function
39. Can you write the code to find the Prime Number?
Answer:
temp = 29
bFlag = True
For i=2 to temp-1
temp1 = temp Mod i
If temp1 =0 Then
bFlag = False
Exit for
End If
Next
If bFlag Then
msgbox "Prime"
Else
msgbox "Not Prime"
End If
40. Write the code to find the vowel character in the string?
Answer:
For i = 1 To Len(word)
sChar = Lcase(Mid(word, i, 1))
If sChar = "a" Or sChar = "e" Or sChar = "i" Or sChar = "o" Or sChar = "u" Then
iCnt = iCnt + 1
End If
Next
MsgBox "No. Of vowels:" & iCnt
Complex Questions?
41. What is Framework? What all are the types of Framework in UFT?
Answer: A Framework defines a set of guidelines that enforces a set of standards which makes it easy to use for the end users to work with. A set of guidelines like coding standards , test-data handling , object repository.
- Linear – Simplest form of creating a test. Just write a one single program without modularity in sequential steps
- Keyword driven – Create different keywords for different set of operations and in the main script we can just refer to these keywords.
- Data driven – To run same set of operations on multiple sets of data that are kept in separate files, mostly excel sheets.
- Hybrid – A combination framework that can be partly data driven and partly keyword driven
- BPT – This just means that programs are broken down into business components and are used with one or the other of the above types of frameworks
Answer:
43. What is Keyword driven Framework?
Answer: Keyword Driven Framework is a type of QTP Framework where for a particular test case, you would first identify a set of Keywords and then associate an action (or function) which each of these keywords.For Example: 1) Login to Application
2) Check home page
3) Logout
44. What is Data driven Framework?
Answer: Data Driven Framework is a framework which is driven by the different combinations of input and output data.
The basic expectation with this kind of test automation framework is that your test scripts should be built in such a way that it should work for different sets of data without any changes to the test script.
45. What is Hybrid Framework?
Answer: A hybrid framework is a framework that is created by combining together the features of the different types of QTP frameworks.”
46. Can you please write the code to extract the data from Microsoft Excel file and pass it into the test?
Answer: There are 2 ways to working with excel
1) Datatable
2) Excel object
1) Datatbale:
Datatable. AddSheet “Sheet1”
Datatable.ImportSheet “FilePath”,”Src sheet”,”Dest Sheet”
Answer: There are 2 ways to working with excel
1) Datatable
2) Excel object
1) Datatbale:
Datatable. AddSheet “Sheet1”
Datatable.ImportSheet “FilePath”,”Src sheet”,”Dest Sheet”
Click to set custom HTML
Userid | Password | Address |
---|---|---|
UFT1 | UFT1 | Address1 |
UFT1 | UFT1 | Address2 |
UFT1 | UFT1 | Address3 |
UFT1 | UFT1 | Address4 |
Browser(“Google”).Page(“Google”).WebEdit(“UserName”). Set Datatable(“UserName”,”Sheet1”)
2) Excel Objects
Dim oExcel, oWB, oSheet, getVal
Set oExcel=CreateObject("Excel.Application")
Set oWB=oExcel.Workbooks.Open("C:\Test.xls")
Set oSheet=oWB.WorkSheets("Sheet1")
oExcel.Visible=TRUE
getVal=oSheet.Cells(1,1).Value
oWB.Close
Set oExcel=Nothing
Browser(“Google”).Page(“Google”).WebEdit(“UserName”).Set getVal
47. What is Automation Object Model?
Answer: Automation object model is a set of objects, methods, and properties that helps testers to control the configuration settings and execute the scripts using the QTP/UFT interface.Dim qtApp
Dim qtTest
'Create the QTP Application object
Set qtApp = CreateObject("QuickTest.Application")
'If QTP is notopen then open it
If qtApp.launched <> True then
qtApp.Launch
End If
'Make the QuickTest application visible
qtApp.Visible = True
'Set QuickTest run options
'Instruct QuickTest to perform next step when error occurs
qtApp.Options.Run.ImageCaptureForTestResults = "OnError"
qtApp.Options.Run.RunMode = "Fast"
qtApp.Options.Run.ViewResults = False
48. What is Document Object Model?
Answer: Quickest provides direct access to the Internet Explorer's Document Object Model (DOM) through which you can access the HTML tags directly. Access to the DOM is performed using the .Object notation. With DOM, QTP can access the Source of a Webpage.
Set objUserNameTextBox = Browser("title:=Gmail: Email from Google").Page("title:=Gmail: Email from Google").RunScript("document.getElementById('Email');")
objUserNameTextBox.value = "myname" 'Uses value property to set the contents of Text Box
49. What is Xpath?
Answer: X path is one of the way to identify the object in QTP/UFT.
XPath is used for locating nodes in an XML document and it can also be used for locating HTML elements in XHTML.
Tricky Questions in Complex section?
50. What is the meaning of Keyword in Keyword driven Framework?
Answer: Keyword driven framework is a type of framework where keywords are used to perform set of actions like Login, Check mail, Logout.
Basic idea to use Keyword is to achieve reusability, modularity and readability.
51. In a webtable at only one cell there is a number of link, can you please write the code to find the number of link in the cell, thereafter find the name of each link?
Answer:
Set link_count= Browser("name:=Google").Page("title:=Google").Webtable ("name:=userdetails").ChildItemCount (intRow,intCol,"Link")
msgbox link_count
Set objDesc=Description.Create
objDesc("micclass").value= "Link"
For i=0 to link_col.count
set objChild=Browser("name:=Google").Page(“name:=Google").Webtable ("name:=userdetails").ChildObjects(objDesc)
msgbox objChild(i).GetROProperty("name")
Next
2) Excel Objects
Dim oExcel, oWB, oSheet, getVal
Set oExcel=CreateObject("Excel.Application")
Set oWB=oExcel.Workbooks.Open("C:\Test.xls")
Set oSheet=oWB.WorkSheets("Sheet1")
oExcel.Visible=TRUE
getVal=oSheet.Cells(1,1).Value
oWB.Close
Set oExcel=Nothing
Browser(“Google”).Page(“Google”).WebEdit(“UserName”).Set getVal
47. What is Automation Object Model?
Answer: Automation object model is a set of objects, methods, and properties that helps testers to control the configuration settings and execute the scripts using the QTP/UFT interface.Dim qtApp
Dim qtTest
'Create the QTP Application object
Set qtApp = CreateObject("QuickTest.Application")
'If QTP is notopen then open it
If qtApp.launched <> True then
qtApp.Launch
End If
'Make the QuickTest application visible
qtApp.Visible = True
'Set QuickTest run options
'Instruct QuickTest to perform next step when error occurs
qtApp.Options.Run.ImageCaptureForTestResults = "OnError"
qtApp.Options.Run.RunMode = "Fast"
qtApp.Options.Run.ViewResults = False
48. What is Document Object Model?
Answer: Quickest provides direct access to the Internet Explorer's Document Object Model (DOM) through which you can access the HTML tags directly. Access to the DOM is performed using the .Object notation. With DOM, QTP can access the Source of a Webpage.
Set objUserNameTextBox = Browser("title:=Gmail: Email from Google").Page("title:=Gmail: Email from Google").RunScript("document.getElementById('Email');")
objUserNameTextBox.value = "myname" 'Uses value property to set the contents of Text Box
49. What is Xpath?
Answer: X path is one of the way to identify the object in QTP/UFT.
XPath is used for locating nodes in an XML document and it can also be used for locating HTML elements in XHTML.
Tricky Questions in Complex section?
50. What is the meaning of Keyword in Keyword driven Framework?
Answer: Keyword driven framework is a type of framework where keywords are used to perform set of actions like Login, Check mail, Logout.
Basic idea to use Keyword is to achieve reusability, modularity and readability.
51. In a webtable at only one cell there is a number of link, can you please write the code to find the number of link in the cell, thereafter find the name of each link?
Answer:
Set link_count= Browser("name:=Google").Page("title:=Google").Webtable ("name:=userdetails").ChildItemCount (intRow,intCol,"Link")
msgbox link_count
Set objDesc=Description.Create
objDesc("micclass").value= "Link"
For i=0 to link_col.count
set objChild=Browser("name:=Google").Page(“name:=Google").Webtable ("name:=userdetails").ChildObjects(objDesc)
msgbox objChild(i).GetROProperty("name")
Next