Wednesday 30 April 2014

UFT - QTP - What is Insight Recording


UFT introduced a new recording mode called Insight Recording which is a recording option available along with other recording ( Default, Analog, Low level)

UFT Insight recording recognizes controls based on their appearance, and not their native properties

This can be useful to test controls from an environment that UFT does not support or even from a remote computer running a non-Windows operating system.

When UFT runs the test or component, it recognizes the controls in the application by matching them to the images saved with each of the Insight test objects.

The Image below shows a sample of Insight Recording on Windows 7 Desktop over couple of Documents and folders.

Note : - Insight test objects are always created as children of the UFT test object that contains them. You can then move the InsightObject under a different parent object in the Object Repository.




Users can also change the Insight object image by clicking on the "change test object image" option present in OR object property





The following operation can be performed on Insight objects
Mouse operations like click, dblclick, drag, drop , Hover etc
GetTOProperty, GetROProperty, GetROProperties, SetTOProperty, waitproperty, ToString, Type etc

Users can also use the Exist property to check if the Insight Object exist

Regards,
Sreenu Babu

UFT - QTP - What is hapens when an actions is created

Call to New Action... can be done in multiple ways
1) Using UFT Design menu - Call to New Action
2) Using UFT Test Flow - User need to perform Right mouse click to bring up the menu in which has "Call to New Action" option
3) Using UFT Test Flow - User need to select any existing action and perform right mouse click as in the below snapshot
4) Using UFT Expert View - User need to perform right mouse click to bring up the menu with Action --> Call to New Action..

So what happens when a user click on Call to New Action...






1)  "Insert Call to New Action" dialog will be shown and user can provide the Name and Description for the new action.
2)  Please remember every new action is by default "Reusable Action" and user can Uncheck that if they want to make it Non Reusable
3) By default every new action will be inserted at the end of the test

Also

4) A new folder will be created for the action with default action name ( New action folder will be created under the test folder path)
5) A Script.mts file will be shown under the newly created folder
6) PerAction Repository is created
7) A new datatable sheet will be added to the DataTable with the Action Name




When I Clicked on Insert Call to New Action.. "Action2" folder is created and is shown in figure below

Above snapshots shows the "Action2" folder content

Happy Reading,
Sreenu Babu

QTP - UFT - How to open a browser with google.com as url using VBSript

This question is some time confusing for on going interview guys.

How to open a browser with google.com as url using VBSript or How to open a browser with google.com using UFT or QTP.

Answer is simple


Syntax
Set o1= Createobject("InternetExplorer.Application")
o1.Visible = true
o1.Navigate "www.google.com"
Set o1 = nothing


Regards,
Sreenu Babu

Tuesday 29 April 2014

UFT - QTP - How do you find the number of links in a page





 Assume we are want to find all links on "Uftquestions.Blogspot.in" page.

Set objPage = Browser("name:=UFTquestions.*").page("title:=UFTquestions.*")
Set objLink = Description.Create
objLink("micclass").value = "Link"
Set objChildLink = objPage.ChildObjects(objLink)
msgbox objChildLink.count


You may try for any other pages by Replacing the "UFTquestions.*" with any other Page title where ".*" represents regular expression.

Message box will show you the number of links on the page.

Regards,
Sreenu Babu

QTP - UFT - What are the type of parameters available in QTP - UFT for passing values - Action Parameters and Test Parameters






Answer : - Action Paramters and Test Parameters
Syntax for Action Parameter
 Action Parameter - Parameter("ParameterName")
'Example :- Parameter("Sample")
Syntax for Test Parameter
Test Parameter - TestArgs("ParameterName")
'Example:- TestArgs("Sample")
It is some time hard for users to figure out where we can find these test parameters and actions parameters and their difference. Please see the Video below to know the difference

  





For those who have difficulty in viewing this video on this page ... here is the Youtube link.
http://youtu.be/CeQ9nEOU4eA





  

Sunday 27 April 2014

Can you create a ALM - Quality Center Connection using OTA object

We can use QC/ALM OTA Object "TDApiOle80.TDConnection" to establish connection. Please see the code below

Syntax
Dim ALMConnection
'Return the TDConnection object.
Set ALMConnection= CreateObject("TDApiOle80.TDConnection")
ALMConnection.InitConnectionEx "http:///qcbin"
ALMConnection.login "<username>""<password>"
'DEFAULT = Domain, QualityCenter_Demo = Project
ALMConnection.Connect "DEFAULT""QualityCenter_Demo"


Note: "http://qcbin" url should be replace with the correct ALM Server URL. User may enter they Quality center / ALM username and password in the "<username>" and "<password>"


