Monday, April 12, 2010

Interview Questions Part 9

Testing Questions 9



If you have any quarries/feed back catch me on - knowthetesting@gmail.com

Thank you
Ram

Sunday, April 11, 2010

Interview Questions Part 8

How to make arguments optional in a function?
This is not possible as default VBS doesn't support this. Instead you can pass a blank scring and have a default value if arguments r not required.

How to add a text checkpoint to your test to check whether 'welcome' is displayed in your welcome page.
1 Locate the page where you want to add a text checkpoint.
2 Create a text checkpoint.
In the Active Screen, under your page highlight the text welcome. Right-click the highlighted text and choose Insert Text Checkpoint. The Text Checkpoint Properties dialog box opens.When Checked Text appears in the list box, the Constant field displays the text string you highlighted. This is the text QuickTest looks for when running the test.Click OK to accept the default settings in this dialog box.QuickTest adds the text checkpoint to your test. It is displayed in the Keyword View as a checkpoint operation on your welcome page3 Save the test.


How to Running and Analyzing a Test with Checkpoints?
1 Expand the test and review your test.Choose View > Expand All or use the * shortcut key on your number keypad. 
2 Start running your test.Click Run or choose Test > Run. The Run dialog box opens. Ensure that New run results folder is selected. Accept the default results folder name. Click OK. When the test run is completed, the Test Results window opens. 
3 View the test results.When QuickTest finishes running the test, the Test Results window opens. The test result should be Passed, indicating that all checkpoints passed. If one or more checkpoints had failed, the test result would be Failed. 
4 View the results of the page checkpoint.In the Details pane, you can review the details of the page checkpoint, which lists the items checked. 
5 View the results of the table checkpoint.In the Details pane, you can review the details of the table checkpoint. You can also review the values of the table cells (cell values that were checked are displayed in black; cell values that were not checked are displayed in gray). 
6 View the results of the standard checkpoint.In the Details pane, you can review the details of the standard checkpoint, which lists the properties that were checked and their values. The checkpoint passed because the actual values of the checked properties match the expected values. 
7 View the results of the text checkpoint.In the Details pane, you can review the details of the text checkpoint. The checkpoint passed because the actual text matches the expected text. 
8 Close the Test Results window. Choose File > Exit.


How to Defining a Data Table Parameter for QTP?
1 Start QuickTest and open the Checkpoint test.
2 Save the test as Parameter.
 3 Confirm that the Active Screen option is enabled.
4 Confirm that the Data Table option is enabled.
5 Select the text to parameterize.6 Set the parameterization properties.


How to add a runtime parameter to a datasheet?
DataTable.LocalSheetThe following example uses the LocalSheet property to return the local sheet of the run-time Data Table in order to add a parameter (column) to it.MyParam=DataTable.LocalSheet.AddParameter("Time", "5:45")

How to change the run-time value of a property for an object?
SetTOProperty changes the property values used to identify an object during the test run. Only properties that are included in the test object description can be set


How to retrieve the property of an object?
using "GetRoProperty".


How to open any application during Scripting?
SystemUtil , object used to open and close applications and processes during a run session.(a) A SystemUtil.Run statement is automatically added to your test when you run an application from the Start menu or the Run dialog box while recording a testE.g : SystemUtil.Run "Notepad.exe" SystemUtil.CloseDescendentProcesses ( Closes all the processes opened by QTP )


How to convert a String to an integer?
CInt()---> a conversion function available.


Inserting a Call to Action is not Importing all columns in Datatable of globalsheet. Why?
Inserting a call to action will only Import the columns of the Action called


Differentiate the two Object Repository Types of QTP.
Object repository is used to store all the objects in the application being tested.2 types of oject repositoy per action and shared. In shared repository only one centralised repository for all the tests. where as in per action.for each test a separate per action repostory is created.


What the differences are and best practical application of each.
Per Action: For Each Action, one Object Repository is created. Shared : One Object Repository is used by entire application


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

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.


If you have any quarries/feed back catch me on - knowthetesting@gmail.com

Thank you
Ram

Thank you
Ram

Interview Questions Part 7

What is a Run-Time Data Table? Where can I find and view this table?
-In QTP, there is data table used , which is used at runtime.-In QTP, select the option View->Data tabke.-This is basically an excel file, which is stored in the folder of the test created, its name is Default.xls by default.

How to do the scripting. Is there any inbuilt functions in QTP as in QTP-S. Whatz the difference between them? how to handle script issues?
Yes, there's an in-built functionality called "Step Generator" in Insert->Step->Step Generator -F7, which will generate the scripts as u enter the appropriate steps.


