Monday, November 22, 2010

More Interview Questions

Interview Questions for QTP

1. What kinds of test automations were you involved in? What is an automation initiative you liked most, that you have been part of? Explain it

Ans:-- I was involved in the Functional Automation using QTP and Performance testing using Load Runner.

During regression testing My Application required entering 1000 trades a day with a fixed set of data and only 3 recourse . Each trade manual trade input required 3 mins. The time consumed for the trade entry was 3000mins. My team had to work extra hours daily to achieve the most possible nearest target. So to reduce the trade entry manually I suggested my team lead to fix a meeting with the client and convience them for manuall testing . After the current release I created a script in QTP wher I read the data from the Excel and entered in the application. After each trade I check the Database for the result. Exported the Oracle datatable in the excel sheet and verified the actual result with the expected.

Due to automation the trade entry was happening very fast . and the application was not behaving as expected . So I suggested for the performance test using Load runner . Recorded the manual trade entry and replayed the script . Did the graph analysis and sent the report to the environment team.

2. What general approach you used for creating automated scripts?

The Approach was Modular framework . Did the Scripting for each module , Like trade entry, Back office checks and Datain the DB .

3. Did you implement any specific automation frameworks? If yes, please explain how you implemented it?

FrameWork :- Is the approach in which you are going to do the scripting of the application . The frame work has to be Scalable, Reusable and Maintainable.

My team lead had given me the option of Functional decomposition framework and Modular frame work . I selected to implement the modular framework as the application I was working on had lot of lot of Different functionality and more variety of test data. My application was to enter different types of Foreign Exchange trades, Check the Confirmation and settlement messages, Check the transfers . So I created modules for entering different trades with different set of data. Module for Checking the Messages depending on the trade entered . And module for Checking the Transfers. Called all this module from a driver script as required .

Modular frame work analyze the application under test in terms of business functions and creating re-usable scripts called modules which takes care f the functions independent of the one another. The actual script will call the function as needed.

As data driven is the part of modular approach it provides re-usablity of main scripts across multiple data set. Modules are highly parameterized. Parameterization is a process of replacing fixed recorded data/values with variables so that they can be assigned different values as needed.

In summary Modular frame work involves creating reusable scripts that perform the business functionalities . does the validation. Accepts and produce variable data. Modular framework are the building blocks using which actual test scripts are created quickly and yet retain the control on the logical data. This way Modular approach facilitates rapid test scripts building abd easy maintainability

4. Can you explain the difference between data driven approach and modular framework of automation

Modular Framework is Suitable for application that have variety of functionality and large number of variation in terms of test Data.

Data Driven Framework :- is suitable for the application having less functionality and large number of variation in the test data .Data Driven can be hard coded values.

5. What is parameterization and why it is necessary?

Parameterization is the process of passing the Data to the object. Lets take a example where you have to login to a page to get in the application . If there was no parameterization then we would have executed the script with the same data , and executing the script with the same data is of no use if automation is there. So to datadrive we have to parameterize .i.e. we have to make the constant value as parameter, so that in each iteraration(cycle) it takes a value that is supplied in run-time datatable. Through parameterization only we can drive a transaction(action) with different sets of

6. How do you match automation tool’s execution speed with application’s response time?

This is always the case , the automation tools script runs faster than the application’s reponse time to control them we have to get the application and the tool in synchronization with each other . In QTP this can be done by inserting the synchronization point or by instructing QTP to wait for a specific time. Or check if the object or page or component we are testing exist , wait and then proceed

7. Explain your automated script execution background – How often you executed, execution in un-attended mode, how you reported results etc

I am working on the automation tools from last 3and a half years. I have worked with QTP. There is always an requirement to run the script on Saturdays and Sundays when the application is in the golive or production phase. So to achieve this I created a “.VBS” file did a do until loop with the required date and time . Created a QTP application object ,launched it , opened the script I want to execute , after opening run the script.

Below is the code to achieve the same.

Do until sNow>#02/22/08 4:32 PM#

sNow=Now

Loop

Set o1=CreateObject("QuickTest.Application")

o1.Launch

o1.Visible=True

o1.open "C:\Documents and Settings\scalartest\Desktop\Test2\"

o1.test.run

In the script I had used Reporter.Reportevent.

