Basic funda of QA (Testing )

"No Standards for Testing only the Best Practices"
Showing posts with label QTP. Show all posts
Showing posts with label QTP. Show all posts

Wednesday, October 22, 2008

Difference between QTP 8.2 and QTP9.0 / QTP 9.2

In this post, i just presents few differences between 8.2 and 9.2 versions.

Mercury Screen Recorder:

Capture your entire run session in a movie clip or capture only the segments with errors, and then view your movie from the Test Results window.

Dynamic Management of Object Repositories:

QuickTest now has a new Repositories Collection reserved object that you can use to programmatically manage the set of object repositories that are associated with an action during a run session.

Over and above features provided with QTP 8.2 , QTP 9.0 provides following features:

Object Repository Manager:

You can use the Object Repository Manager to manage all of the shared object repositories in your organization from one, central location. This includes adding and defining objects, modifying objects and their descriptions, parameterizing test object property values, maintaining and organizing repositories, and importing and exporting repositories in XML format.

You can open multiple object repositories at the same time. Each object repository opens in its own resizable document window. This enables you to compare the content of the repositories, to copy or move objects from one object repository to another, and so forth.

Object Repository Merge Tool:

You can use the Object Repository Merge Tool to merge the objects from two shared object repositories into a single shared object repository. You can also use the Object Repository Merge Tool to merge objects from the local object repository of one or more actions or components into a shared object repository.

When you merge objects from two source object repositories, the content is copied to a new, target object repository, ensuring that the information in the source repositories remains unchanged.

If any conflicts occur during the merge, for example, if two objects have the same name and test object class, but different test object descriptions, the relevant objects are highlighted in the source repositories, and the Resolution Options pane details the conflict and possible resolutions.

Multiple Object Repositories per Action or Component:

QuickTest provides several options for storing and accessing test objects. You can store the test objects for each action or component in its corresponding local object repository, which is unique for each action and component. You can also store test objects in one or more shared object repositories that can be used in multiple actions and components. Alternatively, you can use a combination of objects from the local object repository and one or more shared object repositories. You choose the combination that matches your testing needs.

XML Object Repository Format:

QuickTest now enables you to import and export object repositories from and to XML format. This enables you to modify object repositories using the XML editor of your choice and then import them back into QuickTest. You can import and export files either from and to the file system or a Quality Center project (if QuickTest is connected to Quality Center).

Function Library Editor:

QuickTest now has a built-in function library editor, which enables you to create and edit function libraries containing VBScript functions, subroutines, modules, and so forth, and then call their functions from your test or component.

Handling Missing Actions and Resources:

Whenever a testing document (test, component, or application area) contains a resource that cannot be found, QuickTest opens the Missing Resources pane and lists the missing resource(s). For example, a test may contain an action or a call to an action that cannot be found; a testing document may use a shared object repository that cannot be found; or a testing document may use a object repository parameter that does not have a default value. In all of these cases, QuickTest indicates this in the Missing Resources pane, enabling you to map a missing resource to an existing one, or remove it from the testing document, as required.

Source: What's New in Quick Test Professional--QTP Documentation

Monday, September 22, 2008

31) How to make QTP to recognise the activeX controls

1) In the Expert View, you can use the Object property to activate the method for an ActiveX control. The list of available methods depends on the ActiveX control.

2)QuickTest records and runs steps on ActiveX controls as it does on any other object.

Using the Insert>Step Option , we can activate ActiveX control methods, retrieve and set the values of properties and check the object exists.

It is recommended that to begin recording session before opening the application containing the ActiveX controls on which you want to record.

32) what to do if the tree view is not recognised by QTP

U've something called "Object Mapping" under Object Identification. This is only for Standard Windows Class. U can map the Tree View to WinTreeView and then try recording. It works.

33) what is meant by external files in QTP.

.vbs files are called as external files.

.Vbs,Excel,dlls and any other files that for importing,Processing and Resulting can be treated as External files in QTP

34) what is keyword driventest ?


Keyword driven test has been introduced in QTP 8.0. Its like tree view. Keyword driven implies that the script can be created easily through keyword View.

35) How can an object from a per action repository be called to another per action repository?

It is possible through shared repository only

36)How you write scripts in QTP? What's the main process in QTP? How do you run scripts in QTP?

