Basic funda of QA (Testing )

"No Standards for Testing only the Best Practices"

Monday, September 22, 2008

Software Test Automation Myths and Facts

Introduction

Today software test automation is becoming more and more popular in both C/S and web environment. As the requirements keep changing (mostly new requirements are getting introduced on daily basis) constantly and the testing window is getting smaller and smaller everyday, the managers are realizing a greater need for test automation. This is good news for us (people who do test automation). But, I am afraid this is the only good news.

Myths & Facts

A number of articles and books are written on different aspects of Software Test Automation. I like to discuss some of these myths and will try to point out the facts about these myths. I also like to discuss some of my observations and hopefully point out possible solutions. These are based on my experience with a number of automation projects I was involved and the information I collected from people worked on automation.

Find more bugs: Management often think that by doing automation they should be able to find more bugs. It’s a myth. Let’s think about it for a while. The process of automation involves writing test cases. Generally test cases are written by test engineers who are familiar with the application they are working w.r.t .specficiations . The test cases are then given to the automation engineers. In most cases the automation engineers are not very familiar with the test cases they are automating. From test cases to test scripts, automation does not add anything in the process to find more bugs. The test scripts will work only as good as the test cases when comes to finding bugs. So, it’s the test cases that find bugs, not the test scripts. So, the number of bugs found depends on the effectiveness of writing test cases with respect to specifications.

Eliminate or reduce manual testers: In order to justify automation, some point out that they should able to reduce the number of manual testers in the long run and thus save money in the process. Absolutely not true. Reduction of manual testers is not any of the objectives of test automation. Here is why – as I have pointed out earlier that the test scripts are only as good as the test cases and the test cases are written primarily by manual testers. They are the ones who know the application inside out. If the word gets out (it usually does) that the number of manual testers will be reduced by introducing automation. But effective usage of a tester’s time can be achieved and automation will reduce the test repetition cost and save the test execution time.


Observations

I have met a number of QA managers who are frustrated with their automation. According to them the tool is not doing what it is supposed to do. Here is a true story, the client (I had the opportunity to work with them for some time) found out that the tool they have just bought does not support the application they are testing (I am not making it up). How can this happen! – It does happen more often than one would think. I will get back on this when I discuss possible solutions. A manager of one of the major telecom companies that I had a recent interview with told me that after three years and more than a million dollar he is still struggling with automation. This is pretty sad and I get the feeling that he is not alone.

Solutions/Suggestions

Let’s discuss some of the reasons for this frustration and some of the solutions to this problem.

- Unrealistic expectations: Most managers have their first encounter with any automation tool when they look at the demo and everything looks nice and simple.

But everything is not so nice and simple when you try to use the tool with your application. The vendors will only tell you the things you want to hear (how easy to use, how simple to set up, how it will save time and money, how it will help you find more bugs etc.). This builds a false set of hopes and expectations.

- Lack of planning: A great deal of planning is required from selection to implementation of the tool. “Evaluating Tools” by Elisabeth Hendrickson is a very good article on step by step process of selecting a tool. She talks about “Tool Audience” as one of the steps. This would be an ideal way to select a tool. It may not happen in every place because of the everyday workload of the people involved. But the participation of the users in the process is very important, because they are the ones who will use the tool day in and day out. I am almost certain that what happened to one of my clients (the tool they have bought did not support the application they were testing) would not have happened if the users were involved in the selection process.

- Lack of a process: Lack of a process may also contribute to failure of automation. Most places do have some kind of process in place. In most cases (although it differs from place to place) developers write code against a set of requirements. If the requirement does not call for a change in GUI then, there should not be any change in GUI. But if the GUI keep changing constantly from one release to another without any requirement for that change then, there is a problem in the process. You may have the best tool and the best (for your environment) architecture is in place and you will still have problems with your automation because of a faulty process.

FUNDAS ABOUT TEST AUTOMATION FRAMEWORKS :

Historically, test automation has not met with the level of success that it could. Time and again test automation efforts are born, stumble, and die. Most often this is the result of misconceived perceptions of the effort and resources necessary to implement a successful, long-lasting automation framework. Why is this, we might ask? Well, there are several reasons.

The commercial automation tools have been chiefly marketed for use as solutions for testing an application. They should instead be sought as the cornerstone for an enterprise-wide test automation framework. And, while virtually all of the automation tools contain some scripting language allowing us to get past each tool’s failings, testers have typically neither held the development experience nor received the training necessary to exploit these programming environments

Test automation must be approached as a full-blown software development effort in its own right. Without this, it is most likely destined to failure in the long term.

In order to make the most of our test strategy, we need to make it reusable and manageable. To that end, there are some essential guiding principles we should follow when developing our overall test strategy:

  • Test automation is a fulltime effort, not a sideline.
  • The test design and the test framework are totally separate entities.
  • The test framework should be application-independent.
  • The test framework must be easy to expand, maintain, and perpetuate.
  • The test strategy/design vocabulary should be framework independent.
  • The test strategy/design should remove most testers from the complexities of the test framework.

