Ranorex Tutorial

Ranorex Tutorial

-

Documents
50 pages
Lire
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

Description

Unten 
 
 
Version 2.3 
Tutorial 
 




1  Ranorex – General Overview ................................. 3 
Ranorex Philosophy – Use Cases ..................................................................... 3 
Ranorex Automation Framework ..................................................................... 5 
2  Object Recognition with Ranorex ............................ 6 
Working with Ranorex Spy ............................................................................. 6 
Tracking Elements with Ranorex Spy ............................................................................................ 6 
Tracking of Menu Items ................................................................................................................. 7 
Tracking Result – What to do with the tracked information? ....................................................... 8 
RanoreXPath editor box ................................................................................................................ 9 
RanoreXPath – Advanced Exercises ............................................................................................ 12 
3  Ranorex Studio – Part I ...................................... 14 
Creating a First Test Executable .................................................................... 14 
Capture and Replay of User Actions ............................................................................................ 16 
4  Ranorex Recorder – Capture/Replay ...

Sujets

Informations

Publié par
Nombre de visites sur la page 377
Langue English
Signaler un problème
  Version 2.3 
Tutorial 
 
1  3Ranorex  General Overview ................................. Ranorex Philosophy  Use Cases ..................................................................... 3 Ranorex Automation Framework ..................................................................... 5 2 Object Recognition with Ranorex ............................ 6 Working with Ranorex Spy ............................................................................. 6 TrackingElementswithRanorexSpy............................................................................................6 TrackingofMenuItems.................................................................................................................7 Tracking Result  What to do with the tracked information?....................................................... 8 RanoreXPatheditorbox................................................................................................................9 RanoreXPathAdvancedExercises............................................................................................12 3 Ranorex Studio  Part I ...................................... 14 Creating a First Test Executable .................................................................... 14 Capture and Replay of User Actions ............................................................................................ 16 4  ............. 19Ranorex Recorder  Capture/Replay Editor Separate Automation from Identification  The Ranorex Repository.................... 19 Code behind the Recorder Design View ......................................................... 21 Extending and Modifying Existing Recordings .................................................. 21 SimpleActions.............................................................................................................................21 UserCode.....................................................................................................................................23 Recorder Configuration ................................................................................ 25 Repository Configuration .............................................................................. 27 Data Driven Recordings ............................................................................... 31 Image Based Automation with Ranorex Recorder............................................. 35 Image-BasedLocationSettings..................................................................................................36 ImageEditor................................................................................................................................36 ToolbarShortcuts........................................................................................................................37 5  39Ranorex Studio  Part II ..................................... Ranorex Automation Library ......................................................................... 39 Using the Ranorex Repository in Code........................................................................................ 39 Working without Ranorex Repository ......................................................................................... 41 Failure Handling, Exceptions and Report Generation......................................... 42 Handling Unexpected Dialogs........................................................................ 44 Organizing a Test Automation Project with Ranorex Studio ............................... 45 Running Compiled Executable ....................................................................... 48 6 Further Documentation and Automation Topics ........ 50 
1Ranorex  General Overview Ranorex Philosophy  Use Cases
Ranorex use case  with development support
One of the main goals of Ranorex is to bring developers and testers together to realize professional test automation projects. This is only possible by providing both groups with the appropriate tools and functionality. The Ranorex Automation Library can be seen as a core component of Ranorex which is needed for every automation task ex-ecuted by Ranorex. For testers with less programming experience, we recommend us-ing Ranorex Studio in combination with Ranorex Recorder to create automated test modules. More experienced developers can also use the Microsoft Visual Studio envi-ronment to implement their test automation tasks. This allows for more complex test modules to be created by the developers before releasing their code for integration tests, and for the testers to integrate these modules within the Ranorex Studio envi-ronment into comprehensive test suites.
In addition, test teams having no development team support are able to use Ranorex for creating test automation projects.
Chapter 1 | Ranorex  General Overview
Ranorex Tutorial
Ranorex use case  test team without development support
Regardless of who implements a test or how it is done, test scripts are compiled as standard executable files or libraries which perform the automated test. This allows flexibility in dealing with existing test management environments.
4
Chapter 1 | Ranorex  General Overview
Ranorex Automation Framework The Ranorex Automation Framework consists of the following components: »Ranorex Automation Library »Ranorex Tools »Ranorex Studio
Ranorex components
TheRanorex Automation Libraryis the core component. It is not only used for test automation  all other Ranorex tools also use it. The library is based on the .NET framework making it easy to integrate into existing development environments. TheRanorex Standalone Toolscan be used for various scenarios. While the Rano-rex Recorder is often used to create quickly short test automation tasks with cap-ture/replay, Ranorex Spy provides you with information about the UI elements which are accessible for automation. The Ranorex Repository manages all objects wherein RanoreXPath expressions are required for further test automation. Ranorex Studiointegrates all these tools into a test development environment which provides additional features for code editing, code completion and debugging functio-nality.
Ranorex Tutorial
5
Chapter 2 | Object Recognition with Ranorex
2Object Recognition with Ranorex Working with Ranorex Spy As a standalone tool, Ranorex Spy provides all the functionality needed to explore and analyze applications or websites - including all their controls and GUI elements. After starting Ranorex Spy, the element browser contains information about all currently running applications on the Windows desktop. Note:sections are based on the VIPApplication.exe which is part of the The following setup package and is located in the samples directory ..Program Files\Ranorex 2.3\Samples\DataDrivenTest\C#\VIPApplication.exe
Ranorex Spy - applications and their UI elements
Tracking Elements with Ranorex Spy Ranorex Spy provides two ways to track UI elements from an application. »Track the elements using the 'Track' button »Use the instant tracking shortcut <CTRL>+<LWin> Click the 'Track' button to start tracking a UI element. Move your mouse pointer over a specific control (button, text box) so that the currently identified object is highlighted.
Ranorex Tutorial
6
Chapter 2 | Object Recognition with Ranorex By selecting the control, the tracking mode will be stopped and all information of the selected UI element will be shown within Ranorex Spy.
RanorexTutorial
Click 'Track' button to start element tracking In some cases it might be necessary to track GUI elements which are currently behind the Ranorex Spy window. Simply uncheck the 'Always On Top' checkbox and Ranorex Spy will be minimized during the tracking process.
'Always On Top' checkbox within Ranorex Spy Tracking of Menu Items When tracking menu or popup items, you have to use the Instant Tracking method by using a shortcut to select a UI element. Simply move your mouse pointer over a menu item and press the <CTRL> + <LWin> key combination to instantly track the UI element. Instant Tracking is not only available for popup items  this tracking mode can also be used for all other UI elements and is also provided in the Ranorex Reposi-tory browser.
7
Chapter 2 | Object Recognition with Ranorex
Tracking Result  What to do with the tracked information? After tracking a UI element, Ranorex Spy shows different types of information availa-ble for the appropriate element:
»RanoreXPath  identification string »Available attributes and properties for validation during testing Graphical information » »information about the adapters used or other Ranorex-specific proper-Extended ties RanoreXPathRanorex Spy is for the most part used to determine which RanoreXPath should be used to identify a UI element. After tracking an element, the RanoreXPath is shown in the RanoreXPath editor box. The RanoreXPath is one of the most important parts of the Ranorex test automation framework. Every Ranorex test automation task uses RanoreXPath expressions to identify controls like text boxes or buttons.
The RanoreXPath syntax is based on XPath and can be used for more than just identi-fication; searching and filtering of multiple elements is also possible. Read more about RanoreXPath syntax in the Ranorex User Guide.
Available Attributes and Properties for Test ValidationAll the information shown in the General tab is accessible during automation and can be used  if desired  within a RanoreXPath expression.
Ranorex Tutorial
8
Chapter 2 | Object Recognition with Ranorex
Available Ranorex Adapters for a .NET WinForms button
In addition to the general properties like Valid or Enabled, Ranorex provides different adapters allowing not only access to such attributes as button-related properties but also the use of technology dependent information, e.g. .NET control attributes like the ControlName value. There are two major groups of adapters: »Logical adapters such as Button, Text, ListItem, Tree,  »Technology-dependent adapters like Control for .NET WinForms and Native-Window for Win32 controls More information about how to use the different adapters during test automation with Ranorex is described in section 5. Exercise 1: Tracking with Ranorex Spy RanoreXPath editor box Each element within the Ranorex Spy tree is identified by the RanoreXPath expression shown in text box.
Ranorex Tutorial
9
Chapter 2 | Object Recognition with Ranorex
Ranorex Spy shows tracked information from the Add button
This automatically generated RanoreXPath shows only one way to identify an object uniquely, but dont have to use the suggested path. You can also modify parts of the RanoreXPath expression or rewrite the whole path string from scratch to query for an element in the Ranorex Spy tree.
To support the editing of RanoreXPath expressions, the editor textbox provides an au-tomatic completion feature. This should help to avoid syntax errors and speed your typing.
Lets create an example path with Ranorex Spy to explore the possibilities of the Rano-reXPath editor box:
Ranorex Tutorial
1.Start the Ranorex Spy tool and track the Add button of the VIP Sample-Application. The automatically generated RanoreXPath expression is shown in the editor box.
2.last part of the expression by deleting theNow change the @controlname=btAdd within the brackets.
10
Chapter 2 | Object Recognition with Ranorex Set the cursor between both brackets and press the key combination <CTRL><SPACE> to activate auto completion.
RanorexTutorial
The auto completion shows the next options to go further in specifying the Rano-reXPath. Select the @ sign to introduce an attribute comparison. 3.Press the key combination <CTRL><SPACE> again to see which attributes for the button object are available.
Note:All of the available attributes listed in the drop down box are shown in the overview tab of Ranorex Spy as described above. Select the text attribute to do the identification based on the text value property of the button and press the auto completion key combination.
Select the equal sign and continue again with the key combination <CTRL><SPACE>.
Now finish the RanoreXPath by selecting the Add string value and press Enter to query the Ranorex Spy tree. The new RanoreXPath expression should find the same button as before. After pressing the Enter key, the editor box switches to RanoreXPath edit mode to filter for UI elements. Exercise 2: Modifying RanoreXPath
11