Diese Präsentation wurde erfolgreich gemeldet.
Die SlideShare-Präsentation wird heruntergeladen. ×

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


Hier ansehen

1 von 48 Anzeige

Weitere Verwandte Inhalte

Diashows für Sie (20)

Andere mochten auch (20)


Aktuellste (20)


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

  1. 1. Rational Robot [email_address] www.itest.co.nr
  2. 2. Courseware Information <ul><li>This introductory course is designed to familiarize testing professionals with the basics of Rational's functional test automation tool, Rational® Robot. </li></ul><ul><li>The focus will be on applying Rational Robot to resolve common automated testing challenges and to build effective, versatile test scripts through best practices. </li></ul>
  3. 3. Rational Robot Basics 4. View logs 2. Script Recording 3. Script Playback 1. Rational Robot Basics
  4. 4. DataPool <ul><li>What is Datapool </li></ul><ul><li>Test dataset </li></ul><ul><li>Supplies data values to the variables in a script during script playback </li></ul><ul><li>It will automatically pump test data to virtual testers under high-volume conditions </li></ul>
  5. 5. Creation of Datapool <ul><li>Creating and Populating Datapool </li></ul>Datapool Creation Rational Robot Rational Test Manager
  6. 6. Datapool through Test Manager <ul><li>Click Tools -> Manage -> Datapools </li></ul><ul><li>Specify Name </li></ul><ul><li>Define Datapool fields </li></ul><ul><li>Assign data type to the datapool columns </li></ul><ul><li>Specify number of records to generate </li></ul><ul><li>Click Generate Data </li></ul>
  7. 7. Rational Suite <ul><li>Suite </li></ul><ul><li>Contains items such as user or computer groups </li></ul><ul><li>Resource assigned to each group </li></ul><ul><li>Test scripts </li></ul><ul><li>Number of times each test script runs </li></ul>
  8. 8. Rational Suite <ul><li>Usage of Test Suite </li></ul><ul><li>Assign test cases to computers and rerun the test cases without having to reassign them </li></ul><ul><li>Run test scripts and test cases on the next available computer, thus speeding up testing process </li></ul><ul><li>Set preconditions on items in a suite, which require that they complete successfully before the next item in the suite runs </li></ul><ul><li>Group test scripts to emulate the actions of different types of testers </li></ul><ul><li>Set the order in which test scripts run </li></ul><ul><li>Synchronize testers </li></ul>Suite can contain GUI test scripts, VU test scripts, VB test scripts, Java test scripts or other user defined test script types
  9. 9. Creation of Suite <ul><li>Suite can be created in the following way </li></ul><ul><li>Performance Testing Wizard </li></ul><ul><li>Functional Testing Wizard </li></ul><ul><li>Existing Session </li></ul><ul><li>Existing Suite </li></ul><ul><li>Blank Performance Testing or Functional Testing Suite </li></ul>
  10. 10. Verification Points <ul><li>Verification Point </li></ul><ul><li>Point in a script that we create to confirm the state of an object across builds of the application under test. </li></ul><ul><li>During Recording, the VP captures object information and stores it in a baseline data file. </li></ul><ul><li>While playing back against a new build, Robot retrieves the information in the baseline file for each VP and compares it against the baseline data file. </li></ul>
  11. 11. Verification Point <ul><li>Types of Verification Points </li></ul><ul><ul><li>Alphanumeric </li></ul></ul><ul><ul><li>Clipboard </li></ul></ul><ul><ul><li>File Comparison </li></ul></ul><ul><ul><li>File Existence </li></ul></ul><ul><ul><li>Menu </li></ul></ul><ul><ul><li>Module Existence </li></ul></ul><ul><ul><li>Object Data </li></ul></ul><ul><ul><li>Object Properties </li></ul></ul><ul><ul><li>Region Image </li></ul></ul><ul><ul><li>Website Compare </li></ul></ul><ul><ul><li>Window Existence </li></ul></ul><ul><ul><li>Window Image </li></ul></ul><ul><ul><li>Window Scan </li></ul></ul>
  12. 12. Alphanumeric VP <ul><ul><li>Alphanumeric verification point will be used to capture and test alphabetic or numeric values from a single or multi-line edit box or from other Windows objects that Robot recognizes. </li></ul></ul><ul><ul><li>You can use the verification point to verify that text has not changed, to catch spelling errors, and to ensure that numeric values are accurate. </li></ul></ul>
  13. 13. Clipboard VP Clipboard verification point will be used 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.
  14. 14. File Verification VP <ul><li>File Comparison verification point will be to compare two specified files during playback. The comparison is based on the contents of the files and their sizes, not on the file names or dates. </li></ul><ul><li>When you create the verification point, you specify the drive, directory, and the file names. During playback, Robot compares the files byte-for-byte. </li></ul>
  15. 15. File Existence VP <ul><li>Use the File Existence verification point to specify a file to look for during playback. </li></ul><ul><li>When you create the verification point, you specify the drive, directory, and file name for the required file. During playback, Robot checks to see if the file exists in the specified location. </li></ul>
  16. 16. Menu VP Menu verification point will be used to capture the menu title, menu items, shortcut keys, and the state (enabled, disabled, grayed, or checked) of selected menus. Robot records information about the top menu and as many as five levels of sub-menus. Robot treats menu items as objects within a menu and tests their content, state, and accelerator keys regardless of the menu item’s location.
  17. 17. Module Existence VP <ul><li>Use to verify whether a specified module is loaded into a specified context (process), or is loaded anywhere in memory. </li></ul><ul><li>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). </li></ul><ul><li>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. </li></ul>
  18. 18. Object Data VP <ul><li>Use the Object Data verification point to capture the data inside objects, including: </li></ul><ul><li>Standard Window controls </li></ul><ul><li>ActiveX controls </li></ul><ul><li>Visual Basic Data controls </li></ul><ul><li>HTML and Java objects </li></ul><ul><li>Oracle Forms base-table blocks and items </li></ul><ul><li>PowerBuilder DataWindows and DataStore controls </li></ul><ul><li>Menus (you can also use the Menu verification point to test a menu) </li></ul>
  19. 19. Object Properties VP Use the Object Properties verification point to capture and verify the properties of standard Windows objects. This verification point also provides specialized support for environment-specific objects such as Visual Basic Data controls, ActiveX controls, HTML and Java objects, PowerBuilder DataWindows, and Oracle Forms base-table blocks.
  20. 20. Region Image VP <ul><li>Use the Region Image verification point to select a region of the screen that Robot captures and saves as a bitmap. The captured region, which can overlap more than one window, is a pixel-by-pixel representation that includes colors, height, and width. </li></ul><ul><li>For the verification point to pass, the location of the region and the screen resolution should be the same during record and playback. </li></ul>
  21. 21. Window Existence VP <ul><li>Use the Window Existence verification point to verify the existence and status of a specified window during playback. The status can be normal, minimized, maximized, or hidden. </li></ul><ul><li>Since the Window Existence verification point does not create a baseline or actual data file, if the verification point fails, you cannot replace baseline data with actual data. </li></ul>
  22. 22. Window Image VP <ul><li>Use the Window Image verification point to select and capture the client area of a window. The menu, title bar, and border are not included as part of the image capture. </li></ul><ul><li>Robot can capture any window that is partially or fully visible. The window can be overlapped by another window or partially off the screen. When this occurs, Robot captures the window, but saves the non-visible part of the window as black. The captured region is a pixel-by-pixel representation that includes colors, height, and width. </li></ul><ul><li>For the verification point to pass, the size of the window and the screen resolution should be the same during record and playback. </li></ul>
  23. 23. Adding Datapool Commands to a GUI Script <ul><li>Once you finish a recording session in which you provided values to the application, edit the script and perform these basic tasks: </li></ul><ul><li>Reference the SQAUTIL.SBH header file </li></ul><ul><li>Substitute variables for the literal values you provided during recording </li></ul><ul><li>Add datapool commands that open the datapool, fetch a row of data from the datapool, retrieve the individual values in the fetched row, and assign each value to a script variable </li></ul>
  24. 24. Datapool Command - Example <ul><li>'$Include &quot;sqautil.sbh&quot; </li></ul><ul><li>Sub Main </li></ul><ul><li>... Declare variables with Dim statements </li></ul><ul><li> ' Open a datapool named CD Orders </li></ul><ul><li> Dp=SQADatapoolOpen(&quot;CD Orders&quot;) </li></ul><ul><li> ' Perform the transaction 100 times, using a new </li></ul><ul><li> set of data from the datapool each time </li></ul><ul><li> For x = 1 to 100 </li></ul><ul><li>' Fetch a row from the datapool </li></ul><ul><li> Call SQADatapoolFetch(dp) </li></ul>
  25. 25. Datapool Command – Example …. <ul><li>' Begin the transaction </li></ul><ul><li>'Credit Card Number </li></ul><ul><li>Window SetContext, &quot;Caption=Make An Order&quot;, &quot;&quot; </li></ul><ul><li>EditBox Click, &quot;ObjectIndex=3&quot;, &quot;Coords=13,11&quot; </li></ul><ul><li>' Assign ccNum a value from datapool column #4 </li></ul><ul><li>Call SQADatapoolValue(dp,4,ccNum) </li></ul><ul><li>InputKeys ccNum ' Pass the datapool value to the application </li></ul><ul><li>... ' Assign other datapool values to other variables </li></ul><ul><li>Next x </li></ul><ul><li>Call SQADatapoolClose(dp) </li></ul><ul><li>End Sub </li></ul>
  26. 26. Extension Manager command <ul><li>Tools -> Extension Manager </li></ul><ul><li>Use to select the development environments you need to test. Opens the Extension Manager dialog box. The next time you start Robot, support for the selected environments is loaded. </li></ul><ul><li>Use to control which Robot extensions are loaded. </li></ul><ul><li>The Extension Manager lists the special IDE (integrated development environments) environments supported by Robot. Select only the environments you need to test. The next time you start Robot, only the selected environments are loaded. </li></ul><ul><li>Note: Support for C++ applications is always loaded. </li></ul>
  27. 27. Selecting the IDE Extensions to Load <ul><li>1. Start Robot. </li></ul><ul><li>2. Click Tools - > Extension Manager. </li></ul><ul><li>3. Select only the environments that you plan to test. To improve performance, clear the check boxes of all environments you do not plan to test. </li></ul><ul><li>4. Exit Robot. </li></ul><ul><li>The next time you start Robot, only the extensions for the selected environments are loaded. </li></ul>
  28. 28. IDE Extensions - options <ul><li>Verifiying that the Java Extension Is Loaded </li></ul><ul><li>To test Java applets and applications, you must first make sure that the Java extension is loaded in Robot. The Java extension includes those additions to Robot that allow Robot to test Java. </li></ul><ul><li>Verifying that the .NET Extension is Loaded </li></ul><ul><li>The .NET Extension is loaded by default and is required to recognize Visual Studio.NET Windows Forms controls. To verify that the .NET extension is loaded </li></ul><ul><li>Note: During installation Robot installs some of our assemblies to global assembly cache. If you install Robot before installing the .NET framework, this step is skipped. In order to test your .NET application, you need to either re-install Robot or copy Dotnetspy.dll and interop.mscoreee.dll into your global assembly cache. </li></ul>
  29. 29. IDE Extensions – options ….. <ul><li>Verifying that the HTML Extension Is Loaded </li></ul><ul><li>To test HTML applications, you must first make sure that an HTML extension is loaded in Robot. </li></ul><ul><li>Verifying that the Oracle Forms Extension Is Loaded </li></ul><ul><li>To test Oracle Forms applications, you should first verify that the Robot Oracle Forms extension is loaded in Robot. </li></ul><ul><li>Verifying that the PowerBuilder Extension Is Loaded </li></ul><ul><li>To test PowerBuilder applications, you should first verify that the Robot PowerBuilder extension is loaded in Robot. </li></ul><ul><li>Verifying that the Visual Basic Extension Is Loaded </li></ul><ul><ul><li> To test Visual Basic applications </li></ul></ul>
  30. 30. Inspector command (Tools menu) <ul><li>Use to view information about the window, parent, and style of an object, including its window class, ID, and function. Opens the Inspector window. </li></ul><ul><li>Using the Inspector </li></ul><ul><li>Use the Inspector to examine window-type objects and display information about those objects, such as class, ID, handle, size, parent data, and style. </li></ul><ul><li>1. Click Tools - > Inspector. </li></ul><ul><li>The tool will automatically begin the object inspection. It will inspect all of the windows objects on your desktop. When it finishes, the Inspector window opens and displays the results. </li></ul><ul><li>2. Optionally, click Refresh Object to refresh the inspection of the selected object. </li></ul>
  31. 31. Inspector command (Tools menu) <ul><li>3. Optionally, click Refresh All to refresh the inspection of all the objects. </li></ul><ul><li>4. You can drag the selection hand to any object and release it to inspect that object. </li></ul><ul><li>The Inspector can assist in general window-type object identification, but it does not have the Object Testing technology of Robot. For example, the Inspector: </li></ul><ul><li>Does not display object names. </li></ul><ul><li>Does not detect Visual Basic &quot;soft&quot; controls like labels and shapes. </li></ul><ul><li>Does not detect any objects inside of PowerBuilder DataWindows. </li></ul>
  32. 32. Functions & Sub Procedures <ul><li>A Sub procedure does not return a value. </li></ul><ul><li>A Function procedure returns a value, and can be used in an expression. </li></ul><ul><li>To specify the data type for the return value of a function, end the Function name with a type declaration character. If no type is provided, the function defaults to data type Variant. </li></ul><ul><li>Declares a procedure in a module or dynamic link library (DLL) </li></ul><ul><li>Declare Sub name [ libSpecification ] [ ( arg [ As type ], ... ) ] </li></ul><ul><li>Declare Function name [ libSpecification ] [ ( arg [ As type ], ... ) ] [ As functype ] </li></ul>
  33. 33. Function – Header File <ul><li>If the libSpecification is of the format: </li></ul><ul><li>BasicLib &quot;libName&quot; [ Alias &quot;aliasname&quot; ] </li></ul><ul><li>the procedure is in another SQABasic module (.sbl or .rec) named libName. </li></ul><ul><li>If the libSpecification is of the format: </li></ul><ul><li>Lib &quot;libName&quot; [ Alias [&quot;]ordinal[&quot;] ] or </li></ul><ul><li>Lib &quot;libName&quot; [ Alias &quot;aliasname&quot; ] </li></ul><ul><li>the procedure is in a Dynamic Link Library (DLL) named libName. </li></ul>
  34. 34. Function - Definition <ul><li>The purpose of a function is to produce and return a single value of as specified type. Recursion is supported. </li></ul><ul><li>[ Static ] [ Private ] Function name [ ( [ Optional ]arg [ As type ], ... ) ] [ As functype ] </li></ul><ul><li>name= expression </li></ul><ul><li>End Function </li></ul><ul><li>The data type of name determines the type of the return value. </li></ul><ul><li>If you don't specify a data type, the default data type Variant is used. </li></ul><ul><li>When calling the function, you need not specify the type declaration character. </li></ul>
  35. 35. Function – Definition – Contd.. <ul><li>The Static keyword specifies that all the variables declared within the function will retain their values as long as the program is running, regardless of the way the variables are declared. </li></ul><ul><li>The Private keyword specifies that the function will not be accessible to functions and sub procedures from other modules. Only procedures defined in the same module will have access to a Private function. </li></ul><ul><li>SQABasic procedures use the call-by-reference convention by default. This means that if the called procedure changes the value of an argument passed in arg, the new value will apply in the calling procedure as well. This feature should be used with great care. </li></ul><ul><li>Note: Use Sub to define a procedure with no return value. </li></ul>
  36. 36. Function - Arguments <ul><li>A forward declaration is needed only when function is referenced before it is defined. In this case, the BasicLib, Lib and Alias clauses are not used. </li></ul><ul><li>Argument is passed to the sub procedure or function. Multiple arguments are separated by commas. </li></ul><ul><li>The data type of an argument can be specified through a type declaration character or through the As clause. </li></ul><ul><li>Arguments of a User-Defined data type are declared through an As clause and a type that has previously been defined through the Type statement. </li></ul><ul><li>If an argument is an array, use empty parentheses after the argument name. The array dimensions are not specified within the Declare statement. </li></ul>
  37. 37. Function – Arguments - Contd.. <ul><li>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. </li></ul><ul><li>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. </li></ul><ul><li>Any can be used as a type specification, and permits a call to the procedure to pass a value of any data type </li></ul>
  38. 38. Function – Terminate Exit <ul><li>Terminates Loop statements or transfers control to a calling procedure. </li></ul><ul><li>Exit {Do | For| Function | Sub} </li></ul><ul><li>Use Exit Do inside a Do...Loop statement. Use Exit For inside a For...Next statement. When the Exit statement is executed, control transfers to the statement after the Loop or Next statement. When used within a nested loop, an Exit statement moves control out of the immediately enclosing loop. </li></ul><ul><li>Use Exit Function inside a Function...End Function procedure. Use Exit Sub inside a </li></ul>
  39. 39. SQABasic Library <ul><li>SQABasic library files let you declare custom procedures that you can call from a script file or other library file. </li></ul><ul><li>Declare Sub MySub BasicLib &quot;MyLib&quot; (arg1 As String, arg2 As Integer) </li></ul><ul><li>The word BasicLib is added to the declaration, indicating that the declared procedure MySub is in an SQABasic library file. </li></ul><ul><li>The name of the library file (MyLib), in quote marks, follows the BasicLib designation. </li></ul><ul><li>The library file extension (.sbl or .rec) is not required. </li></ul>
  40. 40. SQABasic Library – Contd.. <ul><li>Note that the BasicLib keyword specifies that a .sbx library file (as opposed to a .dll library file) is being declared. The .sbx extension in the declaration is not required or recommended. </li></ul><ul><li>Where to Declare an SQABasic Library File </li></ul><ul><li>You can declare an SQABasic library file in any of these locations: </li></ul><ul><li>In a script or other library file, for use by the procedures in that module only </li></ul><ul><li>In a header file, for use by any module that references the header file </li></ul>
  41. 41. SQABasic Library - Types <ul><li>You can create and edit these types of SQABasic library files: </li></ul><ul><li>.sbl libraries : If a .sbl file is in the SQABasic path, it can be accessed from a file in the current project or in other projects. </li></ul><ul><li>.sbl library files to not support verification points. </li></ul><ul><li>.rec libraries.: A script file used as a library file can only be accessed by files in the same project. </li></ul><ul><li>.rec library files support verification points. </li></ul><ul><li>Note: For your convenience, Robot provides a blank library source file, called global.sbl, in each project. You can add your custom procedures to this file and/or create new library source files. </li></ul>
  42. 42. SQABasic Library - Compile <ul><li>Compile the SQABasic library file before you attempt to access it at test runtime. </li></ul><ul><li>Compiling SQABasic library files is the same for both .sbl files and .rec files. Compiling the file also saves it. </li></ul><ul><li>Compiled .sbl and .rec library files have the extension .sbx. </li></ul><ul><li>When you compile a .sbl file, the .sbx file is stored in the SQABasic path </li></ul><ul><li> This is true even if the .sbl file is not in the SQABasic path. </li></ul>
  43. 43. DLL Library Files <ul><li>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. </li></ul><ul><li>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. </li></ul><ul><li>Declare Sub MySub Lib &quot;MyDLL&quot; (ByVal arg1 As String, ByVal arg2 As Integer) </li></ul><ul><li>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 </li></ul>
  44. 44. Libraries - Comparision <ul><li>The following table summarizes the differences between library files: </li></ul>.sbl .rec .dll Location SQABasic path Datastore (folder TMS_Scripts) in the current project TMS_Scriptsll 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
  45. 45. SQABasic Header Files <ul><li>Types of SQABasic Header Files </li></ul><ul><li>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. </li></ul><ul><li>Project header files, stored in the TMS_Scripts folder of the project. Project header files are available to all modules in the same project. </li></ul><ul><li>Both types of SQABasic header files have the extension .sbh. </li></ul>
  46. 46. SQABasic Header Files - Creation <ul><li>Creating a Header File </li></ul><ul><li>To create a header file in the current SQABasic path: </li></ul><ul><li>1. In Robot, click File - > New - > SQABasic File. </li></ul><ul><li>2. Click Header File, and then click OK. </li></ul><ul><li>Save the file in the default location. You name the file (or accept the default name) the first time you save it. </li></ul>
  47. 47. SQABasic Header Files - Use <ul><li>Includes statements from the specified header or source file. </li></ul><ul><ul><li>'$Include: &quot;filename&quot; </li></ul></ul><ul><li>It is recommended (although not required) that you specify a file extension of .SBH if filename is a header file. </li></ul><ul><li>SQABasic header files can be accessed by modules within the current project or within any other project. </li></ul><ul><li>Typically, the '$Include meta command is located before the beginning of the sub procedure. </li></ul>
  48. 48. Questions

Hinweis der Redaktion