Main process in QTP is Recording, stores the properties in object repository then Running the script and then Test Results.

Recording: QTP 'looks' at the object on which we are recording and stores it as a test object, determining in which test object class it fits like standard window dialog box or web button etc. Then for each test object class, QTP has list of mandatory properties that it always learns. When we record an object, QTP learns these default property values, and then 'looks' at the rest of the objects in the page , to distinguish and identify the object uniquely.If not it adds assistive properties , one ny one, to the description, until it has compiled a unique description.If no assistive properties are not available , it adds a special 'ordinal identifier' such as objects location on the screen.

Running the scripts: While running the script, QTP searches for a run time object that exactly matches the description of the test object it learned while recording. If it is not matching, QTP uses ' smart identification' mechanism to identify the object.

We can run the scripts from Test>Run After running the script we can see the Test Results also .

37) What is the command in QTP to invoke IE Brow?

InvokeApplication "The path of the browser EXE file"

The following example uses the InvokeApplication function to open Internet Explorer.

InvokeApplication "E:\Program Files\Plus!\Microsoft Internet\IEXPLORE.EXE"

38) I am new to QTP, please tell me how to invoke an application in QTP.

For Ex:
In winrunner we use syntax's like "web_url_valid, web_browser_invoke", like the same way i want in QTP.

Else please let me know where can i find these syntaxs in QTP. Use SytemUtil Object's Run Method

ex:SystemUtil.Run "iexplore" will open the IE Browser.

39) How would u manipulate the script so that when the test is run it takes a new login name?

External datatable can be used for the login name so that it takes a new login name whenever the test is run. You can parameterize the values in the Gobal data table sheet, whatever the number of rows you enter in this data table will instruct QuickTest to run same number of new login name you've enter. You need to do only parameterize the login window object in object repository and there you need to specify datatable parameter name or else qtp specify default papramter name

40) How can i add a action (external action) programatically?

1) its not possible :( 2)if action is reusable then only u can call only in other test with "runaction" command and in folder option u hv to gv information regarding test from where u r takin action.u can do it programatically also. 3)You can add an external Action programatically using the Command

RunAction ActionName, [IterationMode , IterationRange]

Before you can use the RunAction statement in the Expert View for an external action, you must first call or copy the external action into your test by choosing Insert > Copy of Action or Call to Action. If the external action does not exist in your test, the RunAction statement is not recognized.

Example

The following example calls the SearchFlight action, and runs all iterations of the action.

Call RunAction "SearchFlight", rngIterations, rngAll

41) what is meant by SOURCE CONTROL ?

It is used to hold all the bulids of diff versions

42) how and what kind of Vb functions do u use in qtp?

1. User Defined2. Pre Defined

43) how can u discribe the basic flow of automation with conditional and programatic logic?

I think ur Question is Executing of operators flow in the automation code if the question is that then my answer is

For example:

z = 78 * (96 + 3 + 45)

There are five operators in this expression: =, *, (), +, and another +. According to the rules of operator precedence, they are evaluated in the following order: (), +, +, *, =.

1. Evaluation of the expression within the parentheses occurs first. Within the parentheses, there are two addition operators. Since the addition operators both have the same precedence, they are evaluated from left to right. 96 and 3 are added together first, then 45 is added to this total, resulting in a value of 144.

2. Multiplication occurs next. 78 is multiplied by 144, resulting in a value of 11232.

3. Assignment occurs last. 11232 is assigned to z.

44) HOW CAN I IMPLEMENT ERROR HANDLING IN QTP,I KNOW WITH RECOVERY MANAGER BUT HOW PLZ GIVE ME DETAILED TO HOW TO HANDLE GIVING AN EXAMPLE?

U can do it thru Recovery Manager..

Eg... Suppose there is an Edit box called Uname n PWD... Just type in uname n don't enter in PWD..

It displays a pop up msg called plz,,enter PWD... Then stop recording..

Go to Recovery MGR and call POPUP exception handling./../

45) Give one example where you have used Regular Expression?

1)for the date format "dd/mm/yyyy" the equivalent regular expression would be

Set regExp_Term = New RegExp
regExp_Term.pattern = "11/11/1981"
validation=regExp_Term.test("date to be validated")

if validation="True" Then

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

End If

