Basic funda of QA (Testing )

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

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

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