Lesson 2: Ranorex Modules - Test Actions

The ease of recording user actions encourages one to record all test cases without thinking about reusability. But in the long run, this could increase the effort in test automation maintenance. For this reason you should separate a recording into smaller reusable recording modules as suggested by the keyword driven methodology. Within the following section you learn how to separate the existing recording into smaller pieces, so that they can be used within other test cases too.

Identifying Modules

In your first recording you did the following from a keyword driven perspective:

  • Started the application VIP Database
  • Added a new person
  • Validated the current text of the status bar
  • Deleted the added person
  • Closed the application

In order to split recordings into smaller automation modules use the context menu item 'New Recording From Selection'.

Move first action to a new recording to ...
Move first action to a new recording
... newly created recording called 'StartSystemUnderTest'.
Create a new recording named 'StartSystemUnderTest'
Also select and move all items within the recording used to do the validation and to delete the person to a new recording named ValidateAndDelete.rxrec the same way as before. Repeat the previous step to create the last new module for ‘CloseApplication'. Also rename the initial recording file from 'Recording1.rxrec' to 'AddVip.rxrec'. Finally you should have four separated new recording modules.
Recording module 'StartSystemUnderTest'
Recording module 'StartSystemUnderTest'
Recording module 'AddVip'
Recording module 'AddVip'
Recording module 'ValidateAndDelete'
Recording module 'ValidateAndDelete'
Recording module 'CloseApplication'
Recording module 'CloseApplication'

After splitting the initial recording into smaller test actions the Ranorex Module Browser also contains the new modules. Now simply use the drag&drop feature to combine these modules within the test case as follows:

Use the drag and drop feature to specify your test case within the test suite view
Use the drag and drop feature to specify your test case within the test suite view
Separating a recording into smaller modules is the first step to build robust and reusable automation modules. In addition replace constant values used within these modules with variables in order to enable parameterization. Read more about how to use variables in section Lession 3: Data Driven Testing.