2)We can use Regular Expression where ever required, like in my Web Testing, my browser name changes oftnely, so I used Regular expression in Name property like...

Set Browser= (Title:=Browser.*)

3) generaly regular expressions r used when the data is dynamically changing . for example take a flights application in the QTP samples. we can use regular expression for the Date field ,FaxOrder no,etc

Thursday, September 4, 2008

QTP FAQs - Part II

16. How to get a text from a list box,a cell from a table etc..
1)To obtain a text from List box just select the range of items inthe list box and use GetSelection method along with the object name. You also have GetContent method to get all the items from the list.
2) To obtain a text from cell, Record: Click inside the cell and use GetROProperty("text") then you can see the text value. Same is the case with Table also.
4) how to import data for data driven test?
DataTable.ImportSheet(FileName, SheetSource, SheetDest) FileName (String): The full path of the Excel table from which you want to import a sheet. SheetSource (Variant): The name or index of the sheet in the file that you want to import. Index values begin with 1. SheetDest (Variant): The name or index of the sheet in the Data Table that you want to replace with the SheetSource. Index values begin with 1. Example The following example uses the ImportSheet method to import the first sheet of the name.xls table to the name sheet in the test's run-time Data Table. DataTable.ImportSheet "C:\name.xls" ,1 ,"name"
DataTable.ImportSheet(FileName, SheetSource, SheetDest) FileName (String): The full path of the Excel table from which you want to import a sheet. SheetSource (Variant): The name or index of the sheet in the file that you want to import. Index values begin with 1. SheetDest (Variant): The name or index of the sheet in the Data Table that you want to replace with the SheetSource. Index values begin with 1. Example The following example uses the ImportSheet method to import the first sheet of the name.xls table to the name sheet in the test's run-time Data Table. DataTable.ImportSheet "C:\name.xls" ,1 ,"name"
17. Give an example of a regular expression,user-define?
Regular Expressions: These r enable QT to identify Objects and Text Strings with varying values.There r so many examples for Regular expressions . plz refer Visual Basic6.0 any reference book.For example, start.* matches start, started, starting, starter, etc. You can use a combination of brackets and an asterisk to limit the search to a combination of non-numeric characters. For example: [a-zA-Z]* User Defined Functions: You can write your user-defined function directly into your test or component if you want to limit its use only to the local action or component, or you can store the function in an associated library file to make it available to many actions and tests or components (recommended). Note that if the same function name exists locally within your action or component and within an associated library file, QuickTest uses the function defined in the action or component. Function MyFuncWithParam (obj, x) dim y y = obj.GetROProperty("value") Reporter.ReportEvent micDone, "previous value", y MyFuncWithParam=obj.Set (x) End Function Built_in Function:QuickTest provides a set of built-invariables that enable you to use current information about the test and the QuickTest computer running your test. These can include the test name, the test path, the operating system type and version, and the local host name.
18. how to change a name of an object in a application ..?
As a tester u only check the functionalities of the ojects. Developes can do that one. okthe blow answer gives u a good idea.When recording an object QuickTest Professional uses one of the object's properties as the logical name for the object (the name displayed in the Expert View and in the KeywardView modes).You can change the property that is used to be a different one by specifying which property's value you want to use as the logical name for the object.For example in order to use the alt property as the logical name of an image, run regedit.exe and set the following information:[HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\QuickTest Professional\MicTest\Test Objects\Image]"tag query
name"="alt"
19. how to invoke a databse application for database testing?
testconnection("Select * from emptable")
Function testconnection(query)
Set cnn = CreateObject("ADODB.Connection")Set rs = CreateObject("ADODB.Recordset")cnn.ConnectionString ="DRIVER={Oracle in OraHome92};SERVER=servername;UID=userid;PWD=pwd;DBQ=dbinstance"cnn.open
rs.open query,cnn rs.movefirst
for i = 0 to rs.fields.countmsgbox rs(i)next End Function
20. How many types of recording are there in QTP?
There are 3 types of Recording modes in QTP1. Stndard Recording or General Recording2. Analog Recording3. Low-level Recording
21.How can you show the data from a particular row and column?
NumColumns=datatable.GlobalSheet.GetParameterCountNumRows=datatable.GlobalSheet.getrowcountFor i = 1 to NumRowsDatatable.SetCurrentRow(i)For j = 1 to NumColumnstblCellText = Datatable(j,dtGlobalsheet)If tblCellText <> "" ThenMsgbox "The Text in Row: " & i & " and Column: " & j & " is: " & tblCellTextEnd IfNext Next
22) How i can get class name of test object by repository ?
Right-click an object with the property or value you want to find in the Keyword View or Active Screen and choose Object Properties (or View/Add Object in the Active Screen), and then click the Repository button, choose Tools > Object Repository, or click the Object Repository toolbar button
23.How to click on the link available in the web table?
Link is an item in web table and link is not static, i mean it can be any where, you can not guess?here , there are two actions, one is to capture the newly added item and than clicking on it.... U can use description method. For more about this method see QTP help. I had used the same for the same issue, but not as different Actions. U still can try this.
24. how can we test datareports through QTP?
we can test data reports by using descriptive programming.
25. how can i write a script to automate the page which contains random questions with corresponding answers as radio buttons ? eg:questions1............a b c dquestion 2a b c d..............
ACTUAL_ANS(0) = "2"ACTUAL_ANS(0) = "1"ACTUAL_ANS(0) = "3"ACTUAL_ANS(0) = "4"
RANDOM_ANS(I) = ANY RANDOM NO THROUGH RANDOMIZE FN RANGE BETWEEN 1 TO 4
Browser("QUIZ").Page("QUIZ_PAGE").WebRadioGroup("FIRSTQN").Select "#"&RANDOM_ANS(0)Browser("QUIZ").Page("QUIZ_PAGE").WebRadioGroup("SECONDQN").Select "#"&RANDOM_ANS(1)Browser("QUIZ").Page("QUIZ_PAGE").WebRadioGroup("THIRDQN").Select "#"&RANDOM_ANS(2)Browser("QUIZ").Page("QUIZ_PAGE").WebRadioGroup("FOURTHQN").Select "#"&RANDOM_ANS(3)
VALIDATE FOR ALL THE ANSWERS IN THAT ARRAY IN A LOOP
FOR LOOPIF RANDOM_ANS(I) = ACTUAL_ANS(I)GOOD_ANWSERED = GOOD_ANWSERED + 1END IFMSGBOX GOOD_ANWSERED ARE THE SCORE !!!NEXT
26. Explain the need to use analog recording in qtp?
This mode records exact mouse and Key Board operations you perform in relation to the screen /Application Window. This mode is useful for the operation which you can record at Object Level, such as drawing a picture, recording signature. The steps recorded using Analog Mode is saved in separated data file, Quick Tests add to your Test a Run Analog File statement that calls the recorded analog File. This file is stored with your action in which these Analog Steps are created. The Step recorded in Analog mode can not be edited within QT.
27. What are the loops used in Quick Test Professional?
As like as win runner q.t.p allows FOR LOOP, WHILE LOOP, DO LOOP,IF CONDION
28. how to execute qtp script from command prompt?
You need to create a vbs file... then create a batch file....that's it, i think this is possible by the using CScript.exe "filename" in the command prompt.
29. how do we record a pop up window in QTP?
we can record a pop up window through Recovery Management
30. I am using QTP testing tool,What is micclass? and how to refer the different DLL\'s?
Micclass is nothing but the Type of Object in the Application like Webedit,WebRadiogroup,Webcheckbox
To make use of Dlls..CreateObject can be used. like ;
set obj = CreateObject("mydll")
mydll.customfunctions