What is the difference between check point and output value.
An outPut value is a value captured during the test run and entered in the run-time but to a specified location. EX:-Location in Data Table[Global sheet / local sheet]


Types of properties that Quick Test learns while recording?
(a) Mandatory (b) Assistive . 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.


Differences between QTP & Winrunner?
(a) QTP is object bases Scripting ( VBS) where Winrunner is TSL (C based) Scripting.(b) QTP supports ".NET" application Automation not available in Winrunner(c) QTP has "Active Screen" support which captures the application, not available in WR.(d) QTP has "Data Table" to store script values , variables which WR does not have.(e) Using a “point and click” capability you can easily interface with objects, their definitions and create checkpoints after having recorded a script – without having to navigate back to that location in your application like you have to with WinRunner. This greatly speeds up script development.


Few basic questions on commonly used Excel VBA functions.
common functions are:Coloring the cellAuto fit cellsetting navigation from link in one cell to other saving


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.


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)


How to verify the Cursor focus of a certain field?
Use "focus" property of "GetRoProperty" method"




If you have any quarries/feed back catch me on - knowthetesting@gmail.com

Thank you
Ram

Interview Questions Part 6

How to Import data from a ".xls" file to Data table during Runtime.
Datatable.Import "...XLS file name..."DataTable.ImportSheet(FileName, SheetSource, SheetDest) DataTable.ImportSheet "C:\name.xls" ,1 ,"name"
 
How to export data present in Datatable to an ".xls" file?
DataTable.Export "....xls file name..."
Syntact for how to call one script from another? and Syntax to call one "Action" in another?
RunAction ActionName, [IterationMode , IterationRange , Parameters]Here the actions becomes reusable on making this call to any Action.IterationRange String Not always required. Indicates the rows for which action iterations will be performed. Valid only when the IterationMode is rngIterations. Enter the row range (i.e. "1-7"), or enter rngAll to run iterations on all rows.If the action called by the RunAction statement includes an ExitAction statement, the RunAction statement can return the value of the ExitAction's RetVal argument.

 
How to export QTP results to an ".xls" file?
By default it creates an "XML" file and displays the results

 
How the exception handling can be done using QTP
It can be done Using the Recovery Scenario Manager which provides a wizard that gudies you through the process of defining a recovery scenario. FYI.. The wizard could be accesed in QTP> Tools-> Recovery Scenario Manager.

 
How many types of Actions are there in QTP?
There are three kinds of actions:non-reusable action—an action that can be called only in the test with which it is stored, and can be called only once. reusable action—an action that can be called multiple times by the test with which it is stored (the local test) as well as by other tests.external action—a reusable action stored with another test. External actions are read-only in the calling test, but you can choose to use a local, editable copy of the Data Table information for the external action.

 
Analyzing the Checpoint results
Standard Checpoint :By adding standard checkpoints to your tests or components, you can compare the expected values of object properties to the object's current values during a run session. If the results do not match, the checkpoint fails.

 
How to handle Run-time errors?
On Error Resume Next : causes execution to continue with the statement immediately following the statement that caused the run-time error, or with the statement immediately following the most recent call out of the procedure containing the On Error Resume Next statement. This allows execution to continue despite a run-time error. You can then build the error-handling routine inline within the procedure.Using "Err" object msgbox "Error no: " & " " & Err.Number & " " & Err.description & " " & Err.Source & Err.HelpContext

 
What are the different scripting languages you could use when working with QTP ?
Visual Basic (VB),XML,JavaScript,Java,HTML

 
How to handle dynamic objects in QTP?
QTP has a unique feature called Smart Object Identification/recognition. QTP generally identifies an object by matching its test object and run time object properties. QTP may fail to recognise the dynamic objects whose properties change during run time. Hence it has an option of enabling Smart Identification, wherein it can identify the objects even if their properties changes during run time. Check this out-If QuickTest is unable to find any object that matches the recorded object description, or if it finds more than one object that fits the description, then QuickTest ignores the recorded description, and uses the Smart Identification mechanism to try to identify the object. While the Smart Identification mechanism is more complex, it is more flexible, and thus, if configured logically, a Smart Identification definition can probably help QuickTest identify an object, if it is present, even when the recorded description fails.The Smart Identification mechanism uses two types of properties:Base filter properties—The most fundamental properties of a particular test object class; those whose values cannot be changed without changing the essence of the original object. For example, if a Web link's tag was changed from to any other value, you could no longer call it the same object. Optional filter properties—Other properties that can help identify objects of a particular class as they are unlikely to change on a regular basis, but which can be ignored if they are no longer applicable.

 
Explain the keyword createobject with an example.
Creates and returns a reference to an Automation objectsyntax: CreateObject(servername.typename [, location])Argumentsservername: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.



