Friday, October 1, 2010

QTP Probable Interview Question

1. What is error Handling and Exception handling in QTP and how do you go about it?

Exception handling can be done by recovery Manager in QTP. Exceptions can be related to pop-up, Object, application crash.

Exceptions can be user generated and systems generated.

Error handling can be done by making logical implementations in the code. . Like if I have to check for caption on a page, I can getropeoperty of the page and check if it exists or no by making if and else clause

2. What is automation framework and automation strategy?

Automation framework: You have to talk about standards and naming convention you follow in creating scripts/actions in QTP PLUS the folder structure to organize your files.

Automation Strategy: you have to talk about identifying testcases for automation at first place and then capture the GUI of application using Object Repository. After that you can talk about creating functions and procedures to implement reusablility.

3. What is recovery scenario and how does it work in QTP?

Go thru Recovery Manager and talk about pop-up exception and object exception by giving examples from your projects

4. How do you connect QTP to TSL script/winrunner?

We have a option in QTP menu, call to winrunner scripts and call to winrunner functions.

Using that we can run Winrunner functions and scripts thru QTP

5. What is object repository in QTP?

Object repository is the repository of all the application objects that users wants to work with / or to automate . Object repository contains information about object class and properties of the objects that QTP needs to have in order to identify the object.

6. What is a test defect cycle in QTP?

Test Defect cycle in QTP is of 2 types:

1. You can connect to QC thru QTP and can choose the Option> File defect for each failed step (settings in qtp under general options). Once this option is selected, defects will be filed directly to QC whenever there will be a failed step in Test results window.

2. Secondly, we can do it manually. We can analyze results file after executing QTP testcases and then identify/file defects in QC.

7. QTP is better than Winrunner?

QTP is a upgrade to WR. It has some functionality added to it which WR doesn’t have.

* XML checkpoints

* Accessibility checkpoints

* Output checkpoints

* Actions

* Call to WR scripts/functions

* Object Identification

8. Explain how you have used QTP in your projects?

You will have to explain QTP in terms of your projects. You can start it with Automation framework and then talk about automation process till regression / filing defects

9. What is the difference between UI testing and UATesting?

UI is user interface testing which is usability testing. Basically you check if the User interface works as per functionality. UAT is end user testing which gets done after UI testing is done. In UAT we assume that all the defects are being detected and fixed. UAT is more like meeting end user criteria.

10. How do you record the whole application in QTP?

1) set the appropriate add-ins

2) do the test settings

3) Choosing the Recording Mode

QuickTest's normal recording mode records the objects in your application and the operations performed on them. This mode is the default and takes full advantage of QuickTest's test object model, recognizing the objects in your application regardless of their location on the screen.

When working with specific types of objects or operations, however, you may want to choose from the following, alternative recording modes:

* Analog Recording—enables you to record the exact mouse and keyboard operations you perform in relation to either the screen or the application window. In this recording mode, QuickTest records and tracks every movement of the mouse as you drag the mouse around a screen or window.

This mode is useful for recording operations that cannot be recorded at the level of an object, for example, recording a signature produced by dragging the mouse.

Note: You cannot edit analog recording steps from within QuickTest.

* Low-Level Recording—enables you to record on any object in your application, whether or not QuickTest recognizes the specific object or the specific operation. This mode records at the object level and records all run-time objects as Window or WinObject test objects. Use low-level recording for recording in an environment or on an object not recognized by QuickTest. You can also use low-level recording if the exact coordinates of the object are important for your test or component.

Note: Steps recorded using low-level mode may not run correctly on all objects.

11. What is the output in QTP?

Output is the checkpoint on QTP which includes Object output, Bitmap, Database , XML output checkpoint. This is to store runtime values in runtime data table and can use them in next action

12. What is reusable action and reusable functions in QTP?

Reusable action can be reused by calling the action in other scripts. For e.g Action can be reusable if it includes ‘connection to database’. This you can use for other scripts in order to connect to datatbase.

Reusable functions can be used in actions. There is no such difference between reusable action and functions. Only thing can be framework standards. The company was creating reusable actions than creating reusable functions.

13. What are the main features of QTP?

* Checkpoints

* Recovery manager

* Object identification

* Object repository

* Virtual object

* Call to WR functions/scripts

14. How do you connect QTP to Quality center?

- QTP has a option to connect to QC. Under tools> connect to Quality center. You can choose the option to ‘logon at the start’. After that we have to run Add in for QTP, only then we will get the option of ‘QTP’ as the test type.

Nithya – QTP Questions

My interview went pretty well.My interviewer name is Roopa(From Cisco) Questions which i answered: QTP: 1.QTP Library 2.Object Repository 3.Functions 4.QTP Framework 5.QTP connectivity with Database

1. Asked about my current project and what did I do there??