8. When do you suggest that a test team should consider using test automation?

There are different condition when the test team decides to go for automation

1)When different functionality is to be tested with different set of data. And when the testing is repeatable .

2) When there is limited time and there is lot of to testing to be done. Also if the application has to go in for a release ASAP.

3) When there is a recourse crunch. So to improve the productivity of human testing

9. What are the criteria for selecting the tests for automation?

ANS ?????

10. What is the single most important reason for failure of automation projects and how do you propose to overcome them?

In Most of the cases the failure for automation project is due to the instability of the Application . Its always preferred that we should go for automation only if the application under test is stable.

VB Script

1. How do you make variable declaration mandatory in VBScript?

To make a variable declaration Mandatory we have to use the “Option Explicit “ Statement . The “Option Explicit “ statement should be the first statement in your script.

2. What is the difference between regular arrays and dynamic arrays in VBScript?

Regular Array can be of 2 types One and two dimensional. The regular arrays once declared do not change there size. As its declared with the number and size of the array in the parathesis

Eg Dim Regular_array(2)

Dynamic Arrays :- Arrays whose size changes during the time your script is running. For a dynamic array no size or number of dimensions is placed inside the parantheses For eg :-

Dim dynamic_array()

3. How do you re-size an array without loosing its existing elements?

If we have to user a re-sizable array then it has to be dynamic . And to achieve this we shud declare the array with the keyword “ReDim “ instead of Dim

Eg ReDim Dynamic_array()

4. How constants are created in VBScript?

Constant as the name specifies never changes its value. There are 2 types of constants , Built-in or Intrinsic constants eg date , VbYesNo and User defined constants.

We can create user defined constants by using the “Const” Statement.

5. What is the difference between Do While and Do Until loops

The Do While loop will execute as long as the condition is true. Where as the Do Until Loop will execute until the condition becomes true.

6. When do use For Each…Next kind of loop?

The For Each Next loop will execute a statement ot group of statement for each element in the array.

Eg For Each element In group

Statements

NEXT

7. What conditional statements in VBScript are you familiar with?

Conditional statements are used to programmatically make decisions inside the scripts. There are two types of Conditional statements available in VBScripts.

1) If Then Else End IF . There are variation in the IF Then Else statements

Eg:- If Then

Else IF Then

End IF

2) Select Case.

Eg Select Case

Case

Statements

Case

Statements

Case Else

Statements

End Select

8. What kind of loop in VBScript can not terminated pre-maturely?

The loops in which the Exit is not used cannot be terminated pre-maturely.

ANS ???

9. How do you convert a string “40000” into a number?

By Using the Int function eg.Int(String).. will convert the String to a number.

10. What is the purpose of split function?

Split function is used to break a string into Sub strings. It returns a zero based One dimensional array

11. What is the difference between a sub and function in VBScript?

Sub does not return a value . And a Function can

While calling a Sub Procedure that accepts one or more arguments, Do not Use parenthesis around the arguments. But if you are calling a function with one or more arguments , the arguments should be enclosed in parenthesis.

If a function is written to return a value then the calling statement shud capture the value. Else vb will treat it as a sub procedure.

12. Did you create any functions in VBScript? If yes, please explain some examples?

ANS ???

13. What is dictionary object and when do use it?

The Dictionary object works somewhat similar to an array .

In arrays, items are stored in form of element index and element value

In dictionary items can be stored in any form of data and are stored in array

In array to retrieve a value we have to use the index.

In dictionary the unique key is used to retrieve an individual item .

If we want to retrieve a particular item in a array and we don’t know the index of the item then I have to iterate thru each item in the array finds its value , compare/verify it with the required value

If I want to retrieve a item in the dictionary then the key is used to retrieve the item . the key is usually a integer or a string

Properties :--Count, Item and Key

Methods :--Add , Exist, items , keys, Remove and remove All

14. "What is a regular expression? What meta characters you used to represent

a. zero or more characters

b. One or more characters

1) Regular Expression is a mechanism to select specific strings from a set of character srings. Regular Expression is set of characters, metacharacters, and operators that define a string or group of strings in a search pattern

a) Zero or More characters * is used.

b) One or More characters + sign is used .

SQL

1. What is primary key?