Regards,
Sreenu Babu



 

QTP - UFT - How to open a text file using VBScript or How to open a flat file using VBScript





Open text file can be opened using "Scripting.FileSystemObject"

Syntax
filename = "c:\sample.txt"
strmode = 2
Set o1 = Createobject("Scripting.Filesystemobject")
If o1.FileExists(filename) = true Then
    set r1 = o1.OpenTextFile filename,strmode
 else
    ExitTest
End If
Msgbox r1.readall()

strMode represents the File Read mode and Any Text file can be opened in the following modes

ForReading  1  Open a file for reading only. You can't write to this file.
ForWriting 2 Open a file for writing.
ForAppending 8 Open a file and write to the end of the file.


UFT - QTP - How to get certain part of string using VBScript




 

 
 

We Can use the mid method
'output = Mid(InputString, StartPosition, NoofCharacterRequired)

Syntax
output = Mid("UFT is Great Fun", 5, 5)
Msgbox output

Alternate method

' Comments
'Extract a substring between a "Pre" substring and an "Post" substring.
'e.g.  Util_Text_SubStr("This is my string", "is ", "r")
' will return "is my st"

Function  Util_Text_SubStr(ByVal sString, ByVal sPre, ByVal sPost)
    Dim nStart, nEnd
    Util_Text_SubStr = ""
    If VarType(sString) <> vbString Then
        Exit Function
    End If
    nStart = instr(1,sString,sPre,vbTextCompare)
    If nStart = 0 Then
        Exit Function
    End If
    nStart = nStart + Len(sPre)
    If nStart > Len(sString) Then
        Exit Function
    End If
    If Len(sPost)>0 Then
        nEnd = instr(nStart,sString,sPost,vbTextCompare)
        If nEnd = 0 Then
            Exit Function
        End If
        nEnd = nEnd-1
    Else
        nEnd = Len(sString)
    End If
    If nEnd > nStart Then
        Util_Text_SubStr = mid(sString,nStart,(nEnd-nStart)+1)
    End If
End Function

Happy reading,
Sreenu Babu




QTP - UFT - How to create a text file using VBScript


 
We can use "Scripting.FileSystemObject"

strfilepath = "C:\Sample.txt"
Set obj = Createobject("Scripting.FileSystemObject")
If obj.FileExists(strfilepath)  = false Then
 obj.CreateTextFile strfilepath,true
End If
Set obj = nothing


Note:- To run the script copy and paste the script in Notepad and save it with extension ".vbs". Example "CreateFolder.vbs". Double click the file to run the script.

Or

Copy and paste the script in UFT / QTP and press F5 ( i.e. Run Button)
 
Happy Reading,
Sreenu Babu




 




 















QTP - UFT - How to create a folder using VBScript

We can use "Scripting.FileSystemObject".

Syntax
strFolderpath = "C:\SampleFolder"
Set obj = Createobject("Scripting.FileSystemObject")
If obj.FolderExists(strFolderpath) = false Then
 obj.CreateFolder strFolderpath
End If
Set obj = nothing


Note:- To run the script copy and paste the script in Notepad and save it with extension ".vbs". Example "CreateFolder.vbs". Double click the file to run the script.
Or
Copy and paste the script in UFT / QTP and press F5 ( i.e. Run Button)
 

QTP - UFT - How to count number of occurances of a string in a statement






We can use  regular expression.

Syntax
inputstring = "This String has multiple statements and each statement has multiple occurrences"
Set o1 = new RegExp
o1.pattern = "statement"
o1.ignorecase = true
o1.global = true
Set r1 = o1.execute(inputstring)
msgbox r1.count


QTP - UFT - How to use regular expressions?



How to use regular expression - code please to find a some sting in a large string
Regular expressions are very handy with Scripting and can be used in multiple ways. I would like to present once scenario on its usage.

Syntax
inputstring = "This Blog helps you with learn and test your skills on UFT"
Set o1 = new RegExp
o1.pattern = "learn"
o1.ignorecase = true
o1.global = true
Set r1 = o1.execute(inputstring)

For Each Match in r1
  Flag =1
  str = str & Match.firstindex & " - "
 Next
If Flag =1 Then
 msgbox "match found at locations " & str
End If

Saturday 26 April 2014

UFT Interview Questions or QTP Interview Questions


 Mandatory Questions to read before any UFT/QTP Interview
  1. What type of testing's can be performed using UFT or QTP?
  2. How does UFT Recognize objects?
  3. How GUI Test interact with Web Service Tests in UFT?
  4. Difference between UFT 11.52 and UFT 12?
  5. What is Solution in UFT?
  6. Does Object Spy Support object addition to OR directly? If so to which OR?
  7. What is Dim
  8. What is Redim
  9. What are type conversion function
  10. How to verify a file exists or not
  11. How to verify a folder exist or not
  12. How to connect to excel using Datatable
  13. How to resize a array
  14. What is a framework - what is your framework like
  15. How does QTP identify objects
  16. How to create a Database connection using QTP
  17. Explain about the different type of checkpoint you know
  18. Can you add any vbs file as part of recovery scenario
  19. When can you start automation
  20. Can all part of application be automated
  21. How to read flat files
  22. What is a difference between action properties and Action call properties
  23. Can you set no of iteration for an action to execute? How ?
  24. What are transaction points
  25. Can you explain about Reporter.Report event
  26. What are the recording modes you have in QTP ? Can you explain the differences in them
  27. What is object repository manager how can you use it ?
  28. How does object repository holds objects
  29. What is difference between QTP 10 and QTP 11
  30. How many type of actions calls are their
  31. What is difference between Byval and Byref
  32. What is difference between function and action
  33. What is difference between function and subprogram
  34. How do you associate function libraries in QTP
  35. What is debug viewer
  36. What is difference between stepinto , stepout and stepover
  37. What is a step generator
  38. What is the use of "with statement'
  39. What is a component in BPT
  40. What is BPT automation process
  41. Does BPT need special license from HP to work with QTP scripts
  42. What is application area in BPT
  43. What are the file extension supported by QTP for writing function ( Answer is - QFL and VBS)
  44. What are the default checkpoints visible for insertion any time (Answers is - database checkpoint , XML checkpoint from resource and File Content checkpoint)
  45. What is type casting in QTP/VBS
  46. Can we call Win runner scripts in QTP ? Have you work with Winrunner scripts
  47. How to insert a break point in QTP and how to remove breakpoint in QTP
  48. How do you give estimations for a Application automation
  49. How to comment a statement in qtp
  50. Can you tell me multiple ways to run a application
  51. Have you heard about mercury.device replay object
  52. Can you write a script to sort content of array
  53. Can you write a script to merge two strings
  54. How to copy cells content from one to another
  55. How to manipulate dates
  56. How to add date and time to current date and time
  57. List the content of Automation approach document
  58. How to configure UFT with Bluezone Emulator
  59. How to configure a flex application with UFT or QTP
  60. How to maximize a browser using UFT or QTP

Note: I will be posting answers shortly. Please search the blog for answers to these questions (or) you can click on the question to get the answer. I will be updating the Question Bank and Answers to questions regularly. If you cannot find any answer to any of the questions above and need answer immediately please drop me a comment. Thanks!!!

Happy Reading & All the best
Sreenu Babu

Friday 25 April 2014

QTP - UFT - Configuring & Working with TE Add-in


 
 
 

 
Configuring & Working with TE Add-in with UFT ( BlueZone)

In Configuring Blue Zone there are two major steps
  • Configure UFT
  • Configure BlueZone VT
Configure UFT

Steps to Configure UFT:-
  1. Open UFT -> Tools -> Options -> GUI Testing
  2. Select Terminal Emulator
  3. Select Vendor “Seagull “
  4. Select Emulator “BlueZone5”
  5. Select Protocol “AutoDetect”
Validate your selection by clicking on validate 
Note: - This approach also works for BlueZone Installer Version 5 and above

Configure BlueZone VT
Prerequisites:- 
Select an existing VT in BlueZone mainframe Display and save it with Name “A” 
Steps to configure BlueZone VT
  1. Open BlueZone Main Frame display using VT “A” ( I.e. previously saved)
  2. Select File Properties -> Title Bar
  3. Select HLLAPI Short Name
  4. Remove any other selection on File Properties -> Title Bar except HILLAPI Short Name
  5. Close File Properties
  6. Select Option -> API in BlueZone Main Frame display for VT “A
  7. In Options Tab -> High Level Language API (HLLAPI) Set the Short Name Session Identifier : as “A
  8. Select “Auto – Launch the BlueZone DOS HLLAPI Redirection
  9. Select “Allow Multiple Simultaneous connections
  10. Remove any other selected fields on the option tab
  11. Click on Apply and OK to close the Options

Note: - Please follow the exact steps as stated above. Now you are ready to go with BlueZone and UFT.

 

Thursday 24 April 2014

Major difference between UFT and QTP


One word answer :- UFT is the combination of HP QTP and HP Service Test

UFT User Interface resembles like Microsoft Visual studio interface and it provides support for mobile testing, new add-in's, Additional Browser and Operating system support.