2. How did I do database testing. On which database

3. Wether mainframe was there ?? How can you do database testing on mainframe??

4. Wether can query the mainframe database directly.

5. So how did the different databases talk ?? How was the data transferred between the databases

6. Give an example how you tested the database

7. So you used to query manually or through QTP??

8. So how did you output ??

9. Did you import directly from Database or import it into a excel sheet and then to QTP

10. What are the commands & methods you used to import data

11. Give me the flow of script, how its done to import the data

12. Do you specify the connect string directly

13. Do you use DNS, so do you specify the whole details…

14. How do you debug a script??

15. What is the reporter.report event syntax

16. Whats a procedure

17. Whats the difference between procedure & function

18. Say a=10, b= 20 & c= a+b. How do you get a value into sub.

19. Did I create my oun functions

20. Did I load the functions anywhere

21. Whats the difference between QTP 7.6 and QTP 8.2

22. How do you compare 5 excel sheets which has data imported from 5 different databases in QTP and export it to a 6th excel sheet

- create 5 actions with 5 excel and compare them

23. What is a weblogic server

24. How did you use weblogic in your application

25. Did you configure it

26. Did you do anything on webserver

27. How is the webserver used and what goes on inside

28. So if a order is processed and there is a problem, how do you tackle it from the beginning to the end

29. How do you findout wether a websever is down

30. Did I do any XML testing??

31. What are the deliverables in a testplan

Elana - Manual Tester

32. What did you use testdirector for ??

33. Did I independently write a testplan

34. Did I lead a project

35. What is the exit criteria for a testplan

Vince- Manager

36. Explain the project

37. Did I do XML testing??

38. What is XML used for and why is it used for ??

39. Did I do weblogic configuration

40. How do you tail logs

41. So wile tailing logs what other unix commands I used

42. Where did I used boundary testing for ??

43. What databse testing I did

Said looking for banking experience, Looking for who can work independently – Can gather requirements and do BR, testplan, testcases

Stella- I think she is a manual tester

44. Did I write a testplan

45. Whats the entrance criteria for a testplan

46. Whats the exit criteria for a testplan

47. What testing should development finish before it goes to testing

48. What is SDLC, explain the process

49. Where did you use QTP exactly

50. While you were using QTP, did you do recording ot scripting

51. Which one did you do more?

52. Did I interact with developers

53. How many years of QTP experience??

54. What did I use TD for ??

How are everyone doing ??

Experience in QA Field

How many testplans have you written.

How many testcases.

What is a good testcase.

How many bugs found in the last project.

TestDirector. How did you use it.

QTP

Keyword view,Expert view.

(in a very detailed way have to explain both views)

Standard checkpoint.

How to get output values.

Parametrising QTP

Synchronisation point

Unix

How do you view Server logs.

How do you find a particular file.

How extensively have you used Unix

DataBase

Which all Databases have you used.

How good are you in SQl

Questions related to uyour projects.

--------------------------------------------------------------------

The second interview was with another Russian lady.

She asked me how many years experience writing testplans.

She asked me a lot about my first project and the dates,When I started in

a particular company and when I left the company.

What is my role and responsibility in project?

Which part of India I am from?

Features of QTP. 1) Recovery Manager

2) Object Identification

3) checkpoints

4) synchronization point

5) Call to action

6) Call to WR scripts/Functions

7) Smart identification

8) Batch Runner

What is regular expression?

Regular expressions enable QuickTest to identify objects and text strings with varying values. You can use regular expressions when:

* defining the property values of an object in dialog boxes or in programmatic descriptions

* parameterizing a step

* creating checkpoints with varying values

For example, you can use a regular expression if you want to create a text checkpoint on a date text string, but the displayed date changes according to the current date. If you define the date as a regular expression, the checkpoint checks that the captured text string matches the expected date format, rather than checking the exact date value.

A regular expression is a string that specifies a complex search phrase. By using special characters, such as a period (.), asterisk (*), caret (^), and brackets ([ ]), you can define the conditions of a search.

What is automation test framework?

I have attached a file along with it for automation framework.

How different frameworks are different from each

Other?

How keyword driven frame work works?

If hired can I implement the framework there?

You need to ask them about there application first and then ask them if they are following any kind of process or standards for framework. Then you can suggest some enhancements in it.

How many years of experience in load runner? Have I

Done any project in load runner? Why load runner is

Used?

What is correlation? Give an example in your project

Where u has used correlation?

How I used load runner in my recent project?

Difference between test strategy and test framework?

What is recovery scenario manager? How it is used?

There is data is excel sheet, I want to import it to

QC then wants to perform test on it, meantime changes

Made in data sheet, want to bring data to qtp, how

To do that?

DataTable.Import // to import data