Data Driven Automation Frameworks

Over the past several years there have been numerous articles done on various approaches to test automation. Anyone who has read a fair, unbiased sampling of these knows that we cannot and must not expect pure capture and replay of test scripts to be successful for the life of a product. We will find nothing but frustration there

1.2.1 Data Driven Scripts

Data driven scripts are those application-specific scripts captured or manually coded in the automation tool’s proprietary language and then modified to accommodate variable data. Variables will be used for key application input fields and program selections allowing the script to drive the application with external data supplied by the calling routine or the shell that invoked the test script.

Variable Data, Hard Coded Component Identification:
These data driven scripts often still contain the hard coded and sometimes very fragile recognition strings for the window components they navigate. When this is the case, the scripts are easily broken when an application change or revision occurs. And when these scripts start breaking, we are not necessarily talking about just a few. We are sometimes talking about a great many, if not all the scripts, for the entire application.

1.2.2 Keyword or Table Driven Test Automation

Nearly everything discussed so far defining our ideal automation framework has been describing the best features of "keyword driven" test automation. Sometimes this is also called "table driven" test automation. It is typically an application-independent automation framework designed to process our tests. These tests are developed as data tables using a keyword vocabulary that is independent of the test automation tool used to execute them. This keyword vocabulary should also be suitable for manual testing, as you will soon see.

Action, Input Data, and Expected Result ALL in One Record:
The data table records contain the keywords that describe the actions we want to perform. They also provide any additional data needed as input to the application, and where appropriate, the benchmark information we use to verify the state of our components and the application in general.

Reusable Code, Error Correction and Synchronization:
Application-independent component functions are developed that accept application-specific variable data. Once these component functions exist, they can be used on each and every application we choose to test with the framework.

1.2.3 Hybrid Test Automation (or, "All of the Above")

The most successful automation frameworks generally accommodate both keyword driven testing as well as data driven scripts. This allows data driven scripts to take advantage of the powerful libraries and utilities that usually accompany a keyword driven architecture.

The framework utilities can make the data driven scripts more compact and less prone to failure than they otherwise would have been. The utilities can also facilitate the gradual and manageable conversion of existing scripts to keyword driven equivalents when and where that appears desirable.

1.2.4 Commercial Keyword Driven Frameworks

Some commercially available keyword driven frameworks are making inroads in the test automation markets. These generally come from 3rd party companies as a bridge between your application and the automation tools you intend to deploy. They are not out-of-the-box, turnkey automation solutions just as the capture\replay tools are not turnkey solutions.

Keyword Driven Automation Framework Model

The model focuses on implementing a keyword driven automation framework. It does not include any additional features like tracking requirements or providing traceability between automated test results and any other function of the test process. It merely provides a model for a keyword driven execution engine for automated tests.

The commercially available frameworks generally have many more features and much broader scope. Of course, they also have the price tag to reflect this.

I) Project Guidelines

The test strategy will allow each test to include the step to perform, the input data to use, and the expected result all together in one line or record of the input source.

Implement a framework that will integrate keyword driven testing and traditional scripts, allowing both to benefit from the implementation.

Implement the framework to be completely application-independent since it will need to test at least 4 or 5 different applications once deployed.

The framework will be fully documented and published.

The framework will be publicly shared on the intranet for others to use and eventually (hopefully) co-develop.

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

Winrunner FAQ's - Part I

1) How you used WinRunner in your project?

a. Yes, I have been WinRunner for creating automates scripts for GUI, functional and regression testing of the AUT.

2) Explain WinRunner testing process?

a. WinRunner testing process involves six main stages

i. Create GUI Map File so that WinRunner can recognize the GUI objects in the application being tested

ii. Create test scripts by recording, programming, or a combination of both. While recording tests, insert checkpoints where you want to check the response of the application being tested.

iii. Debug Test: run tests in Debug mode to make sure they run smoothly

iv. Run Tests: run tests in Verify mode to test your application.

v. Update mode: run tests to update expected results…in exp folder..

vi. View Results: determines the success or failure of the tests.

vii. Report Defects: If a test run fails due to a defect in the application being tested, you can report information about the defect directly from the Test Results window.

3) What is contained in the GUI map?

a. WinRunner stores information it learns about a window or object in a GUI Map. When WinRunner runs a test, it uses the GUI map to locate objects. It reads an object’s description in the GUI map and then looks for an object with the same properties in the application being tested. Each of these objects in the GUI Map file will be having a logical name and a physical description.

b. There are 2 types of GUI Map files.

i. Global GUI Map file: a single GUI Map file for the entire application

ii. GUI Map File per Test: WinRunner automatically creates a GUI Map file for each test created.