If you have any quarries/feed back send me mail on - knowthetesting@gmail.com

Thank you
Ram


Wednesday, April 7, 2010

Interview Questions Part 5


Q. What are test objects?
Test objects are objects created and maintained by QTP in its object repository. Each test objecthas a name and a set of properties to uniquely identify the actual object in the application.
 
Q. how does QTP identifies the objects during the script run?
During script run QuickTest searches for a run-time object that has the similar description of thetest object in the object repository.
 
Q. How can i check the properties of an object in an application without using checkpoints? For Example how will you check whether a button is enabled?
Answer: GetROProperty method is used to retrieve the properties of the object in an application.It is very useful method and can be used to retrieve almost any of the property that can be seenwhile spying the object with object spy. For Example‘To get whether button is enabled or not.
Val = Browser("QA Friends").Page("QA Friends"). WebButton("Login"). GetROProperty("disabled")
‘To get whether a checkbox is on or off.
Val =Browser("QA Friends").Page("QA Friends").WebCheckBox("Test").GetROProperty("Value")
 
Q. How can I modify the properties values of test objects in Object Repository during runtime?
A. You can use SetTOProperty method of test object.Object(description).SetTOProperty Property, ValueThe values of test object properties are used to identify the objects. Sometimes the properties ofthe object in the application change dynamically. For example text of a link in a webpage is theusername used to login to that page.Text property is used by test object to identify the link. So in order to identify the actual object wecan manipulate the value of “text” property of link using SetTOProperty.
 
Q. How do you synchronize your scripts in QTP?
A. For waiting until navigation of web page completes we can use Sync method. For waiting until an object appears we can use Exist method. For waiting until a property of object changes we can use WaitProperty method. You can set browser navigation timeout in: Click Test > Settings menuSelect web tab in Test Settings window. Enter the timeout in Browser Navigation Timeout text box. You can set global object sychrozization timeout in: Click Test > Settings menu Select Run tab in Test Settings window. Enter the timeout in Object Synchronization Timeout text box.
 
Q Where can you write user defined functions that are accessible by all scripts?
A. We can write user defined function in .vbs file. This file can be loaded by adding the file asfollows: Click Test > Settings menuSelect Resources tab in Test Settings window and add the file. Alternatively you can also load the file through script usingExecuteFile “absolute or relative path of file” For Example: ExecuteFile “C:\Test.vbs”

Q What are regular expressions?
A. Regular expressions used for identifying objects and text strings with varying values. You can use regular expressions for defining the property values of an object, creating checkpoints with varying values etc. Example: For example if the caption on the button in an application changes dynamically and can be anything which starts with “Hello” (It can be Hello XYZ, Hello AB13 and so on) You can go object repository and change the value of name property of the button object to” Hello.*”Here “.” means any single character and “*” means 0 or more occurrences of preceding character. So.* means 0 or more occurrences of any character. There are many other regular expression characters: For Example: Regular expression test[0-9] matches test0, test1, test2…… to test9.Regular expression abc[789] matches abc7, abc8, abc9Q. Different ways to parameterize tests? A. Test, action or component parameters – for using values from other action in your test. Data Table parameters – for creating data driven test based on values in data table. Environment variable parameters – For using values of environment variable. Random number parameters – For using random numbers as values in our test or component.
Q. What can you do if values of object properties in an application are changing constantly?
A. We can try using alternatives like regular expressions, Changing description of test objects in object repository during run time, using descriptive programming and so on.
Q. What can you do if objects are not identified by QTP?
A. 1) For standard windows environment you can try object mapping user defined classes to standard classes.2)You can find whether any addins are available for given environment.3) check if any other reliable alternatives are available like using keyboard shortcuts, using automation object model of application if available and so on.
Q. What is descriptive programming?
A. Descriptive programming allows you to work with objects that are not stored in objectrepository. two types of programmatic descriptions.1) listing the set of properties and values that describe the object directly in a teststatement.2) Add collection of properties and values to a Description object, and then enter the Description object name in the statement.
 
Q. How will you access database from QTP?
A. You can use ActiveX Data Object for accessing the content of database. You cancreate connection object, recordset object and then execute query. And access the valuesof query in recordset.
Example Set objConn= CreateObject("ADODB.connection")
   Set objRecSet = CreateObject("ADODB.recordset")objConn.open strConString
'strConString is database connection string.objRecSet.open strQuery,objConn 'strQuery is SQL query to execute.


If you have any quarries/feed back send me on - knowthetesting@gmail.com

Thank you
Ram