DataTable.Value ( to add new parameter or to change value for an exisiting parameter)

What all automation tools used so far? How many

Years of experience in manual, how many in

Automation?

How to debug custom function in qtp?

Go in Debug mode,

Step into the function

Add watchlist ( to check value of variables)

Step over (to come out of the function)

Expression ( to watch expression of variable or to execute some statement)

Give two most challenging scenario?

How to report message in qtp?

Difference btwn shared object and per action?

Jyothi – QTP interview questions

What are the two views in QTP?

* Keyword View and Expert View

What is there in Keyword view and Expert View? Which one did you use?

* Keyword is for recording purposes. We can see the Item (object)name, value, OPerationa nd documentation for action)

* Expert view is for programming purposes. We can implement our logic in script , can create functions , can see object class and method

What did you use expert view for?

* Expert view is for programming purposes. We can implement our logic in script , can create functions , can see object class and method

How do you get the part of the string from a given string?

* Mid(string, start[, length]) We also have Left Function | Len Function | LTrim, RTrim, and Trim Functions | Right Function

in QTP to work on strings

How do you write user defined functions and how do you add to the test?

* User Defined functions can be written in Expert view first and then copy it in Notepad file, save it with .vbs extension. Then we can add that file library file into Settings> Resources> Under Library

How many user defined functions did you write and what for?

* Based on Project/ Resume

What is the difference between Function and Procedure?

-A Sub procedure is a series of VBScript statements (enclosed by Sub and End Sub statements) that perform actions but don't return a value. A Sub procedure can take arguments (constants, variables, or expressions that are passed by a calling procedure). If a Sub procedure has no arguments, its Sub statement must include an empty set of parentheses ().

- Like a Sub procedure, a Function procedure is a separate procedure that can take arguments, perform a series of statements, and change the values of its arguments. However, unlike a Sub procedure, you can use a Function procedure on the right side of an expression in the same way you use any intrinsic function, such as Sqr, Cos, or Chr, when you want to use the value returned by the function.

You call a Function procedure using the function name, followed by the argument list in parentheses, in an expression. See the Call statement for specific information on how to call Function procedures

How do you call the function?

* Use Call Statement

* By function name ( lets say we have a function ABC, we can call it directly by giving function name in expert view like ……….. ABC() )

How do you return a value in the function?

* Specify the return value as argument

How do we get information from database using QTP and write it to the flat file?

- Retrieve the information from the database using ADO. This method imports the data into the run-time data table. After the script completes execution, you will not see the data in the Data Table.

Example:

' Create the Connection Object.

Set cnBiblio = CreateObject("ADODB.Connection")

' Set the Connection String.

cnBiblio.ConnectionString = "DSN=QT_Flight32;DBQ=C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight32.mdb;DriverId=281;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;"

cnBiblio.Open

Set rcRecordSet= cnBiblio.Execute("SELECT Flight_Number, Order_Number, Customer_Name from Orders")

' Get all the fields from the data table (fields = Column Names).

for each fields in rcRecordSet.fields

DataTable.AddSheet("DataBase").AddParameter fields.Name, ""

next

' Update the data table with the values from the database.

rcRecordSet.MoveFirst

iRow = 1

do

Datatable.SetCurrentRow iRow

DataTable.Value("Flight_Number","DataBase") = rcRecordSet.fields("Flight_Number")

DataTable.Value("Order_Number","DataBase") = rcRecordSet.fields("Order_Number")

DataTable.Value("Customer_Name", "DataBase") = rcRecordSet.fields("Customer_Name")

' etc.

iRow=iRow+1

rcRecordSet.MoveNext

loop until rcRecordSet.EOF

How do you read a text file and write to text file?

* Adding Data to the File

* ++++++++++++++++++

Once the text file is created, add data to the file using the following three steps:

Open the text file.

Write the data.

Close the file.

To open an existing file, use either the OpenTextFile method of the FileSystemObject object or the OpenAsTextStream method of the File object.

To write data to the open text file, use the Write, WriteLine, or WriteBlankLines methods of the TextStream object, according to the tasks outlined in the following table.

Task Method

Write data to an open text file without a trailing newline character.

Write

Write data to an open text file with a trailing newline character.

WriteLine

Write one or more blank lines to an open text file.

WriteBlankLines

To close an open file, use the Close method of the TextStream object.

Sub CreateFile()

Dim fso, tf

Set fso = CreateObject("Scripting.FileSystemObject")

Set tf = fso.CreateTextFile("c:\testfile.txt", True)

' Write a line with a newline character.

tf.WriteLine("Testing 1, 2, 3.")

' Write three newline characters to the file.

tf.WriteBlankLines(3)

' Write a line.

tf.Write ("This is a test.")

tf.Close

End Sub

Reading Data from File

++++++++++++++++++