A column in a table whose values uniquely identify the rows in the table. A primary key value cannot be NULL.

A primary key is a column with a unique value for each row. Each primary key value must be unique within the table. The purpose is to bind data together, across tables, without repeating all of the data in every table.

In the "Employees" table below, the "Employee_ID" column is the primary key, meaning that no two rows can have the same Employee_ID. The Employee_ID distinguishes two persons even if they have the same name.

When you look at the example tables below, notice that:

· The "Employee_ID" column is the primary key of the "Employees" table

Employees:

Employee_ID

Name

01

Hansen, Ola

02

Svendson, Tove

03

Svendson, Stephen

04

Pettersen, Kari

2. What is foreign key?

A foreign key (FK) is a column or combination of columns that is used to establish and enforce a link between the data in two tables. You can create a foreign key by defining a FOREIGN KEY constraint when you create or modify a table.

In a foreign key reference, a link is created between two tables when the column or columns that hold the primary key value for one table are referenced by the column or columns in another table. This column becomes a foreign key in the second table

3. What is a Candidate Key?

A candidate key is a combination of attributes that can be uniquely used to identify a database record without any extraneous data. Each table may have one or more candidate keys. One of these candidate keys is selected as the table primary key.

4 What is inner Join?

All rows from both tables only if there is a match

Syntax:---SELECT Table1.Col1, Table2.Col2 FROM Table1 INNER JOIN Table2 ON Table1.Col2 = Table2.Col2

4. What is outer Join?

All rows from Sec table + Matching rows from First

SELECT Table1.Col1, Table2.Col2 FROM Table1 RIGHT JOIN Table2 ON Table1.KeyField1 = Table2.ForeignKeyField1

5. Tell me a query to select values from the column of a table that are repeated more than once – In other words tell a query to select only values that are duplicated two or more times?

Select Col1 from Table1 where Col1=value.

In the where cause the Column name should not be the primary key of the Table.

ANS ????

6. How do you create a new table at the same time copy all rows from an existing table into the new table?

SELECT * INTO newtablename FROM SourceTablename

OR

SELECT * FROM SourceTable1 AS newTablename

7. How do you copy all rows of data from one existing table into another existing table

SELECT * INTO Existingtable FROM SourceTablename

ANS ?????

8. How do you delete a table from database

DROP TABLE tablename

9. What is an ODBC data source name?

ODBC is an Open DataBase Connectivity. It provides an Application Program Interface (API) for using Database management systems (DBMS)

ODBC provides an open way of accessing data stored in a variety of proprietary personal computer, minicomputer, and mainframe databases. With ODBC, application developers can allow an application to concurrently access, view, and modify data from multiple, diverse databases.

ODBC is a core component of Microsoft Windows Open Services Architecture.

ODBC is a specification to which developers write either:

An ODBC-enabled "front-end" or "client" desktop application, also known as an "ODBC Client." This is the application that the computer-user sees on the computer screen.

-or-

An ODBC Driver for a "back-end" or "server" DBMS (Database Management System). This is the DBMS application that resides on a computer that is used to store data for access by several users. This application is not what is loaded on the end user's computer. This server application is usually more robust (faster, with centralized security, and backups of data, and so forth) than the client application. The ODBC Driver resides between the ODBC Client and the DBMS; however, it is loaded on the front-end computer.

To use ODBC, the following three components are required:

ODBC CLIENT - an ODBC-enabled front-end (also called ODBC client) - Examples: Microsoft Access, an application created with Access, an application created with Microsoft Visual Basic, an application created with C+Win SDK+ODBC SDK, or ODBC-enabled applications from other vendors (such as Lotus).

ODBC DRIVER - an ODBC Driver for the ODBC Server. The ODBC Driver Catalog contains an extensive listing of ODBC Drivers. For example, the Microsoft ODBC Driver Pack is a collection of seven ODBC Drivers ready to be used or bundled with ODBC clients

Any ODBC client can access any DBMS for which there is an ODBC Driver. DBMS SERVER is a back-end or server DBMS, for example SQL Server, Oracle, AS/400, Foxpro, Microsoft Access, or any DBMS for which an ODBC driver exists.

10. What types of data source names can be created in Windows OS?

i. User DataSource Name:--A ODBC User data source stores information about how to connect to the indicated data provider. A user data Source is only visible to you and can only be used on the Current machine

