|
Q:
What is Quick test pro?
|
It’s a Mercury interactive’s keyword driven testing tool
|
|
|
|
|
Q:
By using QTP what kind of applications we can test?
|
By using QTP we can test standard windows applications, Web objects, ActiveX controls, and Visual basic applications.
|
|
|
|
|
Q:
What is called as test?
|
Test is a collection of steps organized into one or more actions, which are used to verify that your application performs as expected
|
|
|
|
|
Q:
What is the meaning of business component?
|
It’s a collection of steps representing a single task in your application. Business components are combined into specific scenario to build business process tests in Mercury Quality center with Business process testing
|
|
|
|
|
Q:
How the test will be created in QTP?
|
As we navigate through our application, QTP records each step we perform and generates a test or component that graphically displays theses steps in a table-based keyword view.
|
|
|
|
|
Q:
What are all the main tasks which will be accomplished by the QTP after creating a test?
|
After we have finished recording, we can instruct QTP to check the properties of specific objects in our application by means of enhancement features available in QTP. When we perform a run session, QTP performs each step in our test or component. After the run session ends, we can view a report detailing which steps were performed, and which one succeeded or failed.
|
|
|
|
|
Q:
What is Actions?
|
A test is composed of actions. The steps we add to a test are included with in the test’s actions. By each test begin with a single action. We can divide our test into multiple actions to organize our test.
|
|
|
|
|
Q:
What are all the main stages will involve in QTP while testing?
|
Creating tests or business components
Running tests or business components
Analyzing results
|
|
|
|
|
Q:
How the creation of test will be accomplished in QTP?
|
We can create the test or component by either recording a session on our application or web site or building an object repository and adding steps manually to the keyword view using keyword-driven functionality. We can then modify our test with programming statements.
|
|
|
|
|
Q:
What is the purpose of documentation in key word view?
|
The documentation column of the key word view used to displays a description of each step in easy to understand sentences.
|
|
|
|
|
Q:
What is the use of data table in QTP?
|
Parameterizing the test
|
|
|
|
|
Q:
What is the use of working with actions?
|
To design a modular and efficient tests
|
|
|
|
|
Q:
What is the file extension of the code file and object repository file in QTP?
|
The extension for code file is .vbs and the extension for object repository is .tsr
|
|
|
|
|
Q:
What are the properties we can use for identifying a browser and page when using descriptive programming?
|
The name property is used to identify the browser and the title property is used to identify the page.
|
|
|
|
|
Q:
What are the different scripting languages we can use when working with QTP?
|
VB script
|
|
|
|
|
Q:
Give the example where we can use a COM interface in our QTP project?
|
COM interface appears in the scenario of front end and back end.
|
|
|
|
|
Q:
Explain the keyword create object with example?
|
Create object is used to create and return a reference to an automation object.
For example:
Dim ExcelSheetSet
ExcelSheet=createobject(”Excel.Sheet”)
|
|
|
|
|
Q:
How to open excel sheet using QTP script?
|
You can open excel in QTP by using the following command
System.Util.Run”Path of the file”
|
|
|
|
|
Q:
Is it necessary to learn VB script to work with QTP?
|
Its not mandate that one should mastered in VB script to work with QTP. It is mostly user friendly and for good results we need to have basic VB or concepts which will suffice.
|
|
|
|
|
Q:
If Win Runner and QTP both are functional testing tools from the same company. Why a separate tool QTP came in to picture?
|
QTP has some additional functionality which is not present in Win Runner. For example, you can test (Functionality and Regression testing) an application developed in .Net technology with QTP, which is not possible to test in Win Runner.
|
|
|
|
|
Q:
Explain in brief about the QTP automation object model?
|
The test object model is a large set of object types or classes that QTP uses to represent the objects in our application. Each test object has a list of properties that can uniquely identify objects of that class.
|
|
|
|
|
Q:
What are all the components of QTP test script?
|
QTP test script is a combination of VB script statements and statements that use QuickTest test objects, methods and properties.
|
|
|
|
|
Q:
What is test object?
|
It’s an object that QTP uses to represent an object in our application. Each test object has one or more methods and properties that we can use to perform operations and retrieve values for that object. Each object also has a number of identification properties that can describe the object.
|
|
|
|
|
Q:
What are all the rules and guidelines want to be followed while working in expert view?
Case-sensitivity.
|
Case-sensitivity
VB script is not case sensitive and does not differentiate between upper case and lower case spelling of words.
Text strings
When we enter value as a string, that time we must add quotation marks before and after the string
Variables
We can use variables to store strings, integers, arrays and objects. Using variables helps to make our script more readable and flexible.
Parentheses
To achieve the desired result and to avoid the errors, it is important that we use parentheses() correctly in our statements.
Comments
We can add comments to our statements using apostrophe (’), either at a beginning of the separate line or at the end of a statement
Spaces
We can add extra blank spaces to our script to improve clarity. These spaces are ignored by the VB script
|
|
|
|
|
Q:
How can i check the properties of an object in an application without using check
points? For Example how will you check whether a button is enabled?
|
GetROProperty method is used to retrieve the properties of the object in an application. It is very useful method and can be used to retrieve almost any of the property that can be seen while spying the object with object spy. For Example
‘To get whether button is enabled or not. Val = Browser("QA Friends").Page("QA Friends").WebButton("Login").GetROProperty("disabled")
‘To get whether a checkbox is on or off. Val = Browser("QA Friends").Page("QA Friends").WebCheckBox("Test").GetROProperty("Value")
Q28. How can I modify the properties values of test objects in Object Repository during run time?
You can use SetTOProperty method of test object. Object(description).SetTOProperty Property, Value The values of test object properties are used to identify the objects. Sometimes the properties of the object in the application change dynamically. For example text of a link in a webpage is the username used to login to that page. Text property is used by test object to identify the link. So in order to identify the actual object we can manipulate the value of “text” property of link using SetTOProperty.
|
|
|
|
|
Q:
How do you synchronize your scripts in QTP?
|
For waiting until navigation of web page completes we can use Sync method. For waiting until an object appears we can use Exist method. For waiting until a property of object changes we can use WaitProperty method. You can set browser navigation timeout in: Click Test > Settings menu Select web tab in Test Settings window. Enter the timeout in Browser Navigation Timeout text box. You can set global object sychrozization timeout in: Click Test > Settings menu Select Run tab in Test Settings window. Enter the timeout in Object Synchronization Timeout text box.
|
|
|
|
|
Q:
where can you write user defined functions that are accessible by all scripts?
|
We can write user defined function in .vbs file. This file can be loaded by adding the file as follows: Click Test > Settings menu Select Resources tab in Test Settings window and add the file. Alternatively you can also load the file through script using ExecuteFile “absolute or relative path of file” For Example: ExecuteFile “C:\Test.vbs”
|
|
|
|
|
Q:
What are regular expressions?
|
Regular expressions used for identifying objects and text strings with varying values. You can use regular expressions for defining the property values of an object, creating checkpoints with varying values etc. Example: For example if the caption on the button in an application changes dynamically and can be anything which starts with “Hello” (It can be Hello XYZ, Hello AB13 and so on) You can go object repository and change the value of name property of the button object to “Hello.*” Here “.” means any single character and “ * ” means 0 or more occurances of preceding character. So .* means 0 or more occurances of any character. There are many other regular expression characters: For Example: Regular expression test[0-9] matches test0, test1, test2…… to test9. Regular expression abc[789] matches abc7, abc8, abc9
|
|
|
|
|
Q:
Different ways to parameterize tests?
|
Test, action or component parameters – for using values from other action in your test. Data Table parameters – for creating data driven test based on values in data table. Environment variable parameters – For using values of environment variable. Random number parameters – For using random numbers as values in our test or component.
|
|
|
|
|
Q:
What can you do if values of object properties in an application are changing
constantly?
|
We can try using alternatives like regular expressions, Changing description of test objects in object repository during run time, using descriptive programming and so on.
|
|
|
|
|
Q:
What can you do if objects are not identified by QTP?
|
For standard windows environment you can try object mapping user defined classes to standard classes. 2)You can find whether any addins are available for given environment. 3) check if any other reliable alternativies are available like using keyboard shortcuts, using automation object model of application if available and so on.
|
|
|
|
|
Q:
What is descriptive programming?
|
Descriptive programming allows you to work with objects that are not stored in object repository. two types of programmatic descriptions. 1) listing the set of properties and values that describe the object directly in a test statement. 2) Add collection of properties and values to a Description object, and then enter the Description object name in the statement.
|
|
|
|
|
Q:
How will you access database from QTP?
|
You can use ActiveX Data Object for accessing the content of database. You can create connection object, recordset object and then execute query. And access the values of query in recordset. Example Set objConn= CreateObject("ADODB.connection") Set objRecSet = CreateObject("ADODB.recordset") objConn.open strConString 'strConString is database connection string. objRecSet.open strQuery,objConn 'strQuery is SQL query to execute.
Or
Const adOpenStatic = 3 Const adLockOptimistic = 3 Const adUseClient = 3 Set objConnection = CreateObject("ADODB.Connection") Set objRecordset = CreateObject("ADODB.Recordset") objConnection.Open "DRIVER={Microsoft ODBC for Oracle};UID=<UID>;PWD=<PWD>" objRecordset.CursorLocation = adUseClient objRecordset.CursorType = adopenstatic objRecordset.LockType = adlockoptimistic ObjRecordset.Source="select field1,field2 from testTable" ObjRecordset.ActiveConnection=ObjConnection ObjRecordset.Open 'This will execute your Query If ObjRecordset.recordcount>0 then Field1 = ObjRecordset("Field1").Value Field2 = ObjRecordset("Field2").Value End if
Notes:
Data Table
Two Types of data tables
Global data sheet: Accessible to all the actions
Local data sheet: Accessible to the associated action only
Usage:
DataTable("Column Name",dtGlobalSheet) for Global data sheet
DataTable("Column Name",dtLocalSheet) for Local data sheet
If we change any thing in the Data Table at Run-Time the data is changed only in the run-time data table. The run-time data table is accessible only through then test result. The run-time data table can also be exported using DataTable.Export or DataTable.ExportSheet
|
|
|
|
|
Q:
How can i save the changes to my DataTable in the test itself?
|
Well QTP does not allow anything for saving the run time changes to the actual data sheet. The only work around is to share the spreadsheet and then access it using the Excel COM Api's.
|
|
|
|
|
Q:
How can i check if a parameter exists in DataTable or not?
|
The best way would be to use the below code:
code:
on error resume next val=DataTable("ParamName",dtGlobalSheet) if err.number<> 0 then 'Parameter does not exist else 'Parameter exists end if
|
|
|
|
|
Q:
How can i make some rows colored in the data table?
|
Well you can't do it normally but you can use Excel COM API's do the same. Below code will explain some expects of Excel COM APIs
code:
Set xlApp=Createobject("Excel.Application") set xlWorkBook=xlApp.workbooks.add set xlWorkSheet=xlWorkbook.worksheet.add xlWorkSheet.Range("A1:B10").interior.colorindex = 34 'Change the color of the cells xlWorkSheet.Range("A1:A10").value="text" 'Will set values of all 10 rows to "text" xlWorkSheet.Cells(1,1).value="Text" 'Will set the value of first row and first col
rowsCount=xlWorkSheet.Evaluate("COUNTA(A:A)") 'Will count the # of rows which have non blank value in the column A colsCount=xlWorkSheet.Evaluate("COUNTA(1:1)") 'Will count the # of non blank columns in 1st row
xlWorkbook.SaveAs "C:\Test.xls" xlWorkBook.Close Set xlWorkSheet=Nothing Set xlWorkBook=Nothing set xlApp=Nothing
|
|
|
|
|
Q:
What is SMART Identification?
|
Smart Identification is nothing but an algorithm used by QTP when it is not able to recognize one of the object. A very generic example as per the
QTP manual would be, A photograph of a 8 year old girl and boy and QTP records identification properties of that girl when she was 8, now when
both are 10 years old then QTP would not be able to recognize the girl. But there is something that is still the same, that is there is only one girl in the photograph. So it kind of PI (Programmed intelligence) not AI.
|
|
|
|
|
Q:
When should i use SMART Identification?
|
Something that people don't think about too much. But the thing is that you should disable SI while creating your test cases. So that you are able to recognize the objects that are dynamic or inconsistent in their properties. When the script has been created, the SI should be enabled, so that the script does not fail in case of small changes. But the developer of the script should always check for the test results to verify if the SI feature was used to identify a object or not. Sometimes SI needs to be disabled for particular objects in the OR, this is advisable when you use
SetTOProperty to change any of the TO properties of an object and especially ordinal identifiers like index, location and creationtime.
|
|
|
|
|
Q:
What is Descriptive Programming?
|
Descriptive programming is nothing but a technique using which operations can be performed on the AUT object which are not present in the OR.
|
|
|
|
|
Q:
What is a Recovery Scenario?
|
Recovery scenario gives you an option to take some action for recovering from a fatal error in the test. The error could range in from occasional to typical errors. Occasional error would be like "Out of paper" popup error while printing something and typical errors would be like "object is disabled" or "object not found". A test case have more then one scenario associated with it and also have the priority or order in which it should be checked.
|
|
|
|
|
Q:
What does a Recovery Scenario consists of?
|
Trigger: Trigger is nothing but the cause for initiating the recovery scenario. It could be any popup window, any test error, particular state of an object or any application error.
Action: Action defines what needs to be done if scenario has been triggered. It can consist of a mouse/keyboard event, close application, call a
recovery function defined in library file or restart windows. You can have a series of all the specified actions.
Post-recovery operation: Basically defined what need to be done after the recovery action has been taken. It could be to repeat the step, move
to next step etc....
|
|
|
|
|
Q:
When to use a Recovery Scenario and when to us on error resume next?
|
Recovery scenarios are used when you cannot predict at what step the error can occur or when you know that error won't occur in your QTP script but could occur in the world outside QTP, again the example would be "out of paper", as this error is caused by printer device driver. "On error resume next" should be used when you know if an error is expected and don’t want to raise it, you may want to have different actions depending upon the error that occurred. Use err.number & err.description to get more details about the error.
|
|
|
|
|
Q:
How do we associate a library file with a test?
|
Library files are files containing normal VBScript code. The file can contain function, sub procedure, classes etc.... You can also use executefile function to include a file at run-time also. To associate a library file with your script go to Test->Settings... and add your library file to resources tab.
|
|
|
|
|
Q:
When to associate a library file with a test and when to use execute file?
|
When we associate a library file with the test, then all the functions within that library are available to all the actions present in the test. But when we use Executefile function to load a library file, then the functions are available in the action that called executefile. By associated a library to a test we share variables across action (global variables basically), using association also makes it possible to execute code as soon as the script runs because while loading the script on startup QTP executes all the code on the global scope. We can use executefile in a library file associated with the test to load dynamic files and they will be available to all the actions in the test.
|
|
|
|
|
Q:
What is the difference between Test Objects and Run Time Objects ?
|
Test objects are basic and generic objects that QTP recognize. Run time object means the actual object to which a test object maps.
|
|
|
|
|
Q:
Can i change properties of a test object?
|
Yes. You can use SetTOProperty to change the test object properties. It is recommended that you switch off the Smart Identification for the object on which you use SetTOProperty function.
|
|
|
|
|
Q:
Can i change properties of a run time object?
|
No (but Yes also). You can use GetROProperty("outerText") to get the outerText of a object but there is no function like SetROProperty to change this property. But you can use WebElement().object.outerText="Something" to change the property.
|
|
|
|
|
Q:
What is the difference between an Action and a function?
|
Action is a thing specific to QTP while functions are a generic thing which is a feature of VB Scripting. Action can have 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.
|
|
|
|
|
Q:
Where to use function or action?
|
Well answer depends on the scenario. If you want to use the OR feature then you have to go for Action only. If the functionality is not about any automation script i.e. a function like getting a string between to specific characters, now this is something not specific to QTP and can be done on pure VB Script, so this should be done in a function and not an action. Code specific to QTP can also be put into an function using DP. Decision of using function/action depends on what any one would be comfortable using in a given situation.
|
|
|
|
|
Q:
What is checkpoint?
|
Checkpoint is basically a point in the test which validates for truthfulness of a specific things in the AUT. There are different types of checkpoints depending on the type of data that needs to be tested in the AUT. It can be text, image/bitmap, attributes, XML etc....
Q54. What's the difference between a checkpoint and output value?
Checkpoint only checks for the specific attribute of an object in AUT while Output value can output those attributes value to a column in data table.
|
|
|
|
|
Q:
My test fails due to checkpoint failing, Can I validate a checkpoint without my test failing due to checpoint failure?
|
code:
Reporter.Filter = rfDisableAll 'Disables all the reporting stuff chk_PassFail = Browser(...).Page(...).WebEdit(...).Check (Checkpoint("Check1")) Reporter.Filter = rfEnableAll 'Enable all the reporting stuff if chk_PassFail then MsgBox "Check Point passed" else MsgBox "Check Point failed" end if
|
|
|
|
|
Q:
How can I import environment from a file on disk?
|
Environment.LoadFromFile "C:\Env.xml"
|
|
|
|
|
Q:
How can I check if a environment variable exist or not?
|
When we use Environment("Param1").value then QTP expects the environment variable to be already defined. But when we use Environment.value("Param1") then QTP will create a new internal environment variable if it does not exists already. So to be sure that variable exist in the environment try using Environment("Param1").value.
Q59. How many types of Parameters are available in QTP?
QTP provides three types of Parameter- • Method Argument • Data Driven • Dynamic
|
|
|
|
|
Q:
Which all environment QTP supports?
|
ERP/ CRM Java/ J2EE VB, .NET Multimedia, XML Web Objects, ActiveX controls SAP, Oracle, Siebel, PeopleSoft Web Services, Terminal Emulator IE, NN, AOL
|
|
|
|
|
Q:
What’s the Transaction?
|
You can measure how long it takes to run a section of your test by defining transactions.
|
|
|
|
|
Q:
Which environments are supported by Image Checkpoint?
|
Image Checkpoint are supported only Web environment.
|
|
|
|
|
Q:
Which environments are supported by Table Checkpoint?
|
Table Checkpoints are supported only ActiveX environment.
|
|
|
|
|
Q:
What is a Run-Time data table?
|
The test results tree also includes the table-shaped icon that displays the run-time data table-a table that shows the values used to run a test containing data table parameters or the data table output values retrieved from a application under test
|
|
|
|