Welcome To Automation Testing

Before starting with tips of automation of SAP using QTP Let me give a small introduction of SAP and QTP.

SAP stands for System Applications and Products. It is the name of both the online financial and

Administrative software and the company that developed it. SAP is made up of individual modules that perform various organizational system tasks.



Quick Test Professional (QTP) is an automated functional Graphical User Interface (GUI) testing tool that allows the automation of user actions on a web or client based computer application.

It is primarily used for functional regression test automation. QTP uses a scripting language built on top of VBScript to specify the test procedure, and to manipulate the objects and controls of the application under test. It supports many applications through the support of add-ins.



We will be using SAP add-in with QTP to work on the SAP automation.

Thursday, 28 March 2013

Microsoft Excel Speech.Speak Object


Microsoft Excel is the only Microsoft Office XP program that has built-in text to Speech (TTS) capabilities. This tip explains how you can use OLE Automation to programmatically access the Excel Object model and use the Text to Speech functionality.

Speech Method – Contains methods and properties that pertain to speech.

Name                                                                                            Description
Speak              Microsoft Excel plays back the text string that is passed as an argument

Speak Members – Contains methods and properties that pertain to speech.

expression .Speak(Text, SpeakAsync, SpeakXML, Purge)
expression A variable that represents a Speech object.

Parameters

Name
Required/Optional
Data Type
Description
Text
Required
String
The text to be spoken.
SpeakAsync
Optional
Variant
True will cause the Text to be spoken asynchronously (the method will not wait of the Text to be spoken). False will cause the Text to be spoken synchronously (the method waits for the Text to be spoken before continuing). The default is False.
SpeakXML
Optional
Variant
True will cause the Text to be interpreted as XML. False will cause the Text to not be interpreted as XML, so any XML tags will be read and not interpreted. The default is False.
Purge
Optional
Variant
True will cause current speech to be terminated and any buffered text to be purged before Text is spoken. False will not cause the current speech to be terminated and will not purge the buffered text before Text is spoken. The default is False.


Using the Speech Object

Use the Speech property of the Application object to return a Speech object.

Once a Speech object is returned, you can use the Speak method of Speech object to play back the contents of a string. In the following example, Microsoft Excel plays back “Hello, How are you”. This example assumes speech feature have been installed on the host system.

Code:-

Set ObjExcel = CreateObject (“Excel.Application”)
ObjExcel.Speech.Speak “Hello, How are you?”
Set ObjExcel=Nothing



Tuesday, 18 December 2012

CreateObject in QTP/vbScript


CreateObject is function which creates a reference to the specified object. You can then use the reference object to access the methods/properties of the specified object.

As createobject returns a reference to object, you must use Set to assingn it to a variable.

Set objExcel=CreateObject(“Excel.Application”)
‘Adding a workbook
Set objWorkBooj= objExcel.Workbooks.Add
‘Activating the sheet
Set objSheet=objWorkBook.Worksheets("Sheet1")
‘Writing values to excel
objExcel.Cells(row,column)=<”Your value>”

Below is the list of most commonly used objects. I hope you find it useful.

S.No
Object
Description
1
Set ObjectName= CreateObject("Wscript.shell")
Provides access to the native Windows shell. Provides functions to read system information and environment variables, to work with the registry and to manage shortcuts.
2
Set ObjectName = CreateObject("WScript.Network")
Provides access to the shared resources on the network to which the computer is connected.
3
Set ObjectName = Createobject("Excel.Application")
Perform operations on MS Excel.
4
Set ObjectName = CreateObject("Word.Application")
Perform operations on MS Word.
5
Set ObjectName = CreateObject("Outlook.Application")
Perform operations on MS Outlook.
6
Set ObjectName = CreateObject("InternetExplorer.Application")
Perform operations on Internet Explorer.
7
Set ObjectName = Createobject("QuickTest.Application")
Perform operations on Quick Test Professional (QTP).
8
Set ObjectName = CreateObject("QuickTest.UpdateRunOptions")
A collection of properties that indicate preferences for the Update Run in QTP.
9
Set ObjectName = CreateObject("QuickTest.RunResultsOptions")
A collection of properties that indicate preferences for the run results in QTP.
10
Set ObjectName = CreateObject("Scripting.FileSystemObject")
To work with the Windows file system structure: files, folders, drives.
11
Set ObjectName = CreateObject("Mercury.DeviceReplay")
Perform mouse or key operations exactly as they occur on the mouse or keyboard drivers.
12
Set ObjectName = CreateObject("Mercury.ObjectRepositoryUtil")
Perform an operation on QTP Object Repository.
13
Set ObjectName=CreateObjcet("Scripting.Dictionary")
Creates a dictionary object
14
Set ObjectName=CreateObject("vbScript.RegExp")
Creates a regular expression object
15
Set ObjectName = CreateObject("Mercury.FileCompare")
To compare two files.
14
Set ObjectName = CreateObject("Mercury.Clipboard")
Perform clipboard functionality.
15
Set ObjectName = CreateObject("Msxml2.DOMDocument")
Creates a DOMDocument object to perform operations related to XML document.
16
Set ObjectName = DotNetFactory.CreateInstance (TypeName [,Assembly] [,args])
Returns a COM interface for a .NET object.
17
Set ObjectName = Createobject("shell.application")
To instantiate the Shell object, to program the Shell which can be used to access the file system, to launch programs, and to change system settings.
18
Set ObjectName= Createobject("TDApiOle80.TDConnection.1")
An object that enables to manage the Quality Center connection and retrieve the TDOTA object, which provides full interaction with Quality Center.
19
Set ObjectName = CreateObject("Microsoft.XMLDOM")
To access and manipulate XML documents via the XML DOM implementation, as exposed by the Microsoft XML Parser.
20
Set ObjectName = XMLUtil.CreateXML()
Creates and returns an object of type XMLData. If a root name is specified, a new document is created containing the specified root tag.
21
Set ObjectName = CreateObject( "AcroExch.App")
Acrobat OLE Automation Objects.
Set ObjectName = CreateObject( "AcroExch.AVDoc")
Set ObjectName = CreateObject( "AcroExch.PDDoc")
Set ObjectName = CreateObject( "AcroExch.HiliteList")
Set ObjectName = CreateObject( "AcroExch.PDBookmark")
Set ObjectName = CreateObject( "AcroExch.Rect")
22
Set ObjectName = CreateObject("ADODB.Connection")
Creates an instance of the ADO connection to connect to database.
23
Set ObjectName = CreateObject("ADODB.Recordset")
Creates an instance of the recordset object. To be able to read database data, the data must first be loaded into a recordset.
24
Set ObjectName =CreateObject("msscriptcontrol.scriptcontrol")
Perform operations to MS Windows Scripting Engine.
25
Set ObjectName = CreateObject("SAPI.SpVoice")
Auditory voice feedback during a test run, done by utilizing the Microsoft Speech API.
26
Set ObjectName = CreateObject( "UserAccounts.CommonDialog")
Object to provide users with a standard File Open dialog box
27
Set ObjectName = CreateObject("CDO.Message")
Windows CDO object is suitable for creating and sending automated emails.