The easiest way to create a first test with Ranorex is to record a manually executed test scenario. The recorded actions like mouse clicks or keyboard actions are the base for building a robust test case. Within this lesson you will learn how to:
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 effort 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. Note: Read more about how to activate mouse movement recording here.
Recording a Test
In the following section you will create a new Ranorex Test Solution and record the process of adding a new person within the VIP Database application.
1. 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

- Specify programming language and project name
Within the categories box select C# and within the templates box select the Ranorex C# Test Suite item. In addition specify a name and a location for your new test suite project.
Click the ‘Create’ button and a new test suite project opens.

- 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 the ‘Recording1’ by double clicking the recording within the test suite view.

- Empty Recording
2. Start recording a test performed on VIP Database application.
Click the ‘Record’ button in order to start. The Recorder assists in preparing the application under test. Simply select ‘Run an Application’ and specify the directory and file name of the VIP Database application which is part of the sample directory within the Ranorex installation folder ('..\Ranorex 3.0\Samples\VIPTestSuite\C#\VipApplication.exe').

- New Recording dialog - Ranorex automatically starts the specified application
Click on ‘Start’ in order to record the test. The VIP Database application opens and the Ranorex Recorder starts running.

- Recording actions for VIP Database application
3. Add a new VIP to the VIP Database.
- Click on the ‘First Name’ text box and type in John
- Click on the ‘Last Name’ text box and type in Smith
- Click the radio button ‘Male’
- Select the list item ‘Music’ within the category box
- Click the ‘Add’ button
4. Validate the status text.
After adding a new person, the text value of the status bar should change from ‘VIP count: 0’ to ‘VIP count: 1’. Click the ‘Validate’ button within the ‘Recording’ toolbar to check whether this is correct. Move the mouse pointer to the status field and wait a second until the underlying UI element is highlighted.

- Identfy element to validate
The dialog shows all available attributes for the given UI element to check. Just click the ‘OK’ button in order to accept the preselected ‘Text’ attribute.

- Select attribute 'Text' to validate
5. 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 clicking the ‘Delete’ button. Also close the application by clicking the close button.
6. Stop the Recording by pressing the 'Stop' button in the recorder toolbar.
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 the recording.

- Recorded steps shown within the actions table
Read more about different action types within Ranorex Recorder here.
Executing the Test
In order to execute the recorded test you need to switch back to the Ranorex Test Suite file.

- Start the test by clicking the 'Run' button
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 the same way a tester would do it.
Reporting
After executing the test, Ranorex Studio automatically opens the generated test report file (*.rxlog) which shows whether the test run was successful or not.
- Test run succeeded

- Test run failed
In order to force an error as shown by the right picture above, just modify the expected value used in the validation step of the recording.

- 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 part of the same directory too.

- 'MyFirstTestProject.exe' located within the build folder of the project
By default also the report files are generated within the same directory. Further information on changing the report folder can be found here. Read more about alternative ways to run the test suite from the command line or with the standalone test suite runner here.