QTP FAQs - Part I

1. How do u do batch testing in WR & is it possible to do in QTP, if so explain?
Ans: Batch Testing in WR is nothing but running the whole test set by selecting "Run Testset" from the "Execution Grid".The same is possible with QTP also. If our test cases are automated then by selecting "Run Testset" all the test scripts can be executed. In this process the Scripts get executed one by one by keeping all the remaining scripts in "Waiting" mode.
2. If i give some thousand tests to execute in 2 days what do u do?
Ans : Adhoc testing is done. It Covers the least basic functionalities to verify that the system is working fine.
3. what does it mean when a check point is in red color? what do u do?
Ans : A red color indicates failure. Here we analyze the the cause for failure whether it is a Script Issue or Envronment Issue or a Application issue.
4. what do you call the window testdirector-testlab?
Ans : "Execution Grid". It is place from where we Run all Manual / Automated Scripts
The Test Obj ect Model is a large set of object types or classes that QTP uses to represent the objects in your application. Each test object class has a list of properties that can uniquely identify objects of that class and a set of relevant methods that QTP can record for it.
A test object is an object that QTP creates in the test to represent the actual object in your application. QTP stores information about the object that will help to identify and check the object during the test run. A run-time object is the actual object in your Web site or application on which methods are performed during the test runAutomation Framework,
Automation framework is a process to develop the automation scripts and reduce maintenance. This framework completely depends on the application, types of testing and tools that you are using. Its hard to provide generalised framework for all applications:
In general, 1) Create reusable scripts