4) How does WinRunner recognize objects on the application?

a. WinRunner uses the GUI Map file to recognize objects on the application. When WinRunner runs a test, it uses the GUI map to locate objects. It reads an object’s description in the GUI map and then looks for an object with the same properties in the application being tested.

5) Have you created test scripts and what is contained in the test scripts?

a. Yes I have created test scripts. It contains the statement in Mercury Interactive’s Test Script Language (TSL). These statements appear as a test script in a test window. You can then enhance your recorded test script, either by typing in additional TSL functions and programming elements or by using WinRunner’s visual programming tool, the Function Generator.

6) How does WinRunner evaluates test results?

a. Following each test run, WinRunner displays the results in a report. The report details all the major events that occurred during the run, such as checkpoints, error messages, system messages, or user messages. If mismatches are detected at checkpoints during the test run, you can view the expected results and the actual results from the Test Results window.

7) Have you performed debugging of the scripts?

a. Yes, I have performed debugging of scripts. We can debug the script by executing the script in the debug mode. We can also debug script using the Step, Step Into, Step out functionalities provided by the WinRunner.

8) How do you run your test scripts?

a. We run tests in Verify mode to test your application. Each time WinRunner encounters a checkpoint in the test script, it compares the current data of the application being tested to the expected data captured earlier. If any mismatches are found, WinRunner captures them as actual results.

9) How do you analyze results and report the defects?

a. Following each test run, WinRunner displays the results in a report. The report details all the major events that occurred during the run, such as checkpoints, error messages, system messages, or user messages. If mismatches are detected at checkpoints during the test run, you can view the expected results and the actual results from the Test Results window. If a test run fails due to a defect in the application being tested, you can report information about the defect directly from the Test Results window. This information is sent via e-mail to the quality assurance manager, who tracks the defect until it is fixed.

10) What is the use of Test Director Software?

a. TestDirector is Mercury Interactive’s software test management tool. It helps quality assurance personnel plan and organize the testing process. With TestDirector you can create a database of manual and automated tests, build test cycles, run tests, and report and track defects. You can also create reports and graphs to help review the progress of planning tests, running tests, and tracking defects before a software release.

11) How you integrated your automated scripts from TestDirector?

a. When you work with WinRunner, you can choose to save your tests directly to your TestDirector database or while creating a test case in the TestDirector we can specify whether the script in automated or manual. And if it is automated script then TestDirector will build a skeleton for the script that can be later modified into one which could be used to test the AUT.

12) What are the different modes of recording?

a. There are two type of recording in WinRunner.

i. Context Sensitive recording records the operations you perform on your application by identifying Graphical User Interface (GUI) objects.

ii. Analog recording records keyboard input, mouse clicks, and the precise x- and y-coordinates traveled by the mouse pointer across the screen.

13) What is the purpose of loading WinRunner Add-Ins?

a. Add-Ins are used in WinRunner to load functions specific to the particular add-in to the memory. While creating a script only those functions in the add-in selected will be listed in the function generator and while executing the script only those functions in the loaded add-in will be executed else WinRunner will give an error message saying it does not recognize the function.

14) What are the reasons that WinRunner fails to identify an object on the GUI?

a. WinRunner fails to identify an object in a GUI due to various reasons.

i. The object is not a standard windows object.

ii. If the browser used is not compatible with the WinRunner version, GUI Map Editor will not be able to learn any of the objects displayed in the browser window.

15) What do you mean by the logical name of the object.

a. An object’s logical name is determined by its class. In most cases, the logical name is the label that appears on an object.

16) If the object does not have a name then what will be the logical name?

a. If the object does not have a name then the logical name could be the attached text.

17) What is the different between GUI map and GUI map files?

a. The GUI map is actually the sum of one or more GUI map files. There are two modes for organizing GUI map files.

i. Global GUI Map file: a single GUI Map file for the entire application

ii. GUI Map File per Test: WinRunner automatically creates a GUI Map file for each test created.

b. GUI Map file is a file which contains the windows and the objects learned by the WinRunner with its logical name and their physical description.

18) How do you view the contents of the GUI map?

a. GUI Map editor displays the content of a GUI Map. We can invoke GUI Map Editor from the Tools Menu in WinRunner. The GUI Map Editor displays the various GUI Map files created and the windows and objects learned in to them with their logical name and physical description.

19) When you create GUI map do you record all the objects of specific objects?

a. If we are learning a window then WinRunner automatically learns all the objects in the window else we will we identifying those object, which are to be learned in a window, since we will be working with only those objects while creating scripts.

20) What is the purpose of set_window command?

a. Set_Window command sets the focus to the specified window. We use this command to set the focus to the required window before executing tests on a particular window.

Syntax: set_window (, time);

The logical name is the logical name of the window and time is the time the execution has to wait till it gets the given window into focus.

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