Answer List for HPUFT Questions (Part-1):-

1. 256 columns
2. We can’t save local OR it is saved by default .
3. Please refer the below :-

  • .QFL (Quick Test Function Library)
  • .QRS(Quick Test Recovery Scenario)
  • .TSR(Test Script Repository) , Friends we used to refer this as Test Shared Repository, but after clarification from HP Training team we got the right full form, in most of the internet material’s it is referred as Shared Repository but sorry to say that is wrongly given).
  • .MTR(Module Test Repository) on most of the websites it is again given as Mercury Test Repository, as per HP this is wrong) 

 4.Yes, don’t get me wrong just try out the following line of code in UFT, you can verify it:- 

  Dim var : var = 0
'Writing the IF condition without End if
IF var=0 THEN MSGBOX "Zero" ELSE "Non Zero"

 Thing is that we can avoid ENDIF, in case we are writing the IF condition in single line. 

 5. We can use either Keyword “REM” before the comment statement or symbol apostrophe i.e. ‘ 

 6. Below are the tools available in OR Manager:- 

  • Merge tool 
  • Comparison Tool 
  • Update from Local repository

 7.We can access Excel database in following ways:- 

A.Creating an object of Excel using CreateObject:-

Set objExcel = CreateObject("Excel.application") 'Creating excel object
objExcel.open "C:/Test.xls" 'Setting the path of the file to open
objExcel.Visible = True 'Making the opened Excel file visible

B.Using the ADO database object

Dim str
str = "C:/Test.xls" 'Excel Path
Set objADO = CreateObject("ADODB.Connection")
Set objRS = CreateObect("ADODB.RecordSet")
ObjADO.ConnectionString = "Driver = {Microsoft Excel Driver(*.xls)};DBQ="&str
ObjRS = ObjADO.Exceute("Select * from Sheet1")
Do until EOF
'Fetching the data from excel until data exists
Loop
Obj.RS.Close
ObjADO.close


 8. Mandatory Properties -> Assistive Properties -> Visual Relation Identifier->Ordinal Identifier->Smart Identification. 
 9. This property doesn’t exist, if we think logically how can we set Runtime property of a Real object in application 
 10. By using “GetRoProperty” in a weblist. Browser ().Page ().Weblist ().GetRoProperty (“items count”)

More uft/selenium Questions

How to Crack HP UFT – Automation interviews easily ?



From our experience we came across some of the questions which we never thought of preparing or are even never expected that our interviewer will ask such alien puzzles. In such situation we are left with ridiculous options like “I never came across this” or “I can’t remember” or “I don’t know” (generally this is the hardest part to accept, and it has major role to play in cracking the interview). So below are very few such questions. We request our readers i to contribute to this list thus all of us, as community  can grab appropriate opportunities.


Some important UFT interview questions (Part-1):-
1. How many number of Columns can we have in a Datatable?

2. How we can save Local Object Repository?

3. Various full forms of extensions (.qfl, .qrs, .tsr, .mtr)?

4. Can we have IF condition without End if?

5. Various methods of commenting a statement in UFT?

6. Please tell the various tools available in Object Repository manager?

7. Can you please tell the various ways to access the Excel datasheet?

8. Sequence of steps followed by UFT to identify object in an application?

9. How to use “SetRoProperty” in UFT?

10. How can we access number of items in a weblist?

Answers Part – 1

Learn More and Share More

Call to Existing Action in UFT ?

What is a Action in UFT ?

Action is a logical set of statements which provides structure to our automation testing.In simple words,Actions help us divide our test into logical parts.For instance our Application = ‘Booking Tickets”, can have action’s like Login to application, Book the ticket, Credit card payment and Logout .
Thus we can say an Action represents any specific activity that user performs
on an application.
Layman Example:-

UFT contains a  Test(Like Prime Minister of a country) and it comprises of multifarious actions(Like different department heads in a country, such as Finance,Education,Foreign ministers).


Now Test i.e. head of a country can call any minister (action) 
and these ministers (actions) can further call other ministers
(actions).

In nutshell everything is interrelated. Even a Prime minister holds
one ministerial position, on the similar track, by default Test 
contains a call to a single action. By creating test that call multiple actions, we can design test that are more modular and efficient. As for running a country single prime minister cannot handle all the things so it requires numerous ministers to make government run in a smooth manner so One Test comprises of single modular unit’s i.e. our  action.

By default each test in UFT represent one Action.

Function v/s Action in UFT?

Difference Action and Function in UFT
Function v/s Action in UFT



Action calls:

How we can include actions in our Test.

1. Call to copy of action.
2. Call to new action.
3. Call to Existing action.


Action call types in UFT
Action Call types in UFT

From the above picture we can make out the difference in the icons of all the action call types avaiable in UFT.

* symbol in front of “Call to New Action” depicts Inserting a New Action.

Call to copy of Action is like Inserting a local copy of an existing action, so we can edit and do any changes in the local copy, without affecting the original copied action.
+ symbol in front of “Call to Existing Action” depicts Inserting a call to existing re-usable action, we cannot edit it and all its components (datatable,OR) comes as readonly.

In our below example we have taken “Call to Existing Action”:


Methods to Add, Call to Existing Action:-

Approach 1:-
Select Design -> Call to Existing Action.

Add Action in UFT
Menu Bar insertion of “Call to existing action”




Approach 2:-
 In the Solution Explorer, right-click a test and select Call to Existing Action.

Adding Action in UFT from Keyword View
Keyword View


Approach 3:-
In the canvas, right-click anywhere and select Call to Existing Action.

Adding Action from Canvas in UFT
Canvas view


Approach 4:-
In the Record tool bar  click the Insert Action Call down arrow 
and select Call to Existing Action during a recording session