ii. System DSn:--A System Data source is visible to all user currently on the machine.

iii. File DSN:-an ODBC file Source allows you to connect to the a data provider . File DSN can be shared by the users who have the same driver installed .

iv. Driver DSN:-ODBC Drivers allows ODBC enabled programs to get information from ODBC data source

QTP

1. Explain the structure of a QTP script

The structure of the QTP script shud be in such a way it shud have the rapid test building capabilities, data driven Capability , Test data maintainace shud be easy and shud have a centralized execution control and automatic report generation All this can be achieved by the modular framework structure , so the script structure depends on the framework we are following . A modular framework has a Driver script, Module , Configuration Data , Common Function Library, test Data . The Driver script call the Module. Modules contain function which call the Common Function Library. The Global Configuration data is provided to the Driver script. The Driver script sends the query to the data base , retrives data and also reports the execution result to the DB.

2. What is object repository and explain different modes, which mode you prefer and why?

Object repository is a file having the information of the objects which QTP has learned. When QTP learns the object it assigns a logical name to the Object, with this logical name it associates some properties which helps to recognize the properties during the test Run(execution).It looks at the object and stores it as a test object determining in which class it fits. Its learns the mandatory properties these are the default properties. Its first learns the Mandatory properties .if the object is not uniquely identified with these properties then it learns the assistive properties.If no assistive propertiethuls are available with the object or if they are not enough then it learns the ordinal identifier.

There are 2 types of Object repository mode
1. Shared object repository :-In this mode you can use one object repository file for multiple test or components
2. Per action repository:-In this mode QTP automatically creates an object repository file for each action in the test. Object repository per action mode is not available for components

3. What is synchronization and explain one or more ways in which it can be achieved in QTP?

Synchronization is a techinique to manage the time interval between your script and application. Because any testing tools runs the recorded scripts in milliseconds but application don't give the response accordingly that’s why its necessary to use the synchronization point.If you don’t want QTP to perform a step until an object in your application reaches a certain state the sync point shud be inserted.

1)Synchronization can be achieved by inserting the syn point , on the menu bar goto Insert->Step->Synchronization point. Point to the object where u want ot insert this point .

2)Also we can insert Exist and wait statements in the script to instruct QTP to wait until the object exist . The exist statements return a boolean value 1 if object exist or 0 if not. Wait statements wait for the time specified

You can change the the timeout value by going to Test->Settings->Run

4. What is the difference between Test Object Properties and Run Time Object Properties?

TEST Object

RUN TIME Objects

Test Object is maintained by QTP for the object created by QTP

Run Time objects are maintained by the Creator of the Object

QTP captures test object properties and method while recording . And performs when your test or Component runs

Run time object methods or properties are the methods of the object in ur application as defined by the object creator.

Test bj properties are the properties whose values are captured from the object in ur application or website or component. QTP uses the values of these properties to identify run time objects in ur application during a run session

5. What are the different check points that are available in QTP, which one you used most and why?

Check points are the verification point that compares the current value of a specified property with the expected value of that property.

Types of Checkpoints

1) Standard Checkpont,

2) Image Chk point

3) Bitmap

4) Table chk point

5) Text checkpoint

6) Text area checkpoint

7) Page chk point

8) Database check point

9) XML checkpoint.

Mostly usedcheckpoint

1) Standard check point 95%:--Check the property value of the object in ur application or web page . The standard check points checks variety of objects such as buttons , radio buttons , combo boxes, lists etc. In most of the application I had to check that , an object like radio button or list box or combo gets activated after it is selected . Also I had to check the text in the edit field .all this can be done by the standardcheck point. Standard check points are supported by all add in environments.

2) Text area Checkpoint 2%

3) Text area check point 1%

4) DB

5) XMl

6) Bitmap (the last 3 are used 3%)

6. In the context of QTP scripts, what are the different items that can be parameterized and also explain how they can be parameterized?

Parameterization is a process of replacing fixed recorded data/values with variables so that they can be assigned different values as needed. A Parameter is a variable that is assigned a value from the external data source

There are 4 types of parameters