2) Create modular scripts and drive scripts from external data.
5. How does Parameterization and Data-Driving relate to each other in QTP?
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 data. You know running the script with the same set of data several times is not suggestable, & it's also of no use.
6. Explain the concept of how QTP identifies object.
QTP uses the Object Repository file to recognize objects on the application. When QTP runs a action, it uses the Object Repository to locate objects. It reads an object’s description in the Object Repository and then looks for an object with the same properties in the application being tested. During recording qtp looks at the object and stores it as test object.For each test object QT learns a set of default properties called mandatory properties,and look at the rest of the objects to check whether this properties are enough to uniquely identify the object. During test run,QT searches for the run time obkects that matches with the test object it learned while recording.
7. 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 orginal 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)
when u insert a call to action,they r read only in the calling test.It can be modified in the original test.where as come to copy action,you can make changes to the copied action,your changes will not effect the original action where it created.
8. have you ever written a compiled module? If yes tell me about some of the functions that you wrote ?
I Used the functions for Capturing the dynamic data during runtime. Function used for Capturing Desktop, browser and pages. in qtp the compiled modules are called library files. so write different files in a file extention with .vbs and call this in qtp test scipt file
9. Explain what the difference between Shared Repository and Per_Action Repository
Shared Repository: Entire application uses one Object Repository , that similar to Global GUI Map file in WinRunner Per Action: For each Action ,one Object Repository is created, like GUI map file per test in WinRunner
10. Few basic questions on commonly used Excel VBA functions.
common functions are: Coloring the cell Auto fit cell setting navigation from link in one cell to other saving
11. Explain the keyword createobject with an example.?
Creates and returns a reference to an Automation object syntax: CreateObject(servername.typename [, location]) Arguments servername:Required. The name of the application providing the object. typename : Required. The type or class of the object to create. location : Optional. The name of the network server where the object is to be created.
create object creates handle to the instance of the specified object so that we program can use the methods on the specified object. It is used for implementing Automation(as defined by microsoft). ex: set oDesc= createobject(Excel.application) odesc.activeworksheet=1
Createobject:Creates and returns a reference to an Automation object.Example:Dim ExcelSheetSet ExcelSheet = CreateObject("Excel.Sheet")
12. How to use the Object spy in QTP 8.0 version?
The SPY will be used to recognize and read all the objects on the application.
There are two ways to Spy the objects in QTP 1) Thru file toolbar ---In the File ToolBar click on the last toolbar button (an icon showing a person with hat). 2) Tru Object repository Dialog ---In Objectrepository dialog click on the button"object spy..." In the Object spy Dialog click on the button showing hand symbol. the pointer now changes in to a hand symbol and we have to point out the object to spy the state of the object if at all the object is not visible..or window is minimised then Hold the Ctrl button and activate the required window to and release the Ctrl button.
13. Give me an example where you have used a COM interface in your QTP project?
com inteface appears in the scenario of front end and back end.for eg:if you r using oracle as back end and front end as VB or any language then for better compatibility we will go for an interface.of which COM wil be one among those intefaces.

14. How do you test oracle application using qtp?
With Help of Below Commands, first u launch the Oracle Applications and then Test with the help of Data Driven and DML and DDL commandsqtApp.Test.Settings.Launchers("Oracle 8i").Active = TrueqtApp.Test.Settings.Launchers("Oracle 8i").CommandLine = qtApp.Test.Settings.Launchers("Oracle 8i").WorkingDirectory =
15. Where is the bitmap chekpoint information saved?
The Bitmap Check Point Information saved in the Below File:C:\Program Files \ Mercury Interactive\Quick Test Professional\Tests\Action Name\Res1