Sub ReadFiles

Dim fso, f1, ts, s

Const ForReading = 1

Set fso = CreateObject("Scripting.FileSystemObject")

Set f1 = fso.CreateTextFile("c:\testfile.txt", True)

' Write a line.

Response.Write "Writing file
"

f1.WriteLine "Hello World"

f1.WriteBlankLines(1)

f1.Close

' Read the contents of the file.

Response.Write "Reading file
"

Set ts = fso.OpenTextFile("c:\testfile.txt", ForReading)

s = ts.ReadLine

Response.Write "File contents = '" & s & "'"

ts.Close

End Sub

What is the latest version of QTP?

* QTP 8.2

*

What are the file extensions QTP allows you to add?

* .vbs (library)

* -tsr (object repository)

* .xls (Data File)

* .scr (recovery scenario file)

Questions about QTP:

1. What are the two operations that you can perform in Keyword View and not Expert View?

* Action Parameterization

* Checkpoints

2. What is the difference between reusable actions and functions?

a.

3. What can the active screen be used for in QTP?

4. Can you parameterize data variables (and not checkpoints) in your test case using Active screen?

5. What is the difference between normal and fast run modes of QTP?

6. What mode is QTP running in when you call a test case in QTP from QC?

7. Can you make QTP run in fast mode when calling the QTP test from QC?

8. Give me a scenario each for Step Into, Step Over and Step Out operations in QTP.

Questions about VBScript:

1. What is the difference between Dim and Redim?

a. Dim is to declare a variable.

b. Declares dynamic-array variables, and allocates or reallocates storage space at procedure level.

2. What does the command “Redim Preserve” mean?

a. Preserves the data in an existing array when you change the size of the last dimension.

3. What is the difference between Procedure and Function? a. In VBScript, there are two kinds of procedures; the Sub procedure and the Function procedure.

Sub Procedures

A Sub procedure is a series of VBScript statements (enclosed by Sub and End Sub statements) that perform actions but don't return a value. A Sub procedure can take arguments (constants, variables, or expressions that are passed by a calling procedure). If a Sub procedure has no arguments, its Sub statement must include an empty set of parentheses ().

The following Sub procedure uses two intrinsic, or built-in, VBScript functions, MsgBox and InputBox, to prompt a user for information. It then displays the results of a calculation based on that information. The calculation is performed in a Function procedure created using VBScript. The Function procedure is shown after the following discussion.

4. Sub ConvertTemp()

5. temp = InputBox("Please enter the temperature in degrees F.", 1)

6. MsgBox "The temperature is " & Celsius(temp) & " degrees C."

7. End Sub

8. Function Procedures

9. A Function procedure is a series of VBScript statements enclosed by the Function and End Function statements. A Function procedure is similar to a Sub procedure, but can also return a value. A Function procedure can take arguments (constants, variables, or expressions that are passed to it by a calling procedure). If a Function procedure has no arguments, its Function statement must include an empty set of parentheses. A Function returns a value by assigning a value to its name in one or more statements of the procedure. The return type of a Function is always a Variant.

10. In the following example, the Celsius function calculates degrees Celsius from degrees Fahrenheit. When the function is called from the ConvertTemp Sub procedure, a variable containing the argument value is passed to the function. The

result of the calculation is returned to the calling procedure and displayed in a message box.

11.Sub ConvertTemp()

12. temp = InputBox("Please enter the temperature in degrees F.", 1)

13. MsgBox "The temperature is " & Celsius(temp) & " degrees C."

14.End Sub

15.

16.Function Celsius(fDegrees)

17. Celsius = (fDegrees - 32) * 5 / 9

18.End Function

a.

19. How can you make a Procedure return a value?

20. Given a string x = “My order number is 12345”, how do you extract the order number from the string x? Give two solutions.

a) SubStr functions --- Split and Right

21. With the same question above, if the order number is varying and is not fixed how does your solution change?

By parsing regular expression and by find method( to find the pattern)

22. Given an application with a Listbox of 4 items: The 4 items should be New Delhi, Mumbai, Chennai, and Bangalore. How do you write a script to see if the four cities listed above appear in the Listbox? There can be scenarios where New Delhi is listed in the Listbox twice and Mumbai doesn’t list out in the Listbox. The script should detect if the 4 cities are listed in the Listbox or not.

GetItemCount

GetRO/TO property of list box and then verify it with if /else statements to make sure there is no duplication.

Questions about Automation Framework:

1. What kind of Automation Frameworks have you worked with?

2. Have you ever developed an Automation Framework?

3. Why is Keyword Driven Automation Framework called so?

Black Box Testing

Requirement for QA Black Box
1.SQL
2.SOAPUI
3.UNIX
4.Quality Center (QC)
5.QuickTime Professional (QTP)