Ranorex Help Center How can we help you?

Lesson 1 - Getting Started

In this lesson you will gain a deeper understanding of the recorder. The first recording will capture a set of user actions (mouse clicks, keystrokes) done while working with the tool KeePass which is delivered with Ranorex Studio. KeePass is a widely available and easy to use open source password manager.


Screencast The screencast "Quick Start with Ranorex Test Automation" gives a short introduction to the Ranorex Recorder. You can jump directly to the noted position in the video by clicking http://youtu.be/0S_YC7uwI-s#t=1m8s .

Preparing to Record User Actions

Before you start recording you need to ensure that your system under test (SUT) is ready to start with the manual test execution. In addition, consider the following points in order to avoid too much work in cleaning up the recording and the repository afterwards.

  • Do not run multiple instances of your application under test if that is not part of the test case itself.
  • By default mouse movements are not recorded. For this reason please also perform a mouse click in situations like when navigating through menus.

System Under Test: KeePass Password Safe

Note Read more about how to activate mouse movement recording in Lesson 5 - Ranorex Recorder - Recorder Hotkeys .


As mentioned in the overview section, this tutorial uses the open source tool KeePass to demonstrate Ranorex functionality for automating an application in order to build up a testing framework. KeePass is a powerful and easy to use tool for managing passwords and other private information. For more information about KeePass, please have a look at the following URL: http://keepass.info .
Open source tool KeePass

Open source tool KeePass


Since version 3.3, KeePass is included with Ranorex Studio along with a sample database file.


Note:The password to open this database file is 'rx'.

On the start screen of Ranorex Studio you'll find a 'Sample' button which also includes a sample test suite project that handles some test cases within the KeePass application. You can have a closer look at that in Lesson 4: Ranorex Test Suite - General Structure of a Test Suite and its Test Case.

Recording a Test

In the following section you will create a new Ranorex Test Solution and record the process for adding an entry to KeePass.

Start Ranorex Studio and open the empty recording file.

Open Ranorex Studio by choosing Start>Programs>Ranorex>Ranorex Studio. Click the 'New Test Solution...' button to create a blank test suite project.

Ranorex Studio Start Page - creating a new test solution

Ranorex Studio Start Page - creating a new test solution

In the categories box select C# and in the templates box select the Ranorex C# Test Suite item. Next specify a name and a location for your new test suite project.


Note Because of possible performance and security impacts, projects should not reside on a network drive (neither should Ranorex itself be installed on a network drive). It's recommended to use a version control system (VCS) instead.

Click the 'Create' button and a new test suite project opens.

Specify programming language and project name

Specify programming language and project name

New Ranorex Test Suite containing one test case using an empty recording

New Ranorex Test Suite containing one test case using an empty recording

Within the test suite view, the template already contains a single test case which uses an empty recording. In order to start recording simply open 'Recording1' by double-clicking the recording within the test suite view.
Empty Recording

Empty Recording

Start recording a test  for the KeePass application.


Note It's recommended to copy the KeePass application folder from the sample directory within the Ranorex installation folder (<Ranorex Installation Folder>\Samples\Desktop\KeePass Sample\KeePassTestSuite\KeePass) to your projects folder as by default you do not have write access to the program folder which is necessary to save the database handled by KeePass.

You can open the project folder by right-clicking the project in the 'Projects' view and choosing 'Open Folder in Explorer' from the context menu

Open project folder in explorer to copy the sample application to the project folder

Open project folder in explorer to copy the sample application to the project folder

Click the 'Record' button in order to start. The Recorder assists you in preparing the application under test. Choose 'Desktop' as technology and click on 'Add app' to add KeePass to the list of applications under test.
Choose a technology to record your test

Choose a technology to record your test

Ranorex automatically starts the specified application

Ranorex automatically starts the specified application

Click on 'Record' in order to record the test. The KeePass application opens and the Ranorex Recorder starts running.
Recording actions for the KeePass application

Recording actions for the KeePass application

Note You will notice that a red border will be shown when moving the mouse over a UI element indicating which element is taken for automation. The red border will assist you during the recording process. You can en-/disable this feature in the Recorder Settings Dialog.

Enter the default Password.

  • Click on the text field next to the 'Master Password' check box
    Type in the default password ('rx')

    KeePass Login Dialog

    KeePass Login Dialog


    KeePass application

    KeePass application

