UFT (Unified Functional Testing)

1) What are the different ways to invoke an application using QTP?

SystemUtil.Run ( FileName, Parameters, Path, Operation )
Example: SystemUtil.Run(“iexplorer.exe”,http://www.google.com)


2) How does QTP identify an object?

Mandatory properties: Object description

Assistive properties: If description not sufficient then adds non mandatory properties

Ordinal Identifier:  If assistive not sufficient then stores object’s location on the page or in the source code.

3) Object Spy : To know operations and properties of an object in hierarchy.

4) object repository: Warehouse where all the objects in a test are stored.-- Can be accessed from Object Repository manager.

5) OR Types:

             1) Local Repository: Every action has local repository.
             2) Shared Repository: Repository for multiple actions.

6) What are advantages of test automation?

   Time – It produces quick results
   Cost-effective
   No Manual intervention
   Not prone to human errors

7) If the objects hierarchy is changing from build to build, then how you will handle that condition?

--> We go for Descriptive programming

8) Types of descriptive programming

a) Static descrptive programming

Syntax: TestObject(“Property name1:=property value”,”property name 2:=property value”,….n)
Eg: Browser(“creationtime:=0”).Page(“title:=Google”).WebButton(“name:=Google Search”)


b) Dynamic descriptive programming


    Set Testdesc=description.create
    Testdesc(“micClass”).value= “webButton”
     micClass refers to the predefined classes in QTP

You can extract all the objects of a certain class in a page by using the following statement:

1) Set ObjectList=Browser(“creationtime:=0”).Page(“title:=*”).ChildObjects(Testdesc)
2) Msgbox ObjectList.count

9) How to find names of all the properties:

1) For i=0 to ObjectList.count -1 to Step 1
2) Msgbox ObjectList (i).GetRoProperty(“name”)
3) Next

10) Database connections:

To connect to a database we typically use an ADO connection object. ADO is Microsoft’s ActiveX Data Objects.

The following are the steps to be followed:

a) Create a DSN. Please refer to the database checkpoint tutorial to see how this is done or create one from the control panel.
b) Create a connection object:

Set conn=CreateObject(“ADODB.connection”)

c) Create a recordset object. The recordset object holds the results of the query that we are going to run.

Set rs=CreateObject(“ADODB.RecordSet”)

d) Open the connection object and run the query:

conn.Open “DSN=testDB2;UID=swatiseela;pwd=testing@123”
rs.Open “Select * from abc”,conn
e) All the query results can now be accessed using the “rs” object.

f)  For example, if you want to get the count of the rows returned, you can use
rs.getrows
g) For example, the table has 2 rows and 3 columns(a,b,c) you can access the values as follows:
Msgbox rs.fields(0).a
Msgbox rs.fiels(0).b
Msgbox rs.fields(0).c
h) You can use a loop statement if there are too many values to be accessed.
i)  Some of the functions that record set object can use are: rs.move, rs.movenext, rs.getrows, rs.close, rs.open, etc.

Code:

1) Set conn=CreateObject(“ADODB.connection”)
2) Set rs=CreateObject(“ADODB.RecordSet”)
3) conn.Open “DSN=testDB2;UID=swatiseela;pwd=testing@123”
4) rs.Open “Select * from abc”,conn
5) msgbox  rs.getrows
6) Msgbox rs.fields(0).a
7) Msgbox rs.fiels(0).b
8) Msgbox rs.fields(0).c
9) Msgbox rs.fields(1).a
10)Msgbox rs.fiels(1).b
11) Msgbox rs.fields(1).c
12) rs.close
13) conn.close


11) Connecting to MS Excel sheets

‘Create an excel application object

1) Set excelobj = CreateObject(“Excel.Application”)

‘Set it to visible, otherwise it will be visible in the task manager but you will not be able to view it but it continues to work in the background

2) excelobj.visible = true

‘Opens a workbook at the path speficified. If you need to open a new workbook, use excelobj.workbooks.Add

3) excelobj.workbooks.Open(“C:\Users\Swati\Desktop\QTP\test.xls”)

‘Sets the current sheet as i. the sheet number starts from 1

4) i=1

5) Set sheet1 = excelobj.activeworkbook.sheets(i)

‘write to a cell in sheet 1. The cell is row 8 column 4, D8.

6) excelobj.activeworkbook.sheets(1).cells(8,4) = “Test QTP Write to cell”

‘To get the data from sheet2 cell ID C6

7) testretrurnval = excelobj.activeworkbook.sheets(3).cells(6,3)

‘save changes

8) excelobj.activeworkbook.save

‘close the workbook

9) excelobj.activeworkbook.close

‘Close Excel application

10) excelobj.quit

‘Clear memory

21)Set excelobj = nothing

12) Virtual objects: A virtual object is a non-standard object that is instructed by the tester via QTP to behave like a standard one

13) What is synchronization point in QTP?

It is a feature that QTP provides to make your test wait until a certain property on a certain object becomes an expected value before proceeding with the next steps.

14) Arrays: 1) Dim 2) Redim-- Preserve to save the values

15) Views in QTP

a) Keyword view: This is a tabular representation of your test that has the information like the Item,        Operation, Data and, Comments.

   Table fields: Item, Operation, Value and Documentation.

b) Expert view: This displays your test in terms of the actual lines of code.

16) What are the features and benefits of Quick Test Pro(QTP)?

1. Keyword driven testing--- Tabular form
2. Suitable for both client-server and web-based application--- Supports only windows platform
3. VB script as the script language
4. Better error handling mechanism
5. Excellent data-driven testing features

17) Installation: Seat license- For one system and Concurrent/floating license- For multiple systems

Add Ins: Active-X, Web and Visual Basic (By default)

18) Location ID is from Left-Right and Top-Bottom

19) Index ID starts with 0

20) What test cases can you automate using QTP?

You can automate anything. It is only limited by your imagination and expertise.
However, in case you need to understand the look, feel or human reaction to a certain feature, then that is not possible.

21) Smart Identification: If the recorded description does not enable QTP to identify the specified object in a step, and a smart identification definition is defined

22) What are the factors on which script execution time is dependent?

1. Network and computer speeds. The response time from the app, the database etc. This is true even if you are manually executing the test.
2. It also depends on the wait statements you have included.
3. Not loading the add-ins that your test does not use helps too.
4. Descriptive programming steps take longer than regular ones to execute
5. Capturing screenshots at runtime through QTP also consumes time
6. Disabling smart identification also speeds up the QTP script running time

23) How to handle the exceptions using recovery scenario manager in QTP?

You can instruct QTP to recover unexpected events or errors that occurred in your testing environment during a test run.
Recovery scenario manager provides a wizard that guides you through the defining recovery scenario.

Recovery scenario has three steps:

1. Triggered Events
2. Recovery steps
3. Post-Recovery Test-Run

24) File extension of:

Per test object rep: filename.mtr
Shared Object rep: filename.tsr
Code file extension id: script.mts

25) What is a Run-Time Data Table? Where can I find and view this table?

In QTP, there is data table used, which is used at runtime.
-In QTP, select the option View->Data table.
-This is basically an excel file, which is stored in the folder of the test created, its name is Default.xls by default.

26) What is the difference between Call to Action and Copy Action.?

Call to Action: The changes made in Call to Action, will be reflected in the original action (from where the script is called).
But where as in Copy Action , the changes made in the script ,will not effect the original script(Action)

27) Version difference:

    QTP: Was for GUI
    UFT 11.5: Was for GUI+API (Smart object identification)
    UFT 12.0 : GUI + API + BPT (Business Process Testing)

No comments:

Post a Comment