Example of Descriptive Programming using Regular Expressions

Scenario:-

AUT:- http://in.finance.yahoo.com

Test Steps:– Fill company name and click on “Get Quotes”.New page loads and click on “Historical Prices”

Solution:-
We will use “Descriptive Programming” and “Regular Expressions” to solve the problem in a easy and smart way.

Step1:- Look for unique properties to identify the objects on the page
Step2:- Use “Regular Expressions” to solve the problem of redefining the page objects when new page opens.

Code Part:- 

‘Creating the Page object using DP and RG Expressions
Set objYahoo = Browser(“CreationTime:=0”).page(“url:=http://in.finance.yahoo.com.*”)

 
‘Function call to search stocks
fnStocks “infy”

Public function fnStocks(sCompany)

‘Setting the compnay name and clicking on Get Quotes
objYahoo.WebEdit(“html id:= txtQuotes”).Set sCompany

‘Clicking on the get Quotes button
objYahoo.webbutton(“html id:= btnQuotes”).Click

‘Clicking on historical data link and doing error handling

If objYahoo.link(“text:=Historical Prices”,“html tag:=A”).Exist(5) Then
    objYahoo.link(“text:=Historical Prices”,“html tag:=A”).Click
    reporter.ReportEvent 0,“Historical Data”,“Available for the company = “&sCompany
else
    reporter.ReportEvent 1,“Historical Data”,“Not Available for the company = “&sCompany
End If

End Function
 

UFT interview Questions

UFT interview questions
UR 1st Testing Help

1.What is the difference between Action and Function in UFT?

2.Explain the difference between image and Bit map check point?

3. Difference between verification and validation ?

4.Methods available in Reporter utility object?

5.How to get last four digits of “UFTHELP”?

6.Regression v/s Re-Testing?


Hints:-
1.Action is a concept of UFT while Function is related to VBscripting.

2.Image checkpoint is used to check the “Property Values” of an image(like alt), Bitmap checkpoint is used to check an area of a web page or an application after capturing it as a bitmap so that it can be compared with the expected and the actual bitmap

3. Checking that a “shoe” is of given size = Verification , Wearing shoe and checking the size is validation

4.ReportEvent, ReportNote

5.Using vb scripting “Right” function:- Right(string,4)

What does outstanding Automation(Job) means?

I came across a magnificent presentation of taking initiative while doing your regular task.


What does Outstanding Automation mean???




Thought of sharing this with automation lovers, as we can relate same thing  to the concept of doing our task manually or by automation process.Whether we’ll be doing same task again and again (Crossing the river each day, taken from example in PPT ) or we are looking for easier options i.e. automating the given task.

Please have a look and hope we can apply this in our day to day, repetitive manual tasks.

Initiative Outstanding Job_what does it mean

QTP-10 v/s QTP-11 v/s QTP-11.5 v/s UFT-12

We tried to differentiate these 4 version of the product based on the new enhancements and features .

QTP vs UFT



 QTP-11:-

  • New Results Viewer
  • Visual Relation Identifier
  • Log Tracking functionality helps you work with developers to pinpoint the root causes of unexpected behavior in your application
  • QuickTest 11.00 provides Web Add-in Extensibility-based add-ins for ASP .NET Ajax, GWT, Yahoo UI, and Dojo Web 2.0 toolkits
  • XPath and CSS based object identification(Used in Selenium)
  • Load Function Libraries at Run Time 
  • Automatically Parameterize Steps
  • New Silverlight Add-in to test objects in Silverlight 2 and Silverlight 3 applications. 
  •  Extended WPF and Silverlight Support 
  •  New Object Spy Functionality 
  •  Compare, Merge, and Export Object Repositories with Checkpoints and Output Values
  •  Add Images to Your Run Result 
  •  FireFox-3.5( Record Support) ,Internet Explorer 8

  UFT-11.5(QTP-11.5) :-

Launching UFT-11.53
UFT-11.53
  • One Unified Tool for GUI + API testing (Merger of QTP + Service Test)
  • Modern IDE:- Solution Explorer,Canvas-Style Test Flow 
  • MDI: Edit Multiple Testing Documents Simultaneously 
  • Insight: Image-Based Object Identification 
  •  File Content Checkpoints(New checkpoints for PDF, HTML, Word, TXT, and RTF files) 
  • Support for MSAA-Based (Microsoft Office and Plug-in) Controls 
  • Export GUI Tests from Sprinter Exploratory Tests(From XML) 
  • New GUI Testing Support for Qt and Adobe Flex Applications 
  • Test your work against an SAP server by importing IDocs and RFC definitions from your SAP systems(API)
  • Debug Steps Using the Run Step Command (API)
  • Use Your soapUI Tests in UFT (API)
  • Automatically Export Run Results
  • Record Toolbar 
  • Supports storing and managing your GUI tests in SAP Solution Manager
Versions of UFT-11.5
Various Versions of UFT-11.5

  UFT-12(QTP-12) :-

Launching UFT-12.01
UFT-12.01
  • It comes with a new installation package, facilitating the faster and secure installation.For instance, reduction in size of whole package, all add-ins are installed with a single silent installation command and without the need to restart .
  • Running of GUI test on Safari for remotely connected Mac Computer.It comes with exceptions like, we need to record the test locally on browser.
    RemoteObjectSpy
    Remote Object Spy

    Note:-Apply the new Remote Object Spy to spy on Web applications running on Safari.

  • Conditioned uploading of Run Results to ALM After a Run Session, this feature comes with ALM-12,as a ALM site admin we can can now set a site parameter that guides UFT to upload results only when set conditions is met.
  • Testing Extensibility now supports Visual Studio 2010 and Visual Studio 2012.
  • Windows Runtime Add-in(UFT-12.01),used to test Windows Runtime applications running on Windows 8.x or Windows Server 2012.This addin is not listed in the Addin-Manager.We need to enable the UFT4WinRT service, for utilizing its testing support.
    Note:-A Windows Runtime application is any application running from the Start or Apps screen in Windows 8.x/Windows Server 2012 and installed from the Windows Store.
  • New Support for Siebel Open UI and  SAPUI5 applications(UFT-12.01), it comes with a child add-in of the web add-in.
  • Addin Manager
    Addin Manager

  • GetVisibleText method for Insight Objects.(UFT-12.01)
  • ExportSheet Method, have optional Destination sheetname.(UFT-12.01)
  • Export Method
    ExportSheet

  • Internet Explorer 11 extended protected mode support(UFT-12.01)

Math functions in UFT

Following is the list of  important Math functions in Vbscripting in UFT:-

  • Abs 
  •  Atn
  •  Cos
  •  Exp 
  •  Fix 
  •  Int 
  •  Log 
  •  Rnd 
  •  Sgn 
  •  Sin
  •  Sqr 
  •  Tan

VB-Scripting CDate v/s IsDate function

Function Name:- Cdate

Meaning :- Returns expression in the form of variant date.

Syntax:- Cdate(date)

  • date argument should be valid date format
  • CDate recognizes date formats according to the locale setting of your system.

Function Name:- IsDate

Meaning :- Returns Boolean value, telling whether date conversion of expression is possible or not

Syntax:- IsDate(expression)

  • Returns “True” incase conversion is possible , else returns “False”

Example:-

  • Dim sDate,sTime ‘Delcaring Variables
  • sDate = “May 22, 2013” ‘Delcaring Date 
  • MsgBox CDATE(sDate) ‘Returns Date As per your local system date Format
  •  MsgBox ISDATE(sDate) ‘Returns “True” 
  • sTime=”22:14:12PM” ‘Declaring Time 
  • MsgBox CDATE(sTime) ‘Returns time as per your local system timing format 
  • MsgBox ISDATE(sTime) ‘Reurns “True” 
  • sDate = “UFTHelp” ‘Passing invalid dates 
  • MsgBox ISDATE(sDate) ‘Returns “False”
  • MsgBox CDATE(sDate) ‘Returns Runtime error

VB-Scripting Asc v/s Chr Function

Function Name:- Asc

Meaning :- Used to get ANSI character code of “First” character of the string.

ANSI:- American National Standards Institute. Chart of ANSI

Syntax:- Asc(String)

  • No Arguments are given runtime error occurs

Function Name:- Chr

Meaning :- Used to get character associated with  ANSI character code(Reverse of Asc)

ANSI:- American National Standards Institute. Chart of ANSI

Syntax:- Chr(code)

  • Code :- ANSI number for a character


Example:-

  • Msgbox Asc(“A”) ‘Returns ANSI value = 65 
  • Msgbox Chr(65) ‘Returns character value = A 
  • Msgbox Asc(“ufthelp”) ‘Returns ANSI value of ‘u’ 
  • Msgbox Chr (117) ‘Returns ‘u’ 
  • Msgbox Chr() ‘Throws Exception 
  • Msgbox Asc() ‘Throws Exception

Working with Excel Object Model in UFT

In this video tutorial we are going to discuss, working with Excel in UFT using our “Excel Object Model“.

Topics discussed:-

  • Understanding Excel object model(Application, Workbooks, Worksheet,Cell)
  • Creating the corresponding objects for accessing Excel objects
  • Fetching single cell data from excel
  • Fetching data from complete Excel
  • Writing data into Excel Cell
  • Changing the Font color of cell in Excel
  • Changing the Background color of cell in Excel


Excel object model in UFT
Understanding Excel in UFT

Sample Code Snippets:-

'Creating the Excel Object
set objExcel = createobject("excel.application")
'Creating the Workbooks object
set objWB = objExcel.workbooks.open (Path of Excel)
'Creating the sheet object
set objsheet = objwb.worksheets(SheetName)

'Changing the backgound color all the populated cells in sheet
for i= 1 to objsheet.usedrange.rows.count
for j = 1 to objsheet.usedrange.columns.count
objsheet.cells(i,j).interior.color=vbred
next
next
'Saving the workbook after changes
objWb.save
'closing the workbook

objWB.close
'Quit the Excel and destroying the Excel object
objExcel.Quit
set objExcel=nothing





Incase below video is not loaded, Click Here




How to copy Data from Notepad and Paste into Excel
Code for Adding Hyperlinks in Excel
How to get column address from column Name in Excel
How to Randomize Excel data?

Addin for UFT-11.5 , QC/ALM integration.


What is Unified Functional Testing Add-in ?

The Unified Functional Testing Add-in integrates ALM and Quality Center with Unified Functional Testing (UFT), enabling you to do the following using Quality Center or ALM:

  • Create UFT GUI tests and add them to the test plan tree
  •  View UFT tests
  •  View UFT test or component resources (such as object repositories, function libraries, and data sheets) 
  • View and compare details of selected UFT test and resource versions 
  • Launch and edit UFT tests (if UFT is installed on the same machine) 
  • View UFT test run results and reports



 It is also recommended that you check your HPSU application (automatically installed with UFT) for any updates to the UFT Add-in for Quality Center/ALM.

 Note: The functionality provided by the Unified Functional Testing Add-in is included in the Unified Functional Testing for Business Process Testing Add-in. If you have already installed the Unified Functional Testing for Business Process Testing Add-in on your ALM or Quality Center client machine, you do not need to install this add-in.


Installation Instruction:-

  1. Install UFT on your HP ALM client machine. (This optional step enables you to launch and edit tests from HP ALM.) 
  2.  Uninstall any previous versions of this add-in. 
  3. To uninstall, choose Start – Settings- Control Panel- Add/Remove Programs and follow the instructions on your screen.
  4. Make sure that the .NET Framework 4.0 and .NET Framework 3.5 SP1 is installed (available from Microsoft Windows Update).
    • .NET Framework 3.5 SP1
    • Windows Installer 3.1
    • Windows Imaging Component
    • Visual Studio Tools for Office System 3.0
    • Runtime Visual C++ 2005 Service Pack 1 Redistributable Package
    • Visual C++ 2008 Redistributable Package
  5.  If you are installing the add-in on an HP ALM client machine and UFT 11.50 is not installed on the same machine, you must install the following from Microsoft Windows Update.
  6.  Click the Download UFT 11.50 Add-in link to download and install this add-in on your client machine. Note that to install this add-in, you must log in with administrator privileges.
  7.  Install the appropriate HP ALM Connectivity Add-in on your HP ALM client machine. For more information, refer to the HP Application Lifecycle Management Add-ins page.

Quality Center/ ALM Versions Supported 
 HP Quality Center 10.00, HP Application Lifecycle Management 11.00, and HP Application Lifecycle Management 11.50 with the ALM Integration Enablement Pack

 Note: If you are installing the Unified Functional Testing 11.51 Service Pack Add-in for ALM, you must also install the Unified Functional Testing Run Results Viewer 11.51 Service Pack patch on the same computer.

Downloading Addin
Configuring Terminal Emulator in UFT

Reference:-www.HP.com

Vb-Scripting Array Function

Function Name:- Array

Meaning :- Used to creating Arrays(Returns Array type Variant)


Syntax:- Array(Arguments)

  • Arguments are comma separated 
  • No Arguments are given 0 length array is created


Example:-

  • Dim aNum
  • aNum = Array(“Helping”,”People”,”Learn”,”uftHelp.com”)
  • Msgbox aNum(0) ‘Returns Helping
  • Msgbox aNum(1) ‘Returs People
  • Msgbox aNum(2) ‘Returns Learn
  • Msgbox aNum(3) ‘Returns uftHelp.com
  • Msgbox aNum(4) ‘Throws Subscript out of range exception as Array has 4 values

Difference between Array and Dictionary
Interview Questions on Array?