Open the 'Add new Entry' Form.

  • Click on 'Edit' in the main tool bar
  • Click on the 'Add Entry' menu item
KeePass application with sub menu 'Edit' (Menu item 'Add Entry' is selected)

KeePass application with sub menu 'Edit' (Menu item 'Add Entry' is selected)

Add a new entry to the KeePass application.

  • Click on the 'Title' text box and type in 'WordPressDemo'
  • Click on the icon button (with the key symbol)
    • Choose any icon (e.g. the second one)
    • Click on 'Close'
  • Click on the 'User name' text box and type in 'admin'
  • Click on the 'Password' text box
  • Click again with the right mouse button
  • Choose 'Select All'
  • Type in 'demo123'
  • Repeat the same for 'Repeat' text box
  • Click on the 'URL' text box and type in  http://bitly.com/wp_demo
  • Click the 'Expires' button on the right (watch symbol)
    • Choose '1 Year' menu item
  • Click on 'OK' button
    KeePass form for adding a password entry

    KeePass form for adding a password entry

    KeePass form for choosing an icon

    KeePass form for choosing an icon

    KeePass expiration sub menu

    KeePass expiration sub menu

Validate the result.

After adding a new password entry, a new row is added to the KeePass grid holding the recently entered item. Click the 'Validate' button within the 'Recording' toolbar to check whether the entry appears in the grid. Move the mouse pointer to the grid (i.e. the first cell) and wait a moment until the underlying UI element is highlighted.

KeePass form with highlighting frame for validation

KeePass form with highlighting frame for validation

At the first step of the validation you can choose the UI element you want to validate. Verify that the correct element is selected and click on the 'Next' button. At the second step, all available attributes for the given UI element to check are shown. Just click the 'OK' button in order to accept the preselected 'Text' attribute.
Choose UI element to validate

Choose UI element to validate

Choose attribute to validate

Choose attribute to validate

Delete added item and close application.

In order to finish the recording scenario select the added item within the data grid and delete it from the list by pressing the 'DEL' button on your keyboard.

Finally press the save button in the toolbar and close the application by clicking the close button.

Screenshot indicating the save button in the tool bar

Screenshot indicating the save button in the tool bar

Stop the recording by pressing the 'Stop' button in the recorder tool bar.

Analyzing Recorded Steps

The Recorder created single steps for each operation you performed on the application. These steps are represented within the actions table. In addition each action item is connected to a repository item which represents a UI element (text boxes, radio buttons, buttons, etc.) used during recording.

Recorded steps shown within the actions table

Recorded steps shown within the actions table

You can read more about different action types within Ranorex Recorder in Lesson 5 - Ranorex Recorder - Additional Editing Options.

Executing the Test

In order to execute the recorded test you need to switch back to the Ranorex Test Suite file. Just click on 'Run' to execute the test suite with your first recorded test.

During the execution Ranorex simulates all user actions (mouse movements and keyboard events) in order to test the application in the same way a tester would successfully do it.


Start the test by clicking the 'Run' button

Start the test by clicking the 'Run' button

Reporting

After executing the test, Ranorex Studio automatically opens the generated test report file (*.rxlog) which shows whether the test run was successfully or not.

Test run succeeded

Test run succeeded


Test run failed

Test run failed

In order to force an error as shown in the picture above, simply modify the expected value used in the validation step of the recording (e.g. 'Typo3Demo' instead of 'WordPressDemo').
Force an error by changing the expected value of the validation step

Force an error by changing the expected value of the validation step

Now the test automation executable is also available within your project folder. To run the test suite without starting Ranorex Studio, simply double-click the executable file.


Note In order to run the test suite project on an external machine it is required to have the executable (*.EXE) as well as the test suite file (*.RXTST) in the same directory at the target machine. If your Ranorex Studio solution consists of more than one project, you need to ensure that the library (*.DLL) files are also part of the same directory. In short, it is best to copy the complete output folder (e.g. 'bin/debug') to the target machine.
'MyFirstTestProject.exe' located within the build folder of the project

'MyFirstTestProject.exe' located within the build folder of the project

By default the report files are also generated within the same directory. Further information on changing the report folder can be found in Lesson 4: Ranorex Test Suite - Test Suite Settings.

Read more about alternative ways to run the test suite from the command line or with the standalone test suite runner in Lesson 4: Ranorex Test Suite - Running Tests without Ranorex Studio.