Interview Question For QTP

Note: Before going to interview to any of below company never assume that u will get same questions, always remember company don’t have interview questions, interview questions are coming from interviewers mind. Different interviewer of same company will have different questions, as they have different mind.

TCS ::>

1.What is synchronization ?
Answer of this in QTP Helpfile -> synchronizing the test

2.How do  you sync qtp with qc ?
Open QTP -> File -> Quality Center Connection -> Place QC Server Path
To use resources like library file we can directly mention QC path of library file, instead of absolute path.
U can avoid such question by telling her to run QTP we use excel if u dont have idea ab QC

3.Write down the syntax for dynamic DP and static DP ?
Present in book

4. What are checkpoints ?
Same question is present in our book -> interview question

5.How can you run number of testcases in qtp at one time ?
With help of MTM(bundled software with QTP) or with excel or we can run all test cases present in folder of QC

6.What are the various ways in which you can use the data from datatable in your script ?

In Helpfile go throught DataTable Section,
1. ImportSheet -> to import excel data in QTP
2. Directly inserting values in DataTable




BNP Paribas ::>

1. I have a root directory.. It has some sub-folders and sub-folders have some files. How to calcualte the number of files that sub-folder have. using VB scripting

Answer:
'Call To Function
ShowFolderList "C:\Users\Public\Music\Songs\Bol Bachchan (2012)"

'Function Defination
Function ShowFolderList(strFolderPath)
  Dim fso, f, f1, s, sf
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set f = fso.GetFolder(strFolderPath)
  Set sf = f.files
  MsgBox sf.Count
  For Each f1 in sf
 MsgBox f1.Name
  Next
  ShowFolderList = s
End Function

Helpfile-> Files property

One Line answer will be using "Scripting.FilesystemObject" and then using .files property

2. Number of occurances of a character in a given string.

intOccu=0
intPos=1
Do
intNum=Instr(intPos,"QTP Guru is In Thane - Mumbai","u",1)
If intNum>0 Then
intOccu=intOccu+1
End If
intPos=intNum+1
Loop Until intNum=0

MsgBox intOccu

One line answer will be using Instr

3. Given a page having some links with checkboxes. I want to check only 2nd checkbox each time the script is played.what is the VB script code for it.

Use index property for checkboxes

4. What is the function to connect QTP with the QC.

One Line Answer will be using TDConnection property

HelpFile -> TDConnection

Use TDConnection Object.

Example:

‘ Create the QuickTest Professional application object.
Set qtqcApp = CreateObject(“QuickTest.Application”)qtqcApp.Launch ‘Launch QTP
qtqcApp.Visible = True ‘Make it visible

‘Connect to Quality Center

‘qtqcApp.TDConnection.Connect <QC Server path>, <Domain name that contains QC project>,_
<Project Name in QC you want to connect to>, <UserName>, <Password>,_
<Whether ‘password is entered in encrypted or normal. Value is True for encrypted and FALSE for normal>

qtqcApp.TDConnection.Connect “http://QualityCenterServer/tdbin”,“FR”, “Flights”, “learnqtp”, “welcome”, False

5. What is regular expression?

It is way of representing symbols.They are often used within matching, searching or replacing algorithms.

It is used to identify objects and text strings with varying values.

6. Write regular expression for date?

Date Regular Expression:



Format: MM/DD/YYYY

MM: (0[1-9]|1[0-2])

DD: (0[1-9]|1[0-9]|2[0-9]|3[0-1])

YYYY: ([0-9][0-9][0-9][1-9]|[1-9]000|[1-9][1-9]00|[1-9][1-9][1-9]0)

* Assuming that Max year is 9999



7. In Web table click on link where link column is fixed but row will changing?

In above case u have to search link object in this column all rows and click link.



8. What is ordinal identifier?

If mandatory  and assistive properties are insufficient to identify an object during record session ,QTP uses Ordinal Identifier in addition to other captured properties to identify the objects during a record session
By default, an ordinal identifier type exists for each test object class.
In the Object Identification Window, you can modify the default Ordinal Identifier for an Object
There 3 types of Ordinal Identifiers
1) Index based
2) Location based
3) Creation Time


9. What is Index property?

Cover in above answer





In Other Companies::>

1.       What is "Dictionary Object"?

Ans: Dictionary Objects are the perl arrays. In arrays we store the values based upon the index i.e. 0,1,2 but here we can store the values based upon the names i.e. keys. Each value is stored corresponding to the unique keys. Dictionary object that stores data in key, item pairs.
Search Helpfile with Dictionary Object



2. What are Output Values, where & how it is used and what are types of it?

Ans: An output value step is a step in which one or more values are captured at a specific point in your test and stored for the duration of the run session. The values can later be used as input at a different point in the run session.
Search Helpfile with Output Value

3. What is "Synchronization Point" ?

And : To instruct QuickTest to pause the test or component until a particular object property achieves the value you specify, you can insert a synchronization point.
Search Helpfile with Synchronization Point .

4. What is "Test Fusion Report"?
Ans: This is nothing but result generated after end of Test Case. This can be even access by Automation -> Results

