Overview

Overview

Welcome to QTP interview questions

Hello software Quality engineers. Welcome to our Software testing world and common QTP(Quick test pro) related technical issues, interview questions etc. . Over 2 years, I am trying to update all possible interview questions in testing area of QTP. With your continuous comments on the topics and suggestions, we are growing day by day.

Showing posts with label functions. Show all posts
Showing posts with label functions. Show all posts

Wednesday, December 19, 2007

Can you tell me in detail about .qfl & .vbs extensions that are used for QTP files ?

In QTP normally we use three different types of extensions.
.QFL is local to the QTP and will be called and also used by only QTP.
Where as .VBS & .TXT files can be used by QTP and as well as other application as well.

And one more difference is in QFL you can put a break point, where as in .VBS you can not put a break point.
In general all of these three extension files can be used to define a function and then use this file(function) in QTP.

And the last difference is .QFL files you need to associate with test to call it. But .VBS functions you need not associate them to the test you are calling from. You can simply use executeFile statement to call vbs file.

What is the use of Actions and Functions in QTP? What do you know about Actions, functions in QTP?

Actions are specific to QTP. Normally a single or combination of multiple actions make a QTP script. Actions can associate with OR (object repository).

Functions are a piece of VB script code that has a variables and after execution will produce a return value that will be passed to the script back for further usage. Functionas can not associate with OR.

When we need to add some functionality to qtp script then we go for functions and call them in scripts.

Did you write any custom function in QTP?

Yes, I have written a custom function in QTP for editing the Data table row colors.
Below is the code for this using Excel COM api’s.
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