Interview Questions And Answers for QTP/UFT
Guys going for Interview and don't have time to Prepare then your in
right place . Crack your Interview with Below Questions and Answers
Q. Object Spy
& what is the use ?
A. Object spy
is used to identify the object type and details along with its hierarchy and methods/properties of that hierarchy.
Q. Explain
Actions and its type
A. Actions:
Actions helps testers to divide scripts into groups of QTP statements
called actions. Actions are similar to
functions in VBScript, however there are few differences. By Default QTP
creates a test with 1 action.
Types of Actions:
There are three types of actions:
Non-reusable action - An action that can be called only in that specific
test in which it has been designed and can be
called only once
Reusable action - An action that can be called multiple times any test in
which it resides and can also be used by any
other tests
External Reusable action - It is a reusable action stored in
another test. External actions are read- only in the
calling test, but it can be used locally with the editable copy of the Data
Table information for the external action
Q. Difference
between For Each and For Loop
A. For loop & For Each loop with Examples
For loop:-
We can use this loop to run a block of code specified number of times.
Syntax:- for i=1 to n
====è loop runs n times.
Next
For Each loop:-
We can use this loop to execute a block of code for each item in given
list.
Syntax:- for each
i in list/array
====è loop runs for all the list/array items times.
Next
Q. Code:
Fetch the particular text from a application and write into Excel sheet
A. After
Getting the required text from Application as a variable , create an excel
using Createobject and enter the value into the excel
Q. Explain
about " On Error Resume Next" and what is the use ?
A. '"On Error
Resume Next" is used to handle errors in vbscript/QTP
Using On Error Statement - On Error statement is used to notify the
VBScript engine of intentions to handle the run-time errors by tester, rather
than allowing the VBScript engine to display error messages that are not user friendly.
On Error Resume Next - On Error Resume Next informs the VBScript engine
to process executing the next line of code when an error is encountered.
On error Goto 0 - This helps the testers to turn off the error handling.
Q. How to
close specific browser in QTP?
A. Provide
the title condition and then .Close it
Use creation time or Browser("").Close
Q. How to get
multiple return values from a function ?
A. Using By
Refferance we can get the multiple values from a function
Q. Explain
Virtual Objects.
A. When QTP
is unable to identify objects then we create virtual objects
Q. Do we need
any separate add-ins for Firefox ?
A. No required.
QTP 10 supports till FF3.0 If you want to execute the scripts over FF3.6, HP launched
the patch HP000059, If you install that patch, you can execute your scripts
over FF3.6 as well.
Q. What are
the challenges faced in Silverlight Automation ?
A. In Silverlight
automation, each day was a learning point to me as we used to do so many work a rounds to solve the issues like: Object
identification issues . While adding object to the OR, application and QTP both will be closed at a
time .Synchronization Issues .There won't be any object in the application to wait dynamically,
application will be blank some times before navigating to the next page.Handling toggle buttons was another
challenge (we were not able to select the data in
SlvTogglebutton. Finally we have used Send keys approach in order to select the item in toggle buttons) We used to contact HP support and
get the patches to be installed to QTP in order to resolve
the issues that are coming up.
Q. Recovery
scenario (how and when do you call recovery scenario)
A. Using Recovery
Scenarios you can instruct QTP to recover from unexpected events and errors
that occur in your testing environment during a run
session.
Recovery scenario become crucial for large tests, which run unattended
and are paused until recovery operation, is performed increasing the test execution time.
There are 6 steps involved in creating a recovery scenario
Step 1) In QTP , Select Resources > Recovery Scenario Manager .Create
new Scenario
Step 2) Specify the Trigger Event. A Trigger Event is an event that
interrupts your run ses sion
Step 3) Specify the Recovery Operation which is the corrective
action you take when trigger happens
Step 4) Specify Post-recovery test run options which specify how to
continue the run session after Quick Test Professional has identified the event and
performed all of the specified recovery operations.
Step 5) Check and verify Summary of the scenario you created.
Step 6) Add Recovery Scenario to your test using File > Settings
> Recovery. The test results window show the details of the
recovery scenario
Q. If
multiple windows are open with same name, how will you close only one specified
window
A. Using
ordinal identifier-Index
Q. File Types
in QTP (File Extensions)
A.
.tsr---Test script repository(used in Repository)
.VBS--Visual Basic Script(Associate Libraries)
.QFL--QuickTestFille(Associate Libraries)
.qrs--Recovery scenario(quicktest recovery )
.VOT--Virtual Object
Q. Diffence
b/w QTP from other automation tools.
A. QTP is
supports with VB and Vb is very user friendly during the development and
execution and QTP can with multiple environments
and multiple technologies when compared to other tools.
Q. How do you
give the file path if file uploading is doing through AutoIT ?
A. The path
must be specified in the AutoIT VBScript
Q. There is a
string something like "Learning Fish QTP Tutorials". Place the words
in the string , with an even
and odd positioned strings swapped like "Fish Learning Tutorials
QTP"
A. StringSstr
= "Learning Fish QTP Tutorials"
strSplit = Split(StringSstr,"")
Use for loop to fetch value and place in variable
msgbox strSplit(i)
Q. What is error
handling in VB Script?
A. On Error
Resume Next
Q. Explain
Regular Expression with Examples.
A. Regular
expressions is used for identifying objects and text strings with varying
values, handling dynamic objects, parameterizing,
checkpoints with varying values.
Q. How do you
run scripts in QC into 5 different Remote machines.
A. Place all of the scripts into 1 testset, create a host
group and add all the test machines to the host group (use the Host Manager in Test Lab/Test Sets menu), assign the host group
to each of the tests in the testset using the Planned Host column
then run the testset.
Q. Recovery Scenarios, how to add and maintain recovery scenarios
A. A recovery scenario consists of the following which can be
added from Resources ? Recovery Scenario Manager a. Trigger Event. The event that interrupts your run
session. For example, a window that
may pop up on screen, or a QTP run error. b. 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. c. 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.
Q. Logic for printing 1 1 2 3 5 8 13 .... febonacci Series
A. Dim a, b, c, f1, f2, n
n = Cint (inputbox (" Enter the Number"))
a = 1
b = 1
c = 0
d = 0
f1 = a&","&b
do while (c <= n)
c = a + b
if ( c > n ) then
exit do
end if
f2 = f2&c&","
a = b
b = c
loop
msgbox d&","&f1&","&f2
Q. Suppose if an element is used in 1000's of test cases and
if that object changes how are you going to handle
it. ie how r u implementing the changes
A. By creating a user defined function with DP.
Q. Explain Virtual Objects.
A. A virtual object is defined by user in QuickTest to
recognize any area of your application as an object. Virtual objects enable you to record and run tests on objects
that are not normally recognized by QuickTest.
Q. What is virtual Object Collection ?
A. virtual object collection is a group of virtual objects that is stored in the Virtual Object Manager under a descriptive name.
How to disable virtual Objects while
recording?
Go to Tools-->Options--> General
Tab--> Disable Recognition of virtual objects while recording
Check and uncheck this option to disable or
enable virtual objects while recording.
What is the storage location of Virtual
Objects?
If you create any virtual objects automatically
those objects will be stored in
QuickTest installation folder\ dat \ VoTemplate
What is extension of virtual objects file?
.VOT
How to use virtual objects on different machines?
After creation of virtual objects copy QuickTest
installation folder\ dat \ VoTemplate Folder to other machines on which you want to use virtual objects.
What are the limitations and drawbacks of Virtual
Objects?
· QuickTest
does not support virtual objects for analog or low-level recording.
· Not
possible to apply a checkpoint on a virtual object
· Only by
recording we can add virtual objects
· Not
possible to add virtual objects using Object Repository
· Not possible
to spy on a virtual object using object spy
· Virtual
Objects doesn’t support all objects and methods.
· May not
run perfectly on different screen resolutions if a test using Virtual Objects.
· Virtual object
uses the properties Name, Height, Width, X, Y which the properties are having maximum possibilities for frequent change.
Q. Explain Regular Expression with Examples.
A. Regular Expression's(RG's)
It is a way of representing data using
symbols, which are in the form of special characters like ‘*’,’ +’, ’.’, ’\’.
Further these characters are used for search
of particular pattern in strings.
RG’s in UFT:
These are used in UFT to identify objects and
text strings with varying values very useful in dynamic objects.
Usage:
1. Defining Properties of an Object.
(Object Repository)
2. Pattern matching in Check points.
3. Parameterize an object property or
check point
Test:
We can test pattern match using
“Regular Expression Evaluator”
Tools>Regular Expression Evaluator.
Q. Explain MID function with syntax.
A. The Mid function returns a specified number of characters
from a string.
Tip: Use the Len function to determine the
number of characters in a string.
Syntax
Mid(string,start[,length])
Parameter Description
string Required: The string expression from which
characters are returned
start Required: Specifies the starting position. If
set to greater than the number of characters in string, it returns an empty string ("")
length Optional: The number of characters to return
Q. Differance between keyword and data driven framework
A. Data-Driven
Testing Framework:
In data-driven testing the input and output
values for the test are fetched from data files. These data files can be Excel files, CVS files, ADO objects, DAO
objects or any ODBC source etc. Subsequently these get loaded into various variables in scripts which
might be either manually created or
can be captured ones.
Keyword-Driven Testing Framework:
In keyword driven framework we need to create
a set of keywords & data tables, which are not dependent either on the test automation tool being used by us or on the
test scripts driving the data &
the application under test.
Keyword-driven tests have large resemblance
with manual test cases.
Q. Why do you require a Framework ?
A. A Framework defines a set of guidelines/best practices
that enforces a set of standards which makes it easy to use for the end users to work with. With all
these guidelines/best practices the maintenance is very less.
Q. How do you identify objects using Regular expressions
A. Different expression need to take for different objects to
identify.
Regular expressions is used for identifying
objects and text strings with varying values, handling dynamic objects, parameterizing, checkpoints with varying values. There are
many ways of using regular expression:
a. backslash (\) character
b. Matching Any Single Character
c. Matching Any Single Character in a List
"."
d. Matching Any Single Character Not in a List
"^"
e. Matching Any Single Character within a
Range"[]"
f. Matching Zero or More Specific Characters
"*"
g. Matching One or More Specific Characters
"+"
h. Matching Zero or One Specific Character
"?"
i. Grouping Regular Expressions "()"
j. Matching One of Several Regular Expressions
"|"
k. Matching Any AlphaNumeric Character Including the
Underscore "\w"
l. Matching Any Non-AlphaNumeric Character
"\W"
m. Combining Regular Expression Operators ".*"
--> commonly used in OR
Q. Explain the Framework you followed in Automation.
A. Hybrid framework. The test data is maintained in Excel
sheets and properties files.Maintenance is very less when
compared to other frameworks.
Q. When do u use Actions and Functions. What are its
difference?
A. Difference between Action and Function?
♦ Action is a collection of Vb statements in
QTP. It does not return any values.Function collection of
Vb statements in QTP.
It returns single value.
♦ We can call functions within actions but we
can't call actions within functions
♦ Generally functions are saved with
".vbs" extention where as actions will save with ".mts".
♦ Every Action will have its own Datatable
where as function does not.
♦ Action can have a object repository
associated with it while a function can't. A function is just lines of code with
some/none parameters and a single return value
while an action can have more than one output parameters.
♦ Action can contains Object Repository, Data
table, Active screen etc. whereas function do not have these features.
♦ Action is internal to QTP whereas Function is
just lines of code with some/none parameters and a single return value.
♦ Action can/can not be resuable whereas
functions are always reusable.
♦ Action Parameter have default values whereas
VB script function do not have any default values.
♦ Action parameter type are byvalue only where
vbscript functions can be passed byref.
♦ Action can have multiple output(returning)
values whereas function can return only single value.
Q. How do u run scripts in QC into 5 different Remote machines.
A. Place all of the scripts into 1 testset, create a host
group and add all the test machines to the host group (use the Host Manager in Test Lab/Test Sets menu), assign the host group
to each of the tests in the testset using the Planned Host column
then run the testset.
Q. Is it possible to run a script from QC to a remote
machine, if that machine doesn't have QTP installed in it.
A. Not Possible.
Q. How do u return a value to a function.
A. Inside the user define function
after getting the required value with to a
variable,need to assign the variable value to the function name
Q. On web page there is a text " wells fargo 2014
Privacy Rules" i) Need to verify year 2014 is available in text and validate correct year is
displaying or not ii) script should run without any errors when year changes to 2015..2016 so on..
A. By using Regular expression at the Year
Q. Write a code to click on save button ? Assume 2 save
buttons are available on page
A. For more than two buttons qtp will take index/location to
identify the required button to perform the
operation
Q. How can we open a file(abc.txt) from QTP? today file is on
desktop...tomorrow move to another location how can
we handle this ?
A. 1.By keeping the file in QC attachments and download to the
local by using OTA.
2.By keeping the file in Shared path(relative
path is used to fetch the file )
Q. What is data driven framework?
A. As the name suggests, Data Driven Testing Framework is a
framework which is driven by test data, which means that test data is the important factor here. 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.
Q. Have you integrate the scripts with ALM tool?
A. Yes. Answer the how we will connect ALM
Q. What are the resource files that you need for a project ?
A. 1.Data Files
2.Library Files
3.Recovery Files
4.Config Files
Q. How to run the scripts from QC ?
A. After selecting the required tests from test set set and
click on Run button.
Q. What are Ordinal Identifiers and explain ?
A. 1.Index
2.Location
3.Creation Time---(Web Based applications)
Q. I want use data (Present in Excel sheet) in my script...
Without adding any datatable How?
A. By Creating a excel object using CreateObject and fetch
the value from the required sheet and required cell.
Q. Explain MID function with syntax.
A. The Mid function returns a specified number of characters
from a string.
Q. Why do you require a Framework.
A. A Framework defines a set of guidelines/best practices
that enforces a set of standards which makes it easy to use for the end users to work with.
Q. File Types in QTP (File Extensions)
A. QTP Script File .mts
Q. How do u identify objects using Regular expressions
A. Regular expressions enable QuickTest to identify objects
Q. Explain the Framework you followed in Automation.
A. Customized Framework which is the combination of Data
driven and keyword driven framework.
If you have any explain that framework
Q. Explain Actions and its type
A. Actions is a set of logical statements to perform specific
test.
Q. When do u use Actions and Functions. What are its
difference.
A. Action is a collection of Vb statements in QTP. It does not
return any values.Function collection of Vb statements in
QTP.
Q. Is it possible to run a script from QC to a remote
machine, if that machine doesn't have QTP installed in it.
A. No. QTP should be installed in other machine as well.
Q. How do u return a value to a function.
A. In the function definition you assign the value to
function name
Q. How is the QTP end result has been designed in your
previous project.
A. Using HTML
Q. Difference between Substring and instr
A. 1.There is no substring function avilable in VB
2.instr - searches for a substring in a given
string and returns the position where the match is found.
Q. Difference between QTP & RFT?
A. QTP - started by Mercury and taken over by HP RFT -
started by Rational and taken over by IBM QTP has only one
platform to develop scripts only in VBScript RFT has two platforms - Visual Studio and Eclipse to develop scripts in VB
and Java respectively. QTP - Object Identification differs with RFT, in RFT object identification is on OOPS concept.
QTP uses lite weight scripting language. RFT uses powerful
language Java. QTP has more inbuilt functionalities to overcome runtime issues, in RFT we has to use more
programming to resolve some runtime issues. RFT doesn't have Actions concept which is very useful feature available in
QTP. QTP has descriptive programming feature.
difficult to develop program in RFT. many differences between them. I prefer
QTP to automate which is very userfriendly. QTP 11 has more advantages
and beautiful features which are not available in
RFT.
Q. Difference between an error resume next & recovery scenario?
A. "On Error Resume Next" is used when you are sure
about the step where the error can occur.Whereas, Recovery
Scenario can be used to handle unexpected event or error.
Q. How to get data from dynamic tables in QTP ?
A. By getting the data table name in to a variable and use
the variable to fetch the data.
Q. How to close all open browsers at a time in QTP?
A. While Browser("creationtime:=0").Exist(0) 'Close
the browser Browser("creationtime:=0").Close
Wend
Wend
Q. Explain real time example for recovery scenario.
A. Unexpected popups - Unexpected ads coming up - Printer out
of paper errors - Some run time errors that may come
Q. Do you need to have extra add-ins for automating
Silverlight application? If Yes, what are the add-in?
A. Yes, we need to have Silverlight and WPF add-ins along
with the QTP default add-ins.
Q. If we give you an application do you for automation, how
will you start with you automation? What is the approach/Process you follow?
A. First we need to check the test cases availability. If we have
test cases ready, analyze them and identify the automation candidates. Check the application environment it
is developed, whether it needs any other extra add
ins to be installed to QTP along with the default ones. Create a folder structure for Data Tables/Database, Recovery
Scenarios, Object Repository, Test Scripts, Driver Script,
Results, Error Handlers. Based on the complexity/type of objects in the
application, decide whether we need to go for descriptive
programming or OR. Write the Excel related/Data base related, error handling, generic, recovery scenario,
application navigation, utility functions in
order to develop automated test scripts. Develop the automation
test scripts with the help of above functions and process
Q. What is a framework? What are the advantages of having a
framework?
A. Framework is a set of guidelines or rules that is
developed and which will be useful to create and maintain automation scripting process in a well defined way. Framework
acts as a centralized system
for maintaining all QTP components like OR, data table, utility functions , supporting functions, exception handlers,
recovery scenarios, Results all together in a place.
Q. What does a framework contain?
A. A framework contains the below folder structure. Function
Libraries ,Object Repository, Data Tables, Exception handlers, Recovery scenarios And Results
Q. 100 lines of code is there, 25th line has a value
calculation, 40th line is displaying a value. How code logic issue is to be resolved if the 40th line is not displaying a
right value
(debug logic error)?
A. After inserting a break point at the 25th line
execute the script in debug mode take all the required variables into watch.
Q. What is OR? Different types? Why we need OR?
A. Object Repository acts like a centralized system to
maintain all the objects along with their properties. (This will happen when you record or add
an object to OR) . In earlier versions of QTP (Ex: QTP8.0), we had Shared and Local repository. But in the
latest versions of QTP we have
a single repository which will be a shared OR by default. We need OR to
identify a particular object by using its properties that are captures in the object
repository.
Q. What is smart identification?
A. Generally QTP will recognize an object by using the
objects mandatory properties. But if the application contains same type of objects with same properties we
can add few other properties to Assistive Properties in
order to identify that particular object. Sometimes even if doesn't work then we can go for Index or
Location (Ordinal Identifiers). ? Even if ordinal identifier doesnt work, then we can go for Smart identification
concept. It contains Base filters and optional filters. You can add object properties to either base or optional identifiers and if you enable smart identification for a particular object
then in case is there is any problem with identifying objects, it will enable smart identification by itself in
order to identify that particular object in the application
Q. What is Index and Location?(Ordinal identifiers) Explain
how and where will you use them?
A. Index and location are ordinal identifiers which will be
used to identify the particular object, with the
help of the object index or the location where it is placed. ? For example of
there are 3 links with the same name and same
properties that time we can use index. If the index is also same we can use Location where it is placed and we can try to
identify that particular object.
Q. There are 8 browsers open along with QC browser, except QC browser you have to close all other browsers at a time. Can you write the code for it?
A. If Not Br("QCBrowser").Exists Then
Br().Pg("title:=.Index:=BrCount).Close
End If
And finally he told me to use do loop for the entire code to iterate it for 8 times.
Q. There are many links displayed in a web application, get the count of the links?
A. Set Obj = Description.Createobject Obj.("micClass") = "Link"
Links = Br().Pg().ChildObjects(Obj) LinkCount = Br().Pg().Links.Count
Q. Have you worked on Descriptive Programming? When will you go for DP?
A. When the object properties changes In the application dynamically . When the application is very complex and the OR size is becoming very huge . Because of huge OR, lot of performance issues will occur. In this case also we can think about DP. Sometimes few clients will prefer to use DP in their projects/applications.
Q. There is a WebButton in a web based application, but when you add it to OR, it is identified as a WinButton. How will handle this situation in order to click on the WebButton?
A. Sometimes if you open the application before you launch QTP, the web application will be identified as win application. In this case you need to close the application and reopen it after the QTP is launched. Still if it identified as a win button, then we need do work around using either virtual objects concept or send keys concept
Q. There is a string which is a mixture of alphanumeric and special characters. Ex: 123a@b8. How will you separate each digit/alphabet/special character separately based on its type?
A. First we need to get the length of the string and iterate the text for the length times and use ASCII characters to get the each character type and store them separately.
Q. If object is not identified by QTP how do we proceed ?
A. 1. Descriptive Programming
2. Virtual Object
3. Send Keys method
Q. Environment Variables
A. QTP environment variables are special types of variables that can be accessed by all actions, function libraries and recovery Scenarios. There are inbuilt environment variables for Windows that are available to all the applications running on that particular system where as QTP environment variables are only available to that test script during run-time.
Types of Environment Variables
Built-In: These are the internal variables that are provided by QTP. Among others they can provide you valuable information like the path of the folder where test is located, the path of the results folder, the name of the action iteration or the OS version.
User-Defined: These can be further defined into two types.
•User defined Internal •These are the variables that we define within the test.
•These variables are saved with the test and are accessible only within the test in which they were defined.
•So how can we define and use them?
To define them: Environment.Value(“name”)= “Saleem”
To call them: msgbox Environment.Value(“name”)
•User defined External
•These are the variables that we predefine in the active external environment variables file.
•These can be created using a list of variable-value pairs in an external file in .xml format. This is a topic of a separate post that we will discuss later.
Q. How do we get relative path ?
A. Using environment variable TestDir and by using GetParentFolder
Q. How can we connect to excel files ?
A. 1. By importing an excel file
2. By creating an excel object using QTP scrpting
3. By making it as ADODB object and reading it as an database (I am not sure about this as this is used in RFT )
Q. How to identify the latest link among already existing links in a web page ? (ex: may be 3 instances of link have same name and set of properties)
A. 1. Using ordinal identifiers 2. smart identification
Q. How to get the cell text from webtable
A. Get the row count and loop thru for any row/col value
Q. How to validate dynamic text on web page
A. Pass the dynamic value thru variable
Q. How to click button/link in web table
A. Using child item property or based on index as well
Q. How do you decide framework for any given application(if 50% of functional flow has given)
A. Initially go for keyword-driven, if required customize it to hybrid
Q. If QTP result is showing as pass but action is not getting performed, then how do you resolve
A. Using synchronization.
Q. Smart Identification using ordinal identifier
A. Smart Identification:
•If the usual object identification process fails , QTP triggers Smart Identification , which is more flexible mechanism for identifying objects provided it is enabled in Object Identification settings.
•Smart Identification uses two categories of properties
1.Base Filter Properties. It contains the most fundamental properties of a particular test object class; those whose values cannot be changed without changing the essence of the original object
2.Optional Filter Properties. Other properties that can help identify objects
ordinal identifier:
Sometimes there are series of objects with same class name and properties. Lets us say in a window there are series of checkboxes with the same set of properties. If we want to act on those objects we need to uniquely identify them so that QTP will be able to act on it.
An Ordinal Identifier assigns a numerical value to the test objects which indicates its location or order relative to its group. The Ordered value enables QTP to recognize it uniquely when the inbuilt properties are NOT sufficient to do so.
There are 3 Ordinal Identifiers in QTP that can be used in different context:
Index
Location
Creation Time(Used for Web application)
Q. How do you import and export your DataSheets and Results
A. Import/export data sheets:
Import-Import all the sheets of the datatable
ImportSheet-Import a specific sheet to a specific location in side QTP.
Export-Export all the sheets which are present in QTP at the time of execution.
Exportsheet-Export a specific sheet from QTP to specific location.
Results -results can be exported in to HTML.
Q. To run a functional library we use Execute file
A. Executefile method is used to run the functions which are saved in .vbs file
If you want to call a functions for the private\single script or action, use executefile method.
here note that we are not associating library file/Functions (Library file is one which contains all the functions and saved in .vbs format) to the QTP.
Advantage :
No need to associate the library files to the QTP
Dis-Advantage :
The called function is always applicable to the that particular script or action only. In other word the called function will not be a global.
Syntax is :
ExecuteFile "path of the .vbs file"
1. What is the difference between Loadfunctionlibrary and Executefile?
a. ExecuteFile -It loads the libraray at run time but with no debugging support.
Loadfunctionlibrary – It also loads the library at runtime.Here debugging is possible at runtime
b. ExecuteFile- we can load only single libraray using call executefile statement for eg:”C:\func1.vbs”
Loadfunctionlibrary -But here we can load multiple function libraries using call loadfunctionlibrary for eg: “C:\func1.vbs”,”C:\func2.vbs”
Q. If multiple browsers are open with same name, how will you close only one specified browser.
A. Using ordinal identifier-Creation Time for browsers
Q. How is the QTP end result has been designed in your previous project.
A. QTP end results are stored in to QC/ALM.
Q. Which locator is best to identify an element on a web page?
A. First preference goes to Id or Name for an element if exists and can be uniquely identified through them. If not , then we should go for CSSSelector or Xpath. Cssselector is always preferable in obtaining fast performance. Xpath will be given a choice when there is complex locator to identify.
Q. How to increase the size of array dynamically?
A. By Using Redim with the array name
Q. Suppose say I write a generic function which has 4 parameters. For a particular scenario, how can I make one of the parameter as optional.
A. Need to create a function with three parameters and the fourth need o pass inside the same function with another function if the 4 exists.
Example:-
Function Func (Param1, Param2)
Result = NewWhatEver(Param1, Param2, "")
End Function
Function NewFunc (Param1, Param2, Param3)
'Code goes here
End Function
Q. What is AOM.
A. Automation Object Model:
QTP itself can be automated using the COM interface that is provided by Hp-QTP. 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 interface. The Key Configurations/actions that can be controlled are listed below but not limited to
Loads all the required add-ins for a test
Makes QTP visible while execution
Opens the Test using the specified location>
Associates Function Libraries
Specifies the Common Object Sync Time out
Start and End Iteration
Enable/Disable Smart Identification
On Error Settings
Data Table Path
Recovery Scenario Settings
Log Tracking Settings
Q. what is the benefit of DOM.
A. Document Object Model(DOM):
DOM is a method for QTP engineers to access the source (IE –> View –> Source) of any webpage direct through VB Scripting.
Q. There is a webcheckbox in a page which is being identified properly. When tried to click, it didnot select the checkbox but the step got executed successfully. What could be the problem
A. WebCheckbox need to be set ON(this will do click on the required object)
Q. How to retrieve multiple values thru function.
A. By assigning the values into an array.
Q. Explain about the classes in VB Script
A. Class is a template for a collection object's that share a common set of attributes & operations. The term, Class, refers to any object that you create using the Class ... End Class statement. This ability to create your own object and to perform operations upon it using any valid VBScript code, represents a significant expansion of the versatility of the VBScript language.
Q. Difference between Functions and Procedures
A. Function Returns a value where as a procedure do not return.
Q. How to Reverse the word 'Saleem' without using any function
A. Using Mid function we can reverse a
string str = "Saleem"
strLenth = Len(String)
For I = 0 to strLenth
String1 = Mid(str, strLenth, i)
ReverseString = String1&ReverseString
Next
Msgbox ReverseString
Q. Give the Regular expression for a page title as 'Sam 05/03/2012 2.53 PM' ( Do't use .* )
A. for Date: (0[1-9]|1[012])[//](0[1-9]|[12][0-9]|3[01])[//]200[0-9]) For Time: ([0-1][0-9]|2[0-3])[/:]([0-5][0-9])
Q. BPT
A. BPT stands for Business Process Testing, a built in QTP automation framework used in conjunction with the Quality Center. BPT helps indulge Business Analysts in the automation process. They can also design the automation scenarios and executed them as per their requirements without automatation/coding knowledge
BPT is a scenario consisting of a series of Business Components, designed to verify a particular Business process in the application under test.
The following are the building blocks of the BPT Framework
•Components
•Application Area
•Flows
•Business Process Test
Q. What are the different types of Data Tables available in QTP and explain the functionality
A. There are two types:
a. Global - The data can be stored in global tab when the data is made available in all actions performed in the test.
b. Action - The data can be stored in the action tab when the data is made available for that particular action in the test.
Q.How to get child objects?
A. We use child objects when we want to find count of similar objects in a page
Dim obj_ChkDesc
Set obj_ChkDesc = Description.Create
obj_ChkDesc("html tag").value = INPUT
obj_ChkDesc("type").value = checkbox
Dim allCheckboxes,
singleCheckBox Set allCheckboxes = Browse("Browser").Page(Page).ChildObjects(obj_ChkDesc)
For each singleCheckBox in allCheckboxes
singleCheckBox.Set ON
Next
Q. If an object changes in application how is it updated and how it is maintained
A. It depends on how the object identification is happened.
1.With Object recovery: Update from application button is avilable in OR
2.With Descriptive Programming:find the object changes by using spy and
update the property values.
Q. Using Object repositories, using descriptive programming which one you suggest for web applications.
A. There is no specific answer as to which of two is better. There are certain situations when using DP has its own benefits while some other places OR is good.
Q. What are the basic addins in QTP and also what is the use of addins in QTP.
A. Basic add-ins are: Web, ActiveX, Visual Basics. Additional add-ins are: Java, Oracle, SAP, .NET, Web Forms, Siebel, PeopleSoft, Web services, Main frame (Terminal Emulator). This add-in concept will help QTP to support wide-range of applications without compromising the performance. And, it will improve object identification reliability.
Q. Difference between Shared and local object repositories.
A. If the objects are stored in the local object repository they are available for particular action only. If the objects are stored in the shared object repository they are available for entire application. Shared object repository occupies less memory than the local object repository.
Q. Write code to count the occurrence of a particular text in a WebTable.
A. Set a=Browser("creationtime:=0").page("micclass:=page").WebTable(abc).ChildObjects
print a.count
Q. Write code to copy a WebTable values into a Excel sheet cell by cell
A. Set desc=Description.Create() desc("micclass").value="WebTable" desc("text").Value="200220032004Capital structure analysis.*"
Set WebEdits=Browser("Title:=Financial Analysis").Page("Title:=Financial Analysis").ChildObjects(desc) cCount=WebEdits(0).getROProperty("cols")
rCount=WebEdits(0).getROProperty("rows")
Set objExcel = CreateObject("Excel.Application") objExcel.
Visible = True
Set objWorkbook= objExcel.Workbooks.Open("C:\Documents and Settings\Administrator\Desktop\ForumExcel.xls")
Set objSheet=objExcel.Sheets("Sheet1")
For i=1 To rCount
For j=1 To cCount
data=WebEdits(0).GetCellData(i,j)
If (Instr(data,"analysis (%)") <> 0 OR Instr(data,"flow (%)") <> 0) Then objsheet.Cells(i,j).Value=data j=cCount else objsheet.Cells(i,j).Value=data
End If
Next
Next
objWorkbook.save
objWorkbook.close
objExcel.Quit
set objExcel=nothing
Q. How to connect to a database dynamically in QTP.
A. Function getConnection ()
On Error Resume Next
Dim oConnection,ConnectionString
ConnectionString ="Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight32.mdb;
User Id=admin;Password=;"
Set oConnection = CreateObject("ADODB.Connection")
oConnection.Open ConnectionString
Set getConnection = oConnection
End Function
Q. Write a generic function to search an option in a dropdown list.
A. Values = Browser(abc).Page(abc).WebList(xyz).GetROProperty("value")
Apply For loop and check till end of string.
Q. Write the code to decrease the default waiting time of qtp for web application from 60 seconds to 20 seconds.
A. We can use exist(2) or exist(x). And we dont have to wait for default waiting time.
Q.How to retrieve the text from one of the cells in Webtable?
A. Using the Childitem method, we pass row number, column number, QTP Class type, and index. But in JAVATable, we have the flexibility to pass the Column name directly instead of column no, so advantage is, we need not to bother if there is any hidden columns in the web table.
Q. What are the different objects can be recognized by JAVA Add-in in QTP?Q. Environment Variables
A. QTP environment variables are special types of variables that can be accessed by all actions, function libraries and recovery Scenarios. There are inbuilt environment variables for Windows that are available to all the applications running on that particular system where as QTP environment variables are only available to that test script during run-time.
Types of Environment Variables
Built-In: These are the internal variables that are provided by QTP. Among others they can provide you valuable information like the path of the folder where test is located, the path of the results folder, the name of the action iteration or the OS version.
User-Defined: These can be further defined into two types.
•User defined Internal •These are the variables that we define within the test.
•These variables are saved with the test and are accessible only within the test in which they were defined.
•So how can we define and use them?
To define them: Environment.Value(“name”)= “Saleem”
To call them: msgbox Environment.Value(“name”)
•User defined External
•These are the variables that we predefine in the active external environment variables file.
•These can be created using a list of variable-value pairs in an external file in .xml format. This is a topic of a separate post that we will discuss later.
Q. How do we get relative path ?
A. Using environment variable TestDir and by using GetParentFolder
Q. How can we connect to excel files ?
A. 1. By importing an excel file
2. By creating an excel object using QTP scrpting
3. By making it as ADODB object and reading it as an database (I am not sure about this as this is used in RFT )
Q. How to identify the latest link among already existing links in a web page ? (ex: may be 3 instances of link have same name and set of properties)
A. 1. Using ordinal identifiers 2. smart identification
Q. How to get the cell text from webtable
A. Get the row count and loop thru for any row/col value
Q. How to validate dynamic text on web page
A. Pass the dynamic value thru variable
Q. How to click button/link in web table
A. Using child item property or based on index as well
Q. How do you decide framework for any given application(if 50% of functional flow has given)
A. Initially go for keyword-driven, if required customize it to hybrid
Q. If QTP result is showing as pass but action is not getting performed, then how do you resolve
A. Using synchronization.
Q. Smart Identification using ordinal identifier
A. Smart Identification:
•If the usual object identification process fails , QTP triggers Smart Identification , which is more flexible mechanism for identifying objects provided it is enabled in Object Identification settings.
•Smart Identification uses two categories of properties
1.Base Filter Properties. It contains the most fundamental properties of a particular test object class; those whose values cannot be changed without changing the essence of the original object
2.Optional Filter Properties. Other properties that can help identify objects
ordinal identifier:
Sometimes there are series of objects with same class name and properties. Lets us say in a window there are series of checkboxes with the same set of properties. If we want to act on those objects we need to uniquely identify them so that QTP will be able to act on it.
An Ordinal Identifier assigns a numerical value to the test objects which indicates its location or order relative to its group. The Ordered value enables QTP to recognize it uniquely when the inbuilt properties are NOT sufficient to do so.
There are 3 Ordinal Identifiers in QTP that can be used in different context:
Index
Location
Creation Time(Used for Web application)
Q. How do you import and export your DataSheets and Results
A. Import/export data sheets:
Import-Import all the sheets of the datatable
ImportSheet-Import a specific sheet to a specific location in side QTP.
Export-Export all the sheets which are present in QTP at the time of execution.
Exportsheet-Export a specific sheet from QTP to specific location.
Results -results can be exported in to HTML.
Q. To run a functional library we use Execute file
A. Executefile method is used to run the functions which are saved in .vbs file
If you want to call a functions for the private\single script or action, use executefile method.
here note that we are not associating library file/Functions (Library file is one which contains all the functions and saved in .vbs format) to the QTP.
Advantage :
No need to associate the library files to the QTP
Dis-Advantage :
The called function is always applicable to the that particular script or action only. In other word the called function will not be a global.
Syntax is :
ExecuteFile "path of the .vbs file"
1. What is the difference between Loadfunctionlibrary and Executefile?
a. ExecuteFile -It loads the libraray at run time but with no debugging support.
Loadfunctionlibrary – It also loads the library at runtime.Here debugging is possible at runtime
b. ExecuteFile- we can load only single libraray using call executefile statement for eg:”C:\func1.vbs”
Loadfunctionlibrary -But here we can load multiple function libraries using call loadfunctionlibrary for eg: “C:\func1.vbs”,”C:\func2.vbs”
Q. If multiple browsers are open with same name, how will you close only one specified browser.
A. Using ordinal identifier-Creation Time for browsers
Q. How is the QTP end result has been designed in your previous project.
A. QTP end results are stored in to QC/ALM.
Q. Which locator is best to identify an element on a web page?
A. First preference goes to Id or Name for an element if exists and can be uniquely identified through them. If not , then we should go for CSSSelector or Xpath. Cssselector is always preferable in obtaining fast performance. Xpath will be given a choice when there is complex locator to identify.
Q. How to increase the size of array dynamically?
A. By Using Redim with the array name
Q. Suppose say I write a generic function which has 4 parameters. For a particular scenario, how can I make one of the parameter as optional.
A. Need to create a function with three parameters and the fourth need o pass inside the same function with another function if the 4 exists.
Example:-
Function Func (Param1, Param2)
Result = NewWhatEver(Param1, Param2, "")
End Function
Function NewFunc (Param1, Param2, Param3)
'Code goes here
End Function
Q. What is AOM.
A. Automation Object Model:
QTP itself can be automated using the COM interface that is provided by Hp-QTP. 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 interface. The Key Configurations/actions that can be controlled are listed below but not limited to
Loads all the required add-ins for a test
Makes QTP visible while execution
Opens the Test using the specified location>
Associates Function Libraries
Specifies the Common Object Sync Time out
Start and End Iteration
Enable/Disable Smart Identification
On Error Settings
Data Table Path
Recovery Scenario Settings
Log Tracking Settings
Q. what is the benefit of DOM.
A. Document Object Model(DOM):
DOM is a method for QTP engineers to access the source (IE –> View –> Source) of any webpage direct through VB Scripting.
Q. There is a webcheckbox in a page which is being identified properly. When tried to click, it didnot select the checkbox but the step got executed successfully. What could be the problem
A. WebCheckbox need to be set ON(this will do click on the required object)
Q. How to retrieve multiple values thru function.
A. By assigning the values into an array.
Q. Explain about the classes in VB Script
A. Class is a template for a collection object's that share a common set of attributes & operations. The term, Class, refers to any object that you create using the Class ... End Class statement. This ability to create your own object and to perform operations upon it using any valid VBScript code, represents a significant expansion of the versatility of the VBScript language.
Q. Difference between Functions and Procedures
A. Function Returns a value where as a procedure do not return.
Q. How to Reverse the word 'Saleem' without using any function
A. Using Mid function we can reverse a
string str = "Saleem"
strLenth = Len(String)
For I = 0 to strLenth
String1 = Mid(str, strLenth, i)
ReverseString = String1&ReverseString
Next
Msgbox ReverseString
Q. Give the Regular expression for a page title as 'Sam 05/03/2012 2.53 PM' ( Do't use .* )
A. for Date: (0[1-9]|1[012])[//](0[1-9]|[12][0-9]|3[01])[//]200[0-9]) For Time: ([0-1][0-9]|2[0-3])[/:]([0-5][0-9])
Q. BPT
A. BPT stands for Business Process Testing, a built in QTP automation framework used in conjunction with the Quality Center. BPT helps indulge Business Analysts in the automation process. They can also design the automation scenarios and executed them as per their requirements without automatation/coding knowledge
BPT is a scenario consisting of a series of Business Components, designed to verify a particular Business process in the application under test.
The following are the building blocks of the BPT Framework
•Components
•Application Area
•Flows
•Business Process Test
Q. What are the different types of Data Tables available in QTP and explain the functionality
A. There are two types:
a. Global - The data can be stored in global tab when the data is made available in all actions performed in the test.
b. Action - The data can be stored in the action tab when the data is made available for that particular action in the test.
Q.How to get child objects?
A. We use child objects when we want to find count of similar objects in a page
Dim obj_ChkDesc
Set obj_ChkDesc = Description.Create
obj_ChkDesc("html tag").value = INPUT
obj_ChkDesc("type").value = checkbox
Dim allCheckboxes,
singleCheckBox Set allCheckboxes = Browse("Browser").Page(Page).ChildObjects(obj_ChkDesc)
For each singleCheckBox in allCheckboxes
singleCheckBox.Set ON
Next
Q. If an object changes in application how is it updated and how it is maintained
A. It depends on how the object identification is happened.
1.With Object recovery: Update from application button is avilable in OR
2.With Descriptive Programming:find the object changes by using spy and
update the property values.
Q. Using Object repositories, using descriptive programming which one you suggest for web applications.
A. There is no specific answer as to which of two is better. There are certain situations when using DP has its own benefits while some other places OR is good.
Q. What are the basic addins in QTP and also what is the use of addins in QTP.
A. Basic add-ins are: Web, ActiveX, Visual Basics. Additional add-ins are: Java, Oracle, SAP, .NET, Web Forms, Siebel, PeopleSoft, Web services, Main frame (Terminal Emulator). This add-in concept will help QTP to support wide-range of applications without compromising the performance. And, it will improve object identification reliability.
Q. Difference between Shared and local object repositories.
A. If the objects are stored in the local object repository they are available for particular action only. If the objects are stored in the shared object repository they are available for entire application. Shared object repository occupies less memory than the local object repository.
Q. Write code to count the occurrence of a particular text in a WebTable.
A. Set a=Browser("creationtime:=0").page("micclass:=page").WebTable(abc).ChildObjects
print a.count
Q. Write code to copy a WebTable values into a Excel sheet cell by cell
A. Set desc=Description.Create() desc("micclass").value="WebTable" desc("text").Value="200220032004Capital structure analysis.*"
Set WebEdits=Browser("Title:=Financial Analysis").Page("Title:=Financial Analysis").ChildObjects(desc) cCount=WebEdits(0).getROProperty("cols")
rCount=WebEdits(0).getROProperty("rows")
Set objExcel = CreateObject("Excel.Application") objExcel.
Visible = True
Set objWorkbook= objExcel.Workbooks.Open("C:\Documents and Settings\Administrator\Desktop\ForumExcel.xls")
Set objSheet=objExcel.Sheets("Sheet1")
For i=1 To rCount
For j=1 To cCount
data=WebEdits(0).GetCellData(i,j)
If (Instr(data,"analysis (%)") <> 0 OR Instr(data,"flow (%)") <> 0) Then objsheet.Cells(i,j).Value=data j=cCount else objsheet.Cells(i,j).Value=data
End If
Next
Next
objWorkbook.save
objWorkbook.close
objExcel.Quit
set objExcel=nothing
Q. How to connect to a database dynamically in QTP.
A. Function getConnection ()
On Error Resume Next
Dim oConnection,ConnectionString
ConnectionString ="Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight32.mdb;
User Id=admin;Password=;"
Set oConnection = CreateObject("ADODB.Connection")
oConnection.Open ConnectionString
Set getConnection = oConnection
End Function
Q. Write a generic function to search an option in a dropdown list.
A. Values = Browser(abc).Page(abc).WebList(xyz).GetROProperty("value")
Apply For loop and check till end of string.
Q. Write the code to decrease the default waiting time of qtp for web application from 60 seconds to 20 seconds.
A. We can use exist(2) or exist(x). And we dont have to wait for default waiting time.
Q.How to retrieve the text from one of the cells in Webtable?
A. Using the Childitem method, we pass row number, column number, QTP Class type, and index. But in JAVATable, we have the flexibility to pass the Column name directly instead of column no, so advantage is, we need not to bother if there is any hidden columns in the web table.
A. JAVAEdit, JAVAButton, JAVAList, JAVATable, JAVATREE, JAVACOMBOBOX, JAVALISTBOX, etc
Q. For automation how you identify the Test cases and how you Automate.
A. Those Test Cases which are repeatable with more sets of data and execution of test cases for more releases.Need to identify test cases execute the routine tasks like smoke tests and regression tests.Based on the tool licence cost,time , development cost and considering the ROI to decide to go for a particular tool.
Q. Different properties of an object
A. 1.By using Object spy QTP will fetch the values along with properties
2.micclass,x,y,window id etc.
Q. How does QTP identifies object on a web page
A. By following hirarchy.
Browser->Page->Objects
Q. Types of properties
A. Mandatory Properties Assesstive properties Ordinal Properties Smart Identification properties
Q. Function to find substring from a string
A. By using "Instr"
Q. What is descriptive programming
A. Descriptive Programming is the type of programming where you DON’T use Object Repository while writing your test scripts.
Types of Descriptive Programming
You can use Descriptive programming in two ways
1) Static
multiple descriptions for identification, you can specify those using commas
2) Dynamic
In case your script uses the descriptive programming object candidate multiple times, it will be very tiresome to specify all the property value pairs for each statement
Q. Datatable methods
A. AddSheet Adds the specified sheet to the run-time data table DataTable.AddSheet(SheetName)
DeleteSheet Deletes the specified sheet from the run-time data table DataTable.DeleteSheet SheetID
Export Exports the Datatable to a new file in the specified location DataTable.Export(FileName)
ExportSheet Exports a Specific Sheet of the Datatable in run-time DataTable.ExportSheet(FileName,SheetName)
GetCurrentRow Returns the active row of the run-time data table of global sheet DataTable.GetCurrentRow
GetParameterCount Returns the number of columns in the run-time data Table of Global Sheet DataTable.GetParameterCount
GetRowCount Returns the number of rows in the run-time data table of Global Sheet DataTable.GetRowCount
GetSheet Returns the specified sheet from the run-time data table. DataTable.GetSheet(SheetID)
GetSheetCount Returns the total number of sheets in the run-time data table. DataTable.GetSheetCount
Import Imports a specific external Excel file to the run-time data table. DataTable.Import(FileName)
ImportSheet Imports the specified sheet of the specific excel file to the destination sheet. DataTable. ImportSheet(FileName, SheetSource, SheetDest)
SetCurrentRow Sets the Focus of the Current row to the Specified Row Number DataTable.SetCurrentRow(RowNumber)
SetNextRow Sets the focus of the next row in the run-time data table DataTable.SetNextRow
SetPreviousRow Sets the focus of the previous row in the run-time data Table DataTable.SetPrevRow
Q. How do you establish a connection to database?
A. ConnectionString="DSN=DSNName; Uname=;Pwd=<>pwd;"
Set oConnection = CreateObject("ADODB.Connection")
oConnection.Open ConnectionString
Q. How do you handle errors?
A. By using onerror resume next, also by using Exist, waitproperty methods we can identify the objects which might not be identified at the time of execution
Q. What is the use of getROProperty?
A. To get the values of object whose property values change at run time.
Q. How to Create folder with date and time stamp
A. After assigning NOW(default) function to a variable,by using filesystemobject QTP can create a folder and assign the above variable name to the folder.
Q. In Web table there are 100 rows and 2 columns how to get the particular text in a WebTable
A. By giving the exact row number and column number in Getcelldata(Row,Column)
Q. Automation Framework Types
A. 1. Data Driven 2. Keyword Driven 3. Hybrid Approach
Q. How to find whether 'India' word is there are not in "Sam India Solutions"
A. h = "Sam India Solutions"
a = Instr(1,h,"India")
msgbox a
Q. Explain Main factors while developing automation framework
A. 1. Feasibility Study and Study of Reusability of functionalities.
2. Test Data Driven
3. Exception and Recovery scenarios handling.
4. Test Reports Generation.
Q. What is Static Descriptive Programming.
A. Static Descriptive programming called as stright line descriptive programming.
Example : Browser("title:=Google").Page("title:=Google").WebEdit("micclass:=WebButton";"index:=0")
Q. How to find the index of two Save buttons in webpage and how to classify first and second save button.
A. Set btnobj = Description.Create() btnobj("micclass").Value = "WebButton"
btnobj("name").Value = "Save" btnobj("x").Value = "120"
Set btnObjects = Browser("BN").Page("PN").WebButton(btnobj).ChildObjects
msgbox btnObjects.Count
btnObjects(0).Click
Q. A link is available in webpage, qtp is generating the report link cliked without clicking the webpage link. How you over come this problem.
A. By using xpath we can click the link perfectly and By giving the condition as when expected page is displayed report should generate.
Q. How to get test data from excel files.
A. 3 ways we can get data into QTP. 1. Export excel data into QTP Datatables. 2. By Using Excel COM objects. 3. Create record set object for Excel as Database.
Q. How to Reverse the word '12345' without using any function
A. Using Mid function we can reverse a string
str = "12345"
strLenth = Len(String)
For I = 0 to strLenth
String1 = Mid(str, strLenth, i)
ReverseString = String1&ReverseString
Next
Msgbox ReverseString
Q. Write a vb script to fetch 20 records from excel
A. 'Create Excel Object
Set excel=createobject("excel.application")
'Make it Visible
excel.Visible=True
'Open Excel File
Set workbook=excel.Workbooks.Open("D:\excel.xls")
'Get Control on Sheet
Set worksheet=excel.Worksheets.Item("raj")
'Get the count of used columns
ColumnCount=worksheet.usedrange.columns.count
'Get the count of used Rows
RowCount=worksheet.usedrange.rows.count
'Get the Starting used Row and column
top=worksheet.usedrange.row
lft=worksheet.usedrange.column
'Get cell object to get the values cell by cell
Set cells=worksheet.cells
'Loop through Rows
For row=top to (RowCount-1)
rdata=""
'Loop through Columns
For col=lft to ColumnCount-1
'Get Cell Value
word=cells(row,col).value
'concatenate all row cell values into one variable
rdata=rdata&vbtab&word
Next
'Print complete Row Cell Values
print rdata
Next
'Close Work Book
workbook.Close
'Quit from Excel Application
excel.Quit
'Release Variables
Set worksheet=Nothing
Set workbook=Nothing
Set excel=Nothing
Q. What is Data driven testing in QTP
A. It is an automation testing part where input and output values are fetched from data files. In QTP to perform data driven test we use parameterization.
Q. Vb script to take input(Name and Empid) from users each time for 5 users
A. use Inputbox
Thanks For Watching My Post
Feel Free To Comment Your Queries
Comments
Post a Comment