The Test Fusion report is used to display all the aspects of test run, it specifies where the application failures occurred, the test data used, the detailed explanation of every checkpoint stating pass or failure and the application screen shots of every step by highlighting the discrepancies.

5. What is "Step Generator"?
Ans: Step Generator enables you to add steps by selecting from a range of context-sensitive options and entering the required values.
For Details : Refer HelpFile

6.  What is Start Transaction & End Transaction and where it is used?
Ans: During the test run, the StartTransaction step signals the beginning of the time measurement. The time measurement continues until the EndTransaction step is reached. The test report displays the time it took to perform the transaction.

7.   Which Version of Quality Center & QTP are you using?
Ans: QC: 11 and QTP 10.2




Morgan Stanley::>

Question: when you dont know an answer how we shud react positively
Ans: When u dont know answer, u just say i hv not gone through this, if u try to react positively, interviewer will easily catch u

1.Write a code to Count the no. of text boxe in a page.
Ans: This we have cover in Dynamic DP:
1. Goto Flight reservation window of Flight Reservation Application
2. Run Below code

Set objProp=Description.Create
objProp("Class Name").Value="WinEdit"

Set objChild=Window("text:=Flight Reservation").ChildObjects(objProp)

MsgBox objChild.Count



2. What is a micclass of a checkbox
Ans: Micclass is nothing but "Class Name", if u object spy on checkbox in flight reservartion window u will find this as "WinRadioButton"

3.Diff between shared repositroy and per action repository
Ans: This is nothing but difference between Local and Shared reposiotory, if u search on net, u will easily get answer of this question

Please visit following pages for same
4.I have username(cluomn 1) and paasword(column 2) in an excel sheet .Count them and print them withhelp of QTP
Ans:
1.U have to Open excel with help of code which we have in book
2.after opening Excel please write following code:

   For i = 1 To ActiveSheet.UsedRange.Rows.Count
       MsgBox ActiveSheet.Cells(i, 1).Value & ActiveSheet.Cells(i, 2).Value
   Next
Interviewer evaluated u r VBS knowledge with this question

5. Explaind the various synatx asscosiated withe datatable
Ans:
a.Goto Helpfile Type "DataTable" make sure there is no space between Data and Table
b. We have already seen Value and SetCurrentRow
c. U can try other commands to know more about them, thr names are selfexplanatory



6.I have a  main action 1 in the which i pass valuse to action 2 and in action 2 i do summation of the values menas add(i,J) and return teh sum to action1 .How this can be done write the code.How can i pass values and retuen value from one action to other action

Ans: We have conver this in following Topic
           Parameterize Test -> Test/Action Parameter

7.Automation Test Estimation.How willu do?

Ans: Please visit following page

8.Documnet Object Model and Virtual object.
Ans: This thing we have not cover in our syllabus but concepts are very simple

Please refer sites shown for each of topic

9.Do i need to writre on error resume next on evry line of code.
Ans: As we seen in lectures, if we write "On error Resume Next" this enables error handling for all code below it.

We no need to write it again and again.

To disable error handling again, write "On error Goto 0"

10.What i will do if my object is not at all detected by QTP by any method.
Ans: This means TestCase is not feasible to Automate

11.write a test in which i will pass value of year to the function and it will return ifo that whther its a leap year or not to the main test and print that thing  in the mail test.

Ans: Please try this code, u can write function in Function Library to make it reusable

boolVal=LeapYear(23)

If  boolVal Then
MsgBox "Its Leap Year"
Else
MsgBox "Its not a Leap Year"
End If

Function LeapYear(intYear)
If  intYear mod 4=0Then
LeapYear=True
Else
LeapYear=False
End If
End Function



Capgemini::>

1. Write a function to select a item in a listbox and handle the error if the item name is not present in the dropbox.
Ans: This is nothing but in Flight Reservation window when we click on Flight Button, u object spy on Opened Window, u will get it as WinList

Just record script for same thing, u will easily come to know, how to select item.

Error like Item name is not present can be verified by "If" Condition
2.What is a webtable
Ans: WebTable is Table on WebPage

3.what is option explicit.
Ans: While practice we have used Variables with out declaring with help of Dim, but when we write Option Explicit we wont able to use variables unless and until we declare with help of Dim.

Option explicit is used to make good coding practice.



Accenture::>

1. There are four buttons on webpage in four corners, we want to click only the button displayed in top left most corner. I am attaching html page for your help.

Ans: This is little tricky,find out X, Y coordinates of all button with help of DP and which buttons have minimum X and Y co-ordinate must be in TOP LEFT corner

2. Is it possible to make the WebEdit enabled at runtime in qtp. I tried this and think that it will not be allowed.
Ans: If button is disable, we cant make it enable.

2 comments :

  1. Hey Rebeka,

    I own this blog,
    R u working on QTP currently, if yes, how much experience u have?

    ReplyDelete
  2. I get a lot of great information from your blog. Thank you for your sharing this informative blog. I have bookmarked this page for my future reference.

    Regards...
    Hacking Course in Chennai

    ReplyDelete