Friday, September 30, 2011

Input/Out put Parameters:

Input/Out put Parameters:

One can pass number of values in to the function while calling and a function can return only one value.

Example:

Function add(a,b) Main program
Res= a+b Add(10,20)
Add= res Msg box var
End function



Input/Output parameters concept is used for passing some values in to the action to return some values once the execution is finish
To do the same one has to declare the desired number of input parameters and out put parameters at the action, which is about to be called

Navigation:
• Activate the menu item test
• Select the option action properties
• Select the parameters tab
• Declare the desired number of input/output parameters
• Using the corresponding add buttons
• Click on OK

Exmaple:
vbwindow("Form1").VbEdit ("val1").set parameter ("a")
vbwindow("Form1").VbEdit("val2").Set parameter ("b")
vbwindow("Form1").VbButton("ADD").Click
var= vbwindow("Form1").VbEdit("res").GetROProperty "text"
parameter ("c")= var
vbwindow("Form1").Vbbutton("SUB").Click
var1=vbwindow("Form1").VbEdit("res").GetROProperty "textA"
parameter ("d")=var1
vbwindow("Form1").VbButton("CLEAR").Click

At the calling point one need to specify the input values in a sequence separated by commas and the variable names in a sequence in order to catch the return value

Example:Take the new test

Run action "action1[inout122]", one iteration,20,30,r1,r2
msg box r1
msg box r2

DataTable Methods

QTP is having a powerful utility that is DataTable.It is normally used to enter the test data into the QTP script during script execution.
The following are some data table methods and their descriprions with examples.

Data table methods:

Data table methods are used for performing the operations on the runtime data table

1. Add- sheet: It is used for adding the new sheet for the runtime data table
SYNTAX: Data table.add sheet ”sheet name”

2. Delete- sheet: It is used for deleting a specified sheet from the run time data table
SYNTAX: Data table.delete sheet”sheet name”

3. Import: It is used for importing the data present in all the sheets in an excel file to the runtime data table
SYNTAX: Data table.import ”path of the excel file”

4. Import Sheet: It is used for importing specified sheet of data from the excel file to the specified sheet in the runtime data table
SYNTAX: Data table. Import sheet “path of the excel file, source sheet id, destination sheet id”

5. Export: It is used for exporting the complete data present in the run time data table to a specified location
SYNTAX: Data table. export “Path of the location with a file name.xls extension”

6.Export Sheet: It is used for exporting the data present in a specified sheet in the run time data table to a specified location
SYNTAX: Data table .export sheet “path of the location with a file name.xls extension”, sheet id to be exported.

7. Set currant row: It is used for making the QTP focus on a specified row
SYNTAX: Data table. Set currant row (row number)

8. Set next row: It is used for making the QTP focused on the next of the currently focused row
SYNTAX: Data table. Set next row

9.Set Prev Row: It is used for making the QTP focus on the previous row of the currently focused tow
SYNTAX: Data table. Set prev row

10. Value Method: It is used for getting a value from a specified sheet, specified column and currently focused row.
SYNTAX: Variable= Data Table. Value ( “column name”, sheet id)

11. Get Sheet: It is used for making the QTP to focus on a specified sheet
SYNTAX: Data table. Get sheet (sheet id)

12 Get Row Count: It is used for getting the row count of a global sheet
If at all one wants to get the row count of a specified sheet first of all they need to make the QTP to focus on a specified sheet and then get the row count
SYNTAX 1: Variable= Data Table. Get row count
SYNTAX 2: Variable= Data Table. Get sheet (“sheet id”). Get row count

Example:
DataTable.Addsheet “Alok”
DataTable.Importsheet “e:\Alok\td122.xls,1,3
N=Datatable.Getsheet( 3).getrowcount
For i= 1 to n
Data table. Setcurrantrow( i )
Vbwindow(“form1”).vbedit(“val1”).set datatable(“v1”,3)
Vbwindow(“form1).vbedit(‘val2’).set datatable(“v2”,3)
Vbwindow(”form1”).vbbutton(“add”).click
Expval= Datatable.value(“ev”,3)
Actval= vbwindow(“form1”).vbedit(“res”).getroproperty(“text”)
If (Expval= Actval) then
Datatable (“res”,3)= “pass”
Else
Datatable (“res”,3)= “fail”
End if
Next
Datatable.Export sheet “D;\fl_automation\log\file2.xls”,3
Datatable.Delete “Alok”

Monday, August 8, 2011

QTP Automation Architecture:-



QTP Automation Process:


Test Automation Framework:

Automation Framework

Linear Framework:-
•It is a very simple framework.
•Only Record and Playback is done in this framework.
•It is a beginner level framework.
•Capturing tests by recording the actions of a manual tester.

Modular Framework:
•The whole scenario is divided into small business flows-called module.
•Those modules are written in a library file as a functions or reusable actions.
•Main Script is linked with small module functions or reusable actions, more over this is a very simple approach over record and play back.
•Modular is nothing but to make the script reusable.


Data Driven Framework:-
• Repeated use of Test Scripts with different inputs.
• Separates out the test inputs (the data), usually into a spreadsheet, and uses a more generic script that can read the test data and perform the same test with different data.
• Testers who are not familiar with the scripting language can enter test data for these predefined scripts.
• Ease of Testing of Time consumption.

Keyword Driven Framework:-
• Steps and data are feed to the automation tool.
•Automation tool judges the steps and input data from a data pool, It gave the output data
•Spreadsheet contains keywords describing the actions to be taken (also called action words), and test data.
• Testers (even if they are not familiar with the
scripting language) can then define tests using the keywords.
• Very sensitive towards data.


Hybrid Framework:-
• Combination of keyword, data driven and modular framework.
• The main advantage is this is logic driven.
• Keywords are logic based.

Automation Testing

Automation Testing:-

•Testing software using software known as automation testing.
•Framework is a set of rule designed by the experts.
•There is no hard and fast rule to design a framework.
•Currently, IT industry has various frameworks in support of automation testing.

1) Linear Framework
2) Modular Framework
3) Data Driven Framework
4) Keyword Driven Framework
5) Hybrid Framework

Thursday, July 28, 2011

Sample Questions-Part 2-QTP

1) Which scripting language is used in QTP ?
  1.  Test Script Language (TSL)
  2.  Java Script
  3.  ASP
  4.  VB Script
2) Does QTP support Data Driven Framework ?
  1.  YES
  2.  QTP supports only Modular Framework
  3.  QTP is only Keyword Driven Framework
  4.  No


3) Select the Browsers NOT Supported by QTP ?
  1.  IE
  2.  Netscape
  3.  Safari
  4.  AOL

4) “Active Screen” Technology in QTP gives
  1.  Test Data
  2.  Checkpoints
  3.  Screenshots of Application Under Test (AUT)
  4.  Object Repository

5) Does the “Information” Toolbar in QTP 10.x give the Syntax Errors if any in the script ?
 YES
 NO
 It gives syntax errors only related to functions

6) Method to To count the no of rows in a table
 getrowcount
 getlinecount
 Getcount
 Count

7) Select Case statement is end with
 end case
 exit case
 esac
 end select

8) Object Repository is available in 3 modes viz.a) Per-Action Object Repository b) Shared Object Repository, c) Unshared Object Repository
 Both a & b
 Both a & c
 Both b & c
 Only a

9) What is the correct order of events in Test Script Creation ?
 Plan, Record , Debug, Enhance
 Plan , Record , Enhance , Debug
 Record, Debug , Plan , Enhance
 Record, Enhance, Debug , Plan

10) Which one is the default data type of QTP
 integer
 String
 Variant
 Double

11) To use the non-standard windows object, we can go for
 Object spy
 Virtual objects
 Object identification
 None

12) Select INVALID Checkpoint Type from the following
 Page Checkpoint
 Accessibility Checkpoint
 Object Checkpoint
 XML Checkpoint

13) To terminate the script execution, during running, QTP uses
 Exit run
 Stop run
 Quit
 None

14) BITMAP Checkpoint checks the property values of an image ?
 YES
 NO

15) Synchronization Point is used :-
 To delay QTP execution until Application Under Test (AUT) attains certain status
 To synchronize execution in multiple instances of QTP
 To synchronize per action and shared object repositories

16) Do statement always end with
 end while
 End do
 Wend
 Loop

17) By default a Datable contains :-
 One Action Sheet and One Global Sheet
 Two Global Sheets
 Two Action Sheets
 Two Action Sheets and One Global Sheet

18) Results Table (results of a test) is available in which following locations ?
 Test Script Folder
 Test Configuration Folder
 Test Results Folder
 Test Functions Folder

19) *.mts file contains :-
 Sequence and iterations of Actions to be executed
 User created library functions
 Per-Action Object Repository Files
 Parameter used in Actions

20) The feature of selecting different values of test data at run-time is called
 Synchronization
 Parameterization
 Smart Identification
 Transaction

21) Can Checkpoints be parameterized ?
 YES
 NO
 Maybe. Depends on the type of checkpoints

22) Can Test-Data in “Action Sheet” of Data Table be used from one action to another ?
 YES
 NO

23) Text Output Value -
a) outputs property value of any object
b) outputs text string appearing in AUT
c) outputs part of displayed text appearing in AUT
  
 only a
 only b
 only c
 both b & c

24) Select the valid types of Actions in QTP
a) Nested Actions
b) Shared Actions
c) External Actions
d) Reusable Actions
  
 both b & c
 both b & d
 both a & d
 both a & c

25) Can Actions inserted as “Call to Action” be modified by the test engineer?
 YES
 NO

26) Action Sheet (in Data Table) of an action inserted as “Copy of an Action” is editable only from the test from which they were created ?
 YES
 NO

27) Action Iteration is :-
 Number of times action would be executed every global iteration
 Number of time action would be executed in entire test execution
 Number of times all actions would be executed globally.

28) Choose the valid syntax to call Action 1 ( from Action 0) with input parameter “action_in” and store the output in a variable “MyVariable”
 RunAction 'Action1', oneIteration, Parameter(“action_in”), MyVariable
 RunAction 'Action0', oneIteration, Parameter(“action_in”), MyVariable
 RunAction 'Action1', oneIteration, MyVariable , Parameter(“action_in”)
 RunAction 'Action0', oneIteration, MyVariable , Parameter(“action_in

29) Can we use all standard Microsoft Excel features like Formulae, Formatting , Sorting etc in QTP DataTable ?
 YES
 NO

30) “Call to Copy” of an action can be inserted only for reusable actions ?
 NO
 YES

31) Parameterization of all Test data in a script can be done using
 Object Repository Manager
 Virtual Object Manager
 Data Driver
 Variable Driver

32) Are Nested Actions Call to one Action from Another ?
 YES
 NO

33) Is the Shared ( Global ) Action Repository the default repository in QTP ?
 YES
 NO

34) In a Per – Action (Local) Repository Action 1 and Action 2 in the same test script would have different object repositories?
 YES
 NO

35) The Share Action Repository is preferable when
 The Application Under Test is Dynamic with respect time
 The Application Under Test is Internet Environment
 The Application Under Test is Static

36) What is *.tsr file in QTP ?
 Object Repository Files
 VB Actions Files
 QTP Action Files
 Stores Test Data

37) Object Spy can be used to
 identify the Objects that can be identified by QTP
 identify the properties used for identification of objects
 identify the properties used for identification of objects in per-action repository
 identify the properties used for identification of objects in global action repository

38) Are Assistive properties used when mandatory properties are enough to identify an object ?
 YES
 NO

39) Are Ordinal Identifiers used when Mandatory and Assistive properties used by QTP are not enough to identify Object?
 YES
 NO

40) Select the Invalid type of Ordinal Identifiers Used by QTP
 Index Based
 Location based
 Creation Time
 Time Based

41) Does Index based ordinal identifier indicates the order in which the object appears in the parent window frame or dialog box relative to other objects?
 YES
 NO

42) Does Location based ordinal identifier indicates the order in which object appears in the application code relative to other objects?
 YES
 NO

43) Select the environments in which Creation Time ordinal identifier is used
 SAP
 Oracle
 Web
 Java

44) When a test is run in update mode, what is updated?
 The test results
 The object descriptions
 The action names in the test
 The logical names in the test

45) For identification of any object the choice of ordinal identifier selected can be modified in the Object Identification Window?
 YES
 NO

46) The Index Property value of Occurrence of the first object in source code is
 1
 a
 2
 0

47) Is Smart Identification is invoked when QTP cannot recognize an object using mandatory , assistive and ordinal properties ?
 Yes
 No
 Only in Web Environments

48) Select the type of properties used for Smart Identification
 Mandatory Properties
 Assistive Properties
 Base Filter Properties
 Smart Properties

49) Utility to measure the timing delays between transactions, we use
 synchronization
 sync
 services
 wait

50) Select the Invalid recording modes supported by QTP
 Low-level Recording mode
 Normal recording mode
 High-level Recording mode
 Analog recording mode

51) What does a breakpoint do?
 Stops test execution at the specified step, after executing that step
 Stops test execution at the specified step, before executing that step
 Pauses test execution at the specified step, after executing that step
 Pauses test execution at the specified step, before executing that step

52) Does Analog Recording mode, records exact mouse and keyboard operations ?
 YES
 NO

53) The RunAnalog function is used to run
 Tracks
 Functions
 Analog Functions
 Analog settings

54) Consider the QTP Script below
Window(“Calculator”).WinObject(“8”).Click 21,6
Window(“Calculator”).WinObject(“WinObject”).Click 14,13
In which mode is the script recorded ?
  Analog Recording mode
 Context Sensitive mode
 Low Level Recording mode

55) Virtual Objects are used when:-
 The objects do not exist in the Application Under Test
 Standard Objects cannot be recorded due to problems that arise during recording
 There are many objects of the same class in the Application Under Test

56) Consider the QTP Script below:-
On Error Resume Next
What does the above line of code do ?
  
 If an error occurs in the current line of script under execution , QTP proceeds ahead to the next step
 If an error occurs in the current iteration in script execution , QTP proceeds ahead to next iteration

57) Which of the following is an example of a missing resource?
 An object
 Run Results
 A Regular Action
 An External Action
58) To enter the non-executable statement in QTP , we use
 single quotes
 Rem
 double quotes
 Com