1) Text , Action or component parameter. Select`the Text , action or Component to parametize

2) Data Table parameter

3) Enviornment Variable parameter

4) Random Number parameter

We can parameterize the values in step and check points while recording or editing . WE can also parameterize the values of the object properties in a selected step . Chose the step ->Object properties or choose the step tools->Object repository.

Or The other way is to parameterize in the expert view by using the “.setparametr(“Parameternam”).

The above answer is not complete.

7. What is descriptive programming and explain when you think it is useful?

In Descriptive programming the objects are not learned by QTP in the Object repository. So Descriptive programming means without maintaining/mentioning the object in the object repository and creating the description in the test script.

It is useful in the early development of the script based on the prototype. It is also useful when the test application is under construction . The automation testers take the requirement of the application from the Business people , discuss the things with the developers . what prototyping they are gonna follow during app development and accordingly create the description of the objects in the script and start scripting . This helps the automation team to start the scripting of the test application in the development phase.

8. Explain the mechanism using which QTP recognizes objects in the application?

QTP learns the object in the application using object repository. First it learns the Mandotory properties of the object. Even if the object is not recognized then it learns the assistive properties . After using the assistive properties if the objects are not recognized then it uses the smart identification base filter properties (if the option is selected) ,even if the object is not identified then it uses the mandatory, assistive + Ordinal identifier. Ordinal identifier identifies the object with 3 types Index, Location and creation time .. After doing all this even if the object is not identified then it’s a Run error.

IF the objects get identified at any step then the script is executed.

9. In a typical script that you have created, what percentage of the script you have recorded versus what percentage you have personally programmed/scripted?

I have recorded 100 % of the test application. And have personally programmed around 75% of the script. I have used the Moduler framework for the programming purpose.

I selected to implement the modular framework as the application I was working on had lot of lot of Different functionality and more variety of test data. My application was to enter different types of Foreign Exchange trades, Check the Confirmation and settlement messages, Check the transfers . So I created modules for entering different trades with different set of data. Module for Checking the Messages depending on the trade entered. And module for checking the Transfers. Called all this module from a driver script as required.

Modular frame work analyze the application under test in terms of business functions and creating re-usable scripts called modules which takes care f the functions independent of the one another. The actual script will call the function as needed.

As data driven is the part of modular approach it provides re-usability of main scripts across multiple data set. Modules are highly parameterized. Parameterization is a process of replacing fixed recorded data/values with variables so that they can be assigned different values as needed.

In summary Modular frame work involves creating reusable scripts that perform the business functionalities. Does the validation. Accepts and produce variable data. Modular framework is the building blocks using which actual test scripts are created quickly and yet retain the control on the logical data. This way Modular approach facilitates rapid test scripts building and easy maintainability

10. What views are available in QTP and which view you use most often?

Tree view and Expert View are the two views available in QTP . I have used both the views . While editing the script I have use the Expert view . And to check if the script has any compilation error I have used the Tree view. As the Tree view shows the syntax error.

11. How do you add checkpoints to a QTP script without using built-in check points?

By using “.check checkpoints()

12. How do you schedule a set of scripts to run overnight?

I have created a vbs script in which I did a do until loop till the required time to run the test is achieved. Then did the following

1)I have created a object of QTP as “Set Obj=Createobject(QuickTest.application”).2)

2)launched the application.3) Checked if application is visible.4)Opened the Test by using obj.test.open (“path name”) and 5) run the app by obj.test.run method. And saved it on my desk top .

13. What is recovery scenario management and how do you implement it in QTP?

ANS ????

14. Explain different types of actions in QTP?’

There are 3 types of action in QTP.

1) Non reusable The action can be called only in the test in which it is stored and can be called only once

2) Reusable Action:-. An action can be called multiple number of times in the script in which it is stored and also in the external script.

3) External Action:- A reusable action stored with another test. External Actions are read only in the calling test.. But you can shoes to use the local editable copy of the data table information for the external action.

15. How do you pass values from one action to another action?

The Values can be passed from one action to other by passing the parameters to the action as the arguments. To do this

Go to Steps->Action Parameter->parameter tab -> click on the + sign and add the parameter you want to pass to the action

16. What is smart identification and when does QTP uses it?

QTP activates the smart identification mechanism during a run session ,if QTP is unable to identify an object based on its recorded description. QTP follows the following process to identify the object

1)QTP forgets all the recorded test object description and creates a new Object candidate list containing the objects that matches all the properties defined in the base filter property list.

2)From the base filter list QTP removes any object that does not match the first property listed in the Optional Filter list. The remaining objects become the new object candidate list.

3)QTP evaluates the new object candidate list.

If the new object candidate list has still more than one object than QTP repeats step 2 for the next optional filter property in the list.

This process goes on until QTP has only one object in the object candidate list. When this is achieved QTP concludes that it has identified the object and performs the statement containing the object

Even after the smart identification QTP does not recognize the object, then it uses the recorded description +the ordinal identifier to identify the object

Answer is not complete ????

17. Explain the ordinal identifiers and their purpose?

In addition to recording the mandatory and assistive properties specified in the Object Identification dialog box, QuickTest can also record a backup ordinal identifier for each test object. The ordinal identifier assigns the object a numerical value that indicates its order relative to other objects with an otherwise identical description (objects that have the same values for all properties specified in the mandatory and assistive property lists). This ordered value enables QuickTest to create a unique description when the mandatory and assistive properties are not sufficient to do so.

Eg My web based application had redirectional pages . TO recognize the child page of the main page I have used the Ordinal Identifier.

Ordinal Identifier identifies an object by it creation time , Location and Index.

18. How do you report custom messages in QTP?

By using the Reporter.Reportevent , we can report the custome message in QTP

Check answer

19. how do you change the properties of an object in the object repository during run-time

Properties value of the application may change dynamically each time the application opens.So to make the test object property match the run time property value , we can modify the test script manually by setting the property using SetTOProperty.

20. What is the difference between Global sheet parameterization versus Action sheet parameterization?

Global Parameterization

Action Parameterization

Global data parameter take the data from the Global sheet in the data table.

Action parameters take the data from the Action sheet in the data table

Parameters defined in the Global data sheet can be used in any action

Parameters defined in the Action sheet cannot be used for the other action in the test

When a test runs by using the parameters from the action data sheet , the values in the global data sheet stay constant

21. What kinds of environment variables did you use in your QTP scripts?

The are 2 main types of environment variables

1)Built in Variables that represent information about the test and the computer on which the test is run , eg test path , Operating systems . These variables are accessible from all test and

are designated as read only.

2)User Defined

User defined internal variables:--

User defined external variables:--

I have used “User defined Internal Variables”. As these variables are defined with in the test . these variables are saved with the test and are accessible only with in the test in which they are defined. I have modified the internal user defined environment variables for my test in the test settings -> Environment Tab. Or in the Parameter option Dialog box

22. What is the difference between internal and external environment variables?

Few More..

1. What are actions? How many types? Define their type?

There are 3 types of action in QTP.

· Non reusable The action can be called only in the test in which it is stored and can be called only once

· Reusable Action:-. An action can be called multiple number of times in the script in which it is stored and also in the external script.

· External Action:- A reusable action stored with another test. External Actions are read only in the calling test.. But you can shoes to use the local editable copy of the data table information for the external action.

2. How to pass values form one action to another action?

The Values can be passed from one action to other by passing the parameters to the action as the arguments. To do this

Go to Steps->Action Parameter->parameter tab -> click on the + sign and add the parameter you want to pass to the action

3. How to enter data into or retrieve data from the data table from within the script?

WE need to create a  DSN , then Create a object in ur script by using CreateObject(ADODB.Connection). Use the Connection object to open the Data table or Data base created . To insert the data , 
Do a loop for the number of rows in the data datable . Get the last row number and point to the next blank row . In the VB script write a SQL of INSERT INTO table_name (column1, column2,...) VALUES (value1, value2,....)  
 
TO retrieve the data create a DSN connection, Open the data , do a loop , Execute the SELECT SQL query .  store the data in a data field 

4. How to create a action template?

To create an action template:

· Create a text file containing the comments, function calls, and other statements that you want to include in your action template. The text file must be in the structure and format used in the Expert View.

· Save the text file as ActionTemplate.mst in your '[QuickTest Installation Folder]'\dat folder. All new actions you create contain the script lines from the action template.


Note: Only the file name ActionTemplate.mst is recognized as an action template.

5. What is a object model, give few examples

we can close Qtp from Qtp by using the Automation object

model.

Automation object model is nothing but collection of objects, methods and properties which are used to perform quicktest operations. Throught this object model we can

perform any operation described in QTP interface.

For every option in QTP menus(Interface) have Objects, methods and properties are there in this model.

Eg: dim qtApp

set qtApp=createobject("QuickTest.Application")

qtApp.Launch /*It launches the QTP

qtApp.visible= "true" /* Qtp is visible to us

qtApp.close /* It closes the Qtp

Write the above script in notedpad and save it with .vbs

extension.Open the file and run it.

6. How will you capture a static text from an object?

By using the GetToProperty we can get the static text from an object .

7. What are a child object functions and which scenarios it is useful?

ANS ????

8. How would you handle a situation where the new page presented is dependent on the decision made on the previous page? (Within a same script)

In this situation I will get the run time propertires of the object by using GetROProperties . which is making the decision on the previous page. And then accordingly display the newpage .

Eg If the new page opens after selecting the Check box as Yes on the previous page , Then I will learn the object run time properties and write a IF else loop based on the property.What is the difference detween GetROProperty and GetTOProperty?

9. What is the Activate Method? Give few examples how it can be used?

Active method :- Activates an item in the object’s list

Syntax

VirtualList.Activate Item

Argument

Type

Description

Item

Variant

The item to select from the list. The name (with quotes) or numeric index (without quotes) can denote the item. The first item in a list is numbered 0.

Example

The following example double-clicks on the 4th item in the list.

Browser("Demo of Vo Object").Page("Demo of Vo Object").ActiveX("VoDemoFormX").VirtualList("list").Activate 3

10. Explain, what is a switch/case statement?

case statements is a conditional statement It Executes one of several groups of statements, depending on the value of an expression passed to the Select Case

eg Select Case

Case Expression 1

Case expression 2

Case Else

End Select

If the scripts

11. How many types of custom report messages can be passed to the test log? Which are they?

Tools->Web Event Recording Configuration .

ANS ????

12. If team runs regression model across multiple applications then how to set the testing environment in QTP during run time?

OR Did you ever have to test same application in different environments (Beta, dev, prod etc) ? If so then what issues you came across and how did you resolve them?

13. Object repository?

Þ 16a. How does QTP recognizes object uniquely?

Þ OR

Þ 16a. Which attributes are used by QTP to uniquely identify an object?

14. Centralized object repository Vs Per script object repository advantages and disadvantages? Your preference?

15. What is keyword driven testing or keyword driven framework?

16. What are environment variables? How many types?

17. Give few examples of system defined environment variables?

18. How to initialize and reinitialize arrays in QTP?

Arrays are of 2 types , Static and dynamic array . we have to declare the array as

Dim array(3) :-- is of type static

Or Array() dynamic to reinitialize we shud use the Redim array() but to preserve the contents of the dynamic array at the time of initialization use the keyword Preserve

Eg:-- Initially the array of size Redim (25) but the reinitialize the array use the Redim Preserve array (30)

19. How to retrieve boundaries of an array?

To retrive the boundaries of an array we can use the UBound and Lbound Function

20. How to get the innerText of a cell within a WebTable?

To get the inner text of a cell from the web table we have to do the following

1)Get the number of rows of the web table. You can get the row count by using .Rowcount or GetRoProperties(“rows”)

2)Get the Column count by using colunmcount

3) Do 2 nested “for” loop . Outer for the rows and inner for the columns

4)In the inner “For” loop get the Cell data by using GetCelldata(Row,Column)

5) Do a IF else statements to check the expected data with the actual cell data by using Instr function in the if statement

eg:- if Instr(Trim(Ucase(MyCellData)),"REGISTER") Then

6)exit for

7)Next ,next for both the for loops

21. How to get a substring from a string

We can use the string.substring method

Eg Dim myString As String = "abc"

Dim test1 As Boolean = String.Compare(myString.Substring(2, 1), "c") = 0 ' This is true.

myString.Substring(3, 1) ' This throws ArgumentOutOfRangeException.

Dim test2 As Boolean = String.Compare(myString.Substring(3, 0), String.Empty) = 0 ' This is true.

IMP Site :--

http://quicktestprofessional.wordpress.com/category/uncategorized/

http://www.techinterviews.com/?p=310