Call to Existing Action in Editor UFT
Editor(Expert view in QTP 11) 


Important Usage Points (Call to Existing Action):

i) We can insert a call to a reusable action that is stored in your current test (local action), or in any other test (external action).
Select Action window in UFT
Selecting the local or external action for “Call to Existing action”

Setting Relative/Absolute path in Action of UFT
Setting the relative path.



ii) Inserting a call to an existing action is similar to linking to it.Thus we can view the steps of the action in the action view, but we cannot modify them. The called action’s local object repository (if it has one) is also read-only. 

Datatable is coming as Read only
Called Action Data table is Read Only in called action.

iii)To modify a called, external action, you must open the test with which the action is stored and make your modifications there.

Properties Pane of Action in UFT
Properties pane to look the External Action properties/Add Parameters/Test  used(Right click on Action->Properties)

iv) The modifications apply to all tests that call that action. 
v)If we chose to use the original action’s data when we call an external action, then changes to the original action’s data are applied as well.


Real meaning of Regular Expression’s(RG’s)



It is a way of representing data using symbols, which are in the form of special characters like ‘*’,’ +’, ’.’,  ’’.

 Further these characters are used for search of particular pattern in strings.

RG’s in UFT:

These are used in UFT to identify objects and text strings with varying values very useful in dynamic objects.

Usage: 

1. Defining Properties of an Object. (Object Repository)

2. Pattern matching in Check points.

3. Parameterize an object property or check point



Test:
We can test pattern match using “Regular Expression Evaluator”

Tools>Regular Expression Evaluator.

RG



Screenshot of window: RG evaluator


Using RG in UFT:

1. We can define a regular expression for a constant value, a Data Table parameter value, an Environment parameter value, or a property value in Descriptive programming.

2. We can define a regular expression in standard checkpoint to verify the property values of an object;we can set the expected value of an object’s property as a regular expression so that an object with a varying value can be verified.

3.We can define the text string as a regular expression, when creating a text checkpoint to check that a varying text string is displayed on our application,
4.For XML checkpoints we can set attribute or element values as regular expressions.

Types of RG’s:

i) Backslash Character:

 A backslash () can serve two purposes. It can be used in conjunction with a special character to indicate that the next character be treated as a literal character.

For example, UFT recognizes n as the special newline character. 

Alternatively, if the backslash () is used in conjunction with some characters that would otherwise be treated as literal characters, such as the letters n, t, w, or d, the combination indicates a special character. 

For example, w matches the character w
w is a special character that matches any word character including underscore.
Practical example:-
In the URL of a blog  http://uftautomation.blogspot.in/,
The period would be mistaken as an indication of a regular expression. To indicate that the

period is not part of a regular expression, you would enter it as follows:
uftautomation.blogspot .in

ii) Matching Any Single Character:

A period (.) tells UFT to search for any single character (except for n).
For example:

RG:Train.
Matches Trains, Trained, or Train followed by a space or any other single character.
 
iii) Matching Any Single Character in a List:

Square brackets [] instruct UFT to search for any single character within a list of characters.
 
For example:
To search for the Year 2013, 2019, or 2015,
RG: 201[359] 
iv) Matching Any Single Character Not in a List:

 When a caret (^) is the first character inside square brackets, it instructs UFT
to match

 any character in the list except for the ones specified in the string.
For example:
 
RG: [^13]
 
Matches any character except 1 or 3.
 
v) Matching Any Single Character within a Range:

 To match a single character within a range, we can use square brackets ([ ]) with the 

hyphen () character.
For example: For matching any number in the range 1000s,

RG: 100[0-9] 

Screenshot: We are looking for 3 digit number between (130 -149)
RG: [1][3-4][0-9]
RG example for Range


vi) Matching Zero or More Specific Characters:

 An asterisk (*) instructs UFT to match zero or more occurrences of the preceding 

character.

For example:
RG: ma*n 

Matches man, maaaaaan, and ma
vii) Matching One or More Specific Characters:

 A plus sign (+) instructs UFT to match one or more occurrences of the preceding 

character.
For example:
 
RG: ma+n
 
Matches man and maaaaaaan, but not mn.
 

viii) Matching Zero or One Specific Character:

A
 question mark (?) instructs UFT to match zero or one occurrences of the preceding 

character.
For example:
 
RG: ma?n
 
Matches man and ma , but nothing else.
 
ix) Grouping RG:

 Parentheses (()) instruct UFT to treat the contained sequence as a unit, just as in 

mathematics and programming languages. Using groups is especially useful for delimiting
 the argument(s) to an alternation operator ( | ) or a repetition operator ( * , + , ? , { } ).
x)  Matching One of Several RG’s:

 A
 vertical line (|) instructs UFT to match one of a choice of expressions.
xi)  Matching the Beginning of a input:

 A caret (^) instructs UFT to match the expression only at the start of a line, or after

 a newline character.

xii)  Matches the end of input:

A dollar sign ($) instructs UFT to match the expression only at the end of a line, or before a newline character.

xiii)  Matching Any Alphanumeric Character Including the Underscore:

 w instructs UFT to match any alphanumeric character and the underscore any combination

 of (A-Z, a-z, 0-9, _).
xiv)  Matching Any Non-Alphanumeric Character:

 W instructs UFT to match any character other than alphanumeric characters and 

underscores any combination other than (A-Z, a-z, 0-9, _).

Some other cardinal RG’s:
a) Matches a digit character : d, it is  Equivalent to [0-9].
b) Matches a non-digit character: D, it is Equivalent to [^0-9].
c) Matches a newline character: n
d) Matches a carriage return character: r
e) Matches a tab character: t