Advanced Rational Robot   A Tribute (http://www.geektester.blogspot.com)
Upcoming SlideShare
Loading in...5
×
 

Advanced Rational Robot A Tribute (http://www.geektester.blogspot.com)

on

  • 12,101 views

Rational Robot, Automation, Test automation, Software Testing

Rational Robot, Automation, Test automation, Software Testing
http://www.geektester.blogspot.com

Statistics

Views

Total Views
12,101
Views on SlideShare
12,042
Embed Views
59

Actions

Likes
0
Downloads
287
Comments
0

11 Embeds 59

http://geektester.blogspot.com 18
http://www.slideshare.net 16
http://geektester.blogspot.in 10
http://www.geektester.blogspot.com 3
http://geektester.blogspot.ru 3
http://weblog.chrisricard.net 3
http://www.geektester.blogspot.com.au 2
http://www.geektester.blogspot.in 1
http://blogs.msdn.com 1
http://www.geektester.blogspot.com.ar 1
http://www.geektester.blogspot.de 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Advanced Rational Robot   A Tribute (http://www.geektester.blogspot.com) Advanced Rational Robot A Tribute (http://www.geektester.blogspot.com) Presentation Transcript

  • Advanced Rational Robot [email_address] www.itest.co.nr
  • Courseware Information
    • This advanced course is designed to familiarize testing professionals with concept which are not used on daily basis but can be very handy in various situations.
    • The focus will be on applying Rational Robot to resolve complex automated testing challenges and to build effective, versatile test scripts through best practices.
  • Rational Robot Basics 4. View logs 2. Script Recording 3. Script Playback 1. Rational Robot Basics
  • Types of SQABasic Header Files
    • SQABasic supports two types of header files.
    • Header files, stored in the SQABasic path. When a header file is in the SQABasic path, it is available to all modules in the same project and in other projects.
    • Project header files, stored in the TMS_Scripts folder of the project. Project header files are available to all modules in the same project.
    • Note: Both types of SQABasic header files have the extension .sbh.
  • SQABasic Path
    • The SQABasic path is where Robot saves and looks for .sbl library files and header files.
    • The SQABasic path is user definable in Robot.
    • Once you explicitly define the SQABasic path in Robot, the path is persistent.
    • Robot automatically sets the SQABasic path when all of the following conditions are true:
      • You have not yet explicitly defined an SQABasic path in Robot.
      • You have created a new project and datastore in Rational Administrator.
      • You open Robot using the newly created project and datastore.
  • Absolute or Relative Path
    • Optionally, you can use an absolute or relative path to reference header files and project header files.
    • For example, if you want a script to reference the header file MyHeader.sbh, regardless of the current SQABasic path, and the script and header file are in the default locations of the same project, you can use the following declaration:
    • '$Include "SQABas32MyHeader.sbh"
  • Creating an SQABasic Header File
    • Project-wide header files can be referenced by any file in the project.
    • Creating a Header File
    • To create a new header file that can be accessed by any module in the project:
        • Click File -> New -> SQABasic File.
        • Click Header File, and then click OK.
  • Creating an Project Header file
    • Use to create a new project header file (file extension .sbh).
    • SQABasic header files you create with this command have project-wide scope and are stored in the Script folder of the project.
    • Project header files can be referenced by any file in the project.
    • To create a new project header file:
      • Click File -> New -> Project Header File.
      • You name the file (or accept the default name) the first time you save it.
  • Metacommand
    • '$CStrings : Tells the compiler to treat a backslash character () inside a string as an escape character.
    • SYNTAX: '$CStrings [ Save | Restore ]
    • The supported special characters are:
    • Newline (Linefeed)
    • Horizontal Tab
    •  Backspace
    • Backslash
    • ' Single Quote
    • " Double Quote
  • Escape Sequence - example
    • Sub main
    • '$CStrings
    • MsgBox "This is line 1 This is line 2 (using C Strings)"
    • '$NoCStrings
    • MsgBox "This is line 1" +Chr$(13)+Chr$(10)+"This is line 2 (using Chr)"
    • End Sub
  • DLL Library Files
    • SQABasic procedures can call procedures stored in DLL files. For example, they can call the procedures stored in Microsoft Windows DLLs such as Kernel32.dll.
    • Robot does not provide a tool for creating DLLs. To add procedures to a DLL file, you need a tool such as Microsoft Visual C++ or Visual Basic.
    • Declare Sub MySub Lib "MyDLL" (ByVal arg1 As String, ByVal arg2 As Integer)
    • Declare a DLL File in a script or SQABasic library file, for use by the procedures in that module only or in a header file, for use by any module that references the header file
  • Steps to use DLL Functions
    • Steps:
    • 1. Create a Active X DLL Project
    • 2. Define Functions / Sub Procedures
    • 3. Save Class & Project
    • <Proj Name>:TestDatastoreDefaultTestScriptDatastoreTMS_Scriptsdll)
    • 4. Create a DLL & Register it.
    • 5. Create a Header File
    • 6. Declare the Function or Sub procedure (from DLL)
    • 7. Create GUI Script
    • 8. Call Function or Sub Procedure
  • Steps .. In detail
    • Step 1:
    • Create a Visual Basic – “Active X dll Project”
    • Step 2:
    • Public Function temp() As String
    • temp = “At last its working&quot;
    • End Function
    • Step 3:
    • Save Project & Class
    • Project: Prj.vbp
    • Class: temp.cls
    • Step 4 (a): Create a DLL < temp.dll >
  • Steps .. In detail
    • Step 4(b): Registering a DLL
    • RegSvr32 “<DLL Path> emp.dll>
    • Step 5 & 6 : Create a Header File (Rational Robot)
    • Declare Function temp Lib &quot;temp.dll&quot; ()
    • Step 7 & 8 : Create a GUI Script and Call DLL function
    • '$include “temp.sbh&quot;
    • Dim x as Object
    • Set x = CreateObject(“prj.temp&quot;)
    • MsgBox x.temp
  • Libraries - Comparision
    • The following table summarizes the differences between library files:
    .sbl .rec .dll Location SQABasic path Datastore (folder TMS_Scripts) in the current project TMS_Scriptsdll folder, or a user assigned location Scope When in the SQABasic path, available to files in the same project or other projects Available to files in the same project Depends on location VP No Support Support all standard robot VP Supports Custom VP
  • Argument Type - ByVal
    • By default, the actual arguments are passed by Far reference.
    • For external DLL procedures, there are two additional keywords, ByVal and Any, that can be used in the argument list.
    • When ByVal is used, it must be specified before the argument it modifies. When applied to numeric data types, ByVal indicates that the argument is passed by value, not by reference.
    • When applied to string arguments, ByVal indicates that the string is passed by Far pointer to the string data. By default, strings are passed by Far pointer to a string descriptor.
  • Argument Type - Any
    • Any can be used as a type specification, and permits a call to the procedure to pass a value of any data type.
    • When Any is used, type checking on the actual argument used in calls to the procedure is disabled (although other arguments not declared as type Any are fully type-safe).
  • SQABasic Header Files
    • Types of SQABasic Header Files
    • Header files, stored in the SQABasic path. When a header file is in the SQABasic path, it is available to all modules in the same project and in other projects.
    • Project header files, stored in the TMS_Scripts folder of the project. Project header files are available to all modules in the same project.
    • Both types of SQABasic header files have the extension .sbh.
  • SQABasic Header Files - Creation
    • Creating a Header File
    • To create a header file in the current SQABasic path:
    • 1. In Robot, click File - > New - > SQABasic File.
    • 2. Click Header File, and then click OK.
    • Save the file in the default location. You name the file (or accept the default name) the first time you save it.
  • SQABasic Header Files - Use
    • Includes statements from the specified header or source file.
      • '$Include: &quot;filename&quot;
    • It is recommended (although not required) that you specify a file extension of .SBH if filename is a header file.
    • SQABasic header files can be accessed by modules within the current project or within any other project.
    • Typically, the '$Include meta command is located before the beginning of the sub procedure.
  • Recording Modes
    • Object-Oriented Recording – Examines objects in the AUT at the Windows layer during recording and playback. Robot uses internal object names to identify objects. If objects in your application's graphical user interface (GUI) change locations, your tests still pass because the scripts are not location dependent.
    • Low-level recording – Tracks detailed mouse movements and keyboard actions by screen coordinates and exact timing. Use low-level recording when you are testing functionality that requires the tracking of detailed mouse actions, such as in painting, drawing, or CAD applications.
  • Low Level Recording
    • When you click Record -> Turn Low-Level Recording On or Press CTRL+SHIFT+R during recording, subsequent mouse and keyboard actions are automatically stored in an external file.
    • Robot inserts the PlayJrnl command into the script to reference the external low-level file.
    • Low-level scripts are listed in the Robot Asset pane.
    • To display the contents of a low-level file, double-click the file's ID.
    • To return to Object-Oriented Recording, click Record -> Turn Low-Level Recording Off or Press CTRL+SHIFT+R.
  • Playing back Low-Level Scripts
    • During playback, the PlayJrnl command invokes the low-level file. This file plays back all recorded actions in real time, exactly as recorded. This differs from Object-Oriented Recording, which examines Windows objects in the application-under-test, and does not depend on precise timing or screen coordinates.
    • When you switch to low-level recording, Robot does the following:
    • Records low-level actions in a binary script file that cannot be edited.
    • Gives the low-level script file the next consecutive number, and displays the number in the Asset (left) pane.
    • Adds a PlayJrnl command to your script that references the low-level script file.
  • PlayJrnl Utility Command
    • Starts playback of a series of low-level recorded mouse and keyboard actions.
    • Syntax:
    • PlayJrnl scriptID
    • scriptID: A unique number that Robot assigns to the low-level script file.
    • Example: PlayJrnl &quot;001&quot;
  • Clipboard Verification Point
    • Use the Clipboard verification point to capture text contained in objects that cannot be captured using any of the other verification points.
    • To use the Clipboard verification point, the application-under-test must supply a Copy or Cut capability so you can place the data in the Clipboard.
    • This verification point is useful for capturing data from spreadsheet and word processing applications as well as terminal emulators. You cannot use it to test bitmaps.
  • Clipboard Commands
    • The Windows Clipboard can be accessed directly in your program to enable you to get text from and put text into other applications that support the Clipboard.
    • SYNTAX
    • Clipboard.Clear
    • Clipboard.GetText()
    • Clipboard.SetText string$
    • string$: A string or string expression containing the text to send to the Clipboard. Used with the .SetText method.
  • SQAShellExecute Utility Command
    • If filename references an application, SQAShellExecute runs the application.
    • If filename references a file other than an application executable, SQAShellExecute opens the file through the application that has a Windows association with the file type. (Windows maintains associations between an application and its file types by associating the application with a particular file extension.) For example, suppose Microsoft Word has a Windows association with .DOC files. If filename references MEMO.DOC, SQAShellExecute runs Word and opens MEMO.DOC in the Word environment.
    • Example: SQAShellExecute “C:WinntSystem32Notepad.Exe”,””,””
  • SQASetProperty Command
    • Assigns a value to a specified property.
    • status% = SQASetProperty(recMethod$, property$, value)
    • Example: SQASetProperty &quot;Name=FirstName&quot;, &quot;Text&quot;, &quot;Michael“
  • SQAGetPropertyNames
    • Retrieves an array containing the names of all the object's properties.
    • status% = SQAGetPropertyNames(recMethod$, aPropNames())
    • Example:
    • Dim a() as String
    • Window SetContext, &quot;Caption=Advanced.txt - Notepad&quot;, &quot;&quot;
    • x = SQAGEtPropertyNames(&quot;Type=EditBox;ObjectIndex=1&quot;,a)
    • For i = LBound(a) to UBound(a)
    • MsgBox a(i)
    • Next i
  • SQAGetPropertyArray Command
    • Retrieves an array of values for the specified property.
    • status% = SQAGetPropertyArray(recMethod$, property$, aPropValues())
    • Example:
    • Dim a() as variant
    • Window SetContext, &quot;Caption=Font&quot;, &quot;&quot;
    • x = SQAGetPropertyArray(&quot;Type=ComboListBox;Label=Font style:&quot;,&quot;List&quot;,a)
    • For i = Lbound(a) to Ubound(a)
    • MsgBox a(i)
    • Next i
  • GUI Playback Options - Trap tab Tool -> GUI Playback Options -> Trap Use to specify what information the Trap utility captures about general protection faults that occur during playback and the recovery method to use.
  • GUI Playback Options - Trap tab
    • To include the contents of the stack for non-current tasks, select Stack trace.
    • To include the module and class list information, select Module and class list.
    • Click one of the following to specify what Trap should do after detecting a GPF:
    • Restart windows session – Trap restarts Windows.
    • Call user-defined sub procedure – Trap calls the sub-procedure in the module that you specify. Select this option to specify your own custom SQABasic error handling. Type the names of the library source file (with an .sbl extension) and the sub-procedure.
  • SQATrap Log file
    • The Sqatrap.log file can contain a variety of information about failure events.
    • The following failure information is always written to Sqatrap.log:
    • Contents of the stack for the current task
    • Names of functions that were called just before the error occurred
    • Contents of CPU registers
    • Date/Time stamp and Fault Number
    • After every trapped event, Trap appends error data to the existing Sqatrap.log file in the Rational Test installation directory, or creates a new file if one does not exist.
    • A trapped event’s entry in the file begins with line:
    • <!SQA: ROBOT - start Log File for current UAE/Fault!>
    • End of LOG File for given UAE/Fault
    • <!STOP!>
  • Trap
    • Robot uses the Trap utility to detect the occurrence of General Protection Faults (GPF) and the location of the offending function call. If a GPF is detected, Robot updates a log file that provides information about the state of the Windows session that was running.
    • The occurrence of a GPF usually results in a crash of the running application and may also result in a loss of data.
    • Capture information about GPFs.
    • Write the state of your environment to a log file when a GPF is detected.
    • Specify the type of information to write to the log file.
    • Automatically restart Windows or call your own error handling sub-procedure before performing any other action.
  • Trap – Contd..
    • Trap detects and traps the following events:
    • UAE: General Protection Fault #13
    • Stack Overflow: Fault #12
    • Invalid Op Code: Fault #6
    • Divide by Zero: Fault #0
  • Module Existence VP
    • Use to verify whether a specified module is loaded into a specified context (process), or is loaded anywhere in memory.
    • In the Windows environment, modules are defined as executable programs (.exe), dynamic link libraries (.dll or other extension), device drivers (.sys or .drv), or display fonts (.fon).
    • Each process has its own context, which includes a set of loaded modules. When you create this verification point, you select the name of the module. You may also select the name of a context (process), in which case the verification point tests whether the module is loaded into that process. If no context is specified, the verification point tests whether the module is loaded anywhere in memory.
  • Module Existence VP
    • Click Insert -> Verification Point -> Module Existence.
  • Object Data Test Definition
    • Use to set the options for a data test.
    • What do you want to do?
    • Create or edit a custom data test
    • Create or edit the expression in a custom data test
    • Rename a custom data test
    • Copy a data test
    • Delete a custom data test
  • Object Data Test Definition
  • Object List
    • Use to select an object to test from the Windows desktop while creating a verification point.
    • Show hidden
    • Invert object
  • Object List
    • Show Hidden: Shows all objects on the Windows desktop.
    • Objects with a Visible property of False. Examples are hidden Visual Basic Data controls and PowerBuilder DataWindows.
    • Objects with no GUI component. Examples are PowerBuilder DataStore controls and Oracle Forms blocks.
    • Invert Object:
    • When you select an object in the list, inverts the object's colors in the application window if the object is visible.
  • Skip VP & Acknowledge Results Select Acknowledge results to have Robot display a pass/fail result message for each verification point. You must click OK before playback continues. If selected, Robot skips verification points during playback. You may want to skip verification points for debugging during the test development phase, but not for actual testing.
  • Unexpected Active Window Use to specify how Robot responds to the appearance of an unexpected active window during playback. An unexpected active window is any window that is not expected by Robot during playback and that prevents the expected window from being made active.
  • GUI Record Options Type the default prefix for every new GUI script that you record. Each time you record a new GUI script, the prefix is appended with a consecutive number. Records a mouse drag as a mouse click within a push button, option button, check box, and label while recording. This prevents inadvertent mouse drags from being written in the script as drags.
  • Manage Queries Dialog Box Use this dialog box to manage script or session queries. To open: Click Tools -> Manage Script Queries . Click the New or Edit button in the Manage Queries dialog box.
  • Manager Queries Dialog Box
  • Begin Dialog .. End Dialog
    • Begins and ends a dialog-box declaration.
    • Begin Dialog dialogName [x , y ,] dx , dy [, caption$ ]
    • ... ' dialog box definition statements
    • End Dialog
    • ButtonGroup Statement:
    • Begins the definition of a group of custom buttons for a dialog box.
    • ButtonGroup .field
  • Begin Dialog .. End Dialog
    • Begin Dialog UserDialog 274, 171, &quot;SQABasic Dialog Box&quot;
    • ButtonGroup .ButtonGroup1
    • Text 9, 3, 69, 13, &quot;Filename:&quot;, .Text1
    • TextBox 9, 3, 69, 13, .Text3
    • DropComboBox 9, 14, 81, 119, ComboBox1(), .ComboBox1
    • Text 106, 2, 34, 9, &quot;Directory:&quot;, .Text2
    • ListBox 106, 12, 83, 39, ListBox1(), .ListBox2
    • Text 106, 52, 42, 8, &quot;Drive:&quot;, .Text3
    • DropListBox 106, 64, 95, 44, DropListBox1(), .DropListBox1
    • CheckBox 9, 142, 62, 14, &quot;List .TXT files&quot;, .CheckBox1
    • GroupBox 106, 111, 97, 57, &quot;File Range&quot;
    • OKButton 213, 6, 54, 14
    • CancelButton 214, 26, 54, 14
    • PushButton 213, 52, 54, 14, &quot;Help&quot;, .Push1
    • End Dialog
    • Dim mydialog as UserDialog
    • On Error Resume Next
    • Dialog mydialog
    • If Err=102 then
    • MsgBox &quot;Dialog box canceled.&quot;
    • End If
  • CreateObject Function
    • Creates a new OLE2 automation object.
    • SYNTAX: CreateObject( class )
    • class: The name of the application, a period, and the name of the object to be used.
    • To create an object, you first must declare an object variable, using Dim, and then Set the variable equal to the new object, as follows:
    • Dim OLE2 As Object
    • Set OLE2 = CreateObject(“Excel.Application&quot;)
  • New Operator
    • Allocates and initializes a new OLE2 object of the named class.
    • SYNTAX
    • Set objectVar = New className (or)
    • Dim objectVar As New className
    • objectVar: The OLE2 object to allocate and initialize.
    • className: The class to assign to the object.
    • In the Dim statement, New marks objectVar so that a new object will be allocated and initialized when objectVar is first used. If objectVar is not referenced, then no new object will be allocated.
  • Dynamic Data Exchange
    • Dynamic Data Exchange (DDE) is a process by which two applications communicate and exchange data. One application can be an SQABasic script.
    • Here's a high-level overview of a DDE exchange. Click a topic for more information:
    • Open a DDE channel
    • Communicate with the application
    • Close the channel
  • DDE – Open a Channel
    • To &quot;talk&quot; to another application and send it data, open a connection (called a DDE channel) using the statement DDEInitiate.
    • DDEInitiate requires two arguments:
    • The DDE application name. For example, the DDE name for Microsoft Word is WINWORD.
    • The topic name. This name is usually a open filename. Many applications that support DDE recognize a topic named System, which is always available and can be used to find out which other topics are available.
    • Note: The application must already be running before you can open a DDE channel. To start an application, use the Shell command.
  • DDE – Communicate with the App
    • After you open a channel to an application, you can get text and numbers (DDERequest), send text and numbers (DDEPoke), or send commands (DDEExecute). See the application's documentation for a list of supported DDE commands.
    • To make sure the application performs a DDE task as expected, use DDEAppReturnCode. If an error does occur, your program can notify the user.
    • Systems: A list of all items in the System topic
    • Topics: A list of available topics
    • Formats: A list of all the Clipboard formats supported
  • DDE – Close the channel
    • When you're finished communicating with the application, you should close the DDE channel using DDETerminate. Because you have a limited number of channels available at once (depending on the operating system in use and the amount of memory you have available), it's a good idea to close a channel as soon as you finish using it.
  • Dynamic Data Exchange
    • DDEAppReturnCode: Return a code from an application on a DDE channel.
    • DDEExecute: Send commands to an application on a DDE channel.
    • DDEInitiate: Open a dynamic data exchange (DDE) channel.
    • DDEPoke: Send data to an application on a DDE channel.
    • DDERequest: Return data from an application on a DDE channel.
    • DDETerminate: Close a DDE channel.
  • DDE Example
    • appname=&quot;WinWord&quot;
    • path=&quot;D:Program FilesMicrosoft OfficeOffice&quot;
    • topic=&quot;System&quot;
    • item=&quot;Page1&quot;
    • testtext=&quot;Hello, world.&quot;
    • On Error Goto Errhandler
    • x=Shell(path & appname & &quot;.EXE&quot;)
    • channel = DDEInitiate(appname, topic)
    • If channel=0 then
    • MsgBox &quot;Unable to open Word.&quot;
    • Exit Sub
    • End If
    • DDEPoke channel, item, testtext
    • pcommand=&quot;[FileSaveAs .Name = &quot; & Chr$(34) & &quot;C:xxx.doc&quot; & Chr$(34) & &quot;]&quot;
    • DDEExecute channel, pcommand
    • pcommand=&quot;[FileClose]&quot;
    • DDEExecute channel, pcommand
    • DDETerminate channel
  • Questions