Test suite structure & elements | Ranorex
Help CenterUser GuideRanorex Studio fundamentals

Test suite structure & elements

The purpose of this chapter is to introduce and explain the various options for creating and structuring test cases within a test solution based on small and modular recording modules. Therefore, test suite and its structuring elements are explained in detail.

In this chapter

    Sample solution

    The explanation of test suite concepts is based on a sample solution which can be downloaded hereinafter.

    Training! What do I do?

    Theme: Test suite

    Time: Less than 10min

    Download sample file

    Installation:

    Unzip the project directory to any folder on your computer
    Start Ranorex Studio and open the solution file RxDatabase.rxsln

    tipp icon

    Hint

    The sample solution is available for Ranorex versions 8.0 or higher. You need to agree to the automatic solution upgrade for versions 8.2 and higher.

    Renaming test suites

    Test suites can easily be renamed by changing the name of the corresponding test suite file name in the project file view.

    Renaming test suites

    Renaming test suites

    tipp icon

    Attention

    Renaming test suites is not recommended! If there are two or more test suites, renaming may lead to test solution breakdown.

    Test cases

    Test cases can be inserted and deleted easily. Follow the guidelines herein.

    Adding a new test case

    Adding a new test case

    Select the position, open the context menu and click > Add > New test case
    Assign the test case a meaningful name and find it in the test suite structure

    Setup & teardown region

    The setup and teardown regions are special test containers used to prepare and clean up test suites, test cases, or smart folders. They fulfill tasks valid for all test activities between them.

    Setup & teardown regions

    Setup & teardown regions

    Setup region

    • The setup region will be run before any other module in a test case/smart folder
    • It should contain any modules needed to bring the application under test in exactly the state your test can start from
    • A typical case for using this section is to start the application under test and log in as a user
    • The setup region will automatically be placed at the beginning of a test suite, test case, or smart folder
    • There is only one possible setup region available for each test suite structuring element
    Teardown region

    • The teardown region will be run last and when an error causes the test run to abort
    • The teardown region should hold any modules needed to clean up the application under test
    • A typical case for using this section is to delete all added data and close the application under test.
    • The teardown region will automatically be placed at the end of a structuring item
    • There is only one available teardown region each structuring item

    Adding recording modules

    To run test suites with testing tasks it is necessary to build up test cases by means of recording modules and code modules. This section shows how this is done. Adding a recording module, or a code module to the test suite is quite easy! Simply follow the guidlines herein.

    Adding a recording module to the test suite

    Adding a recording module to the test suite

    Drag a recording module from the module browser view into a structuring element of the test suite view
    Find the recording module as test item in the test suite structure
    Note icon

    Note

    Keep in mind, that only a reference to the recording module is stored in the test suite structure. It is, therefore, possible to ‘insert‘ one recording module to different structuring elements many times.

    Building tests

    Tests can be built by planning and creating a test suite structure and inserting recording modules into the structuring items. Our sample solution contains everything necessary to see how this works.

    Building a test

    Building a test

    How to build a test:

    Build a test suite structure
    Select and drag test items (recording modules, code modules) into the structure elements

    Smart folder

    Smart folders are a structuring element and improve test case organization, overview and test efficiency. Only checked test cases and smart folders are executed during a test run.

    Smart folders can be added as simple as adding any other test suite structuring element.

    Assume we want to make the test validation of the database list counter selectable, i.e. we want to choose at the beginning of a test case, if the validation step is to be executed, or not. One solution would be to include the test validation into a smart folder. See how it works!

    Adding a new smart folder

    Adding a new smart folder

    Select the position in the test suite, open the context menu and click > Add > New smart folder

    Adding recording module to smart folder

    Adding recording module to smart folder

    Assign the smart folder a meaningful name
    Drag the corresponding recording modules from module browser view into the smart folder

    Module groups

    Module groups are a structuring element which is used to group test items into useful and possibly re-useable collections. Module groups are a central place for maintaining and managing test items which logically belong together.

    Module group file

    Module group file

    Important to know:

    • The file name is derived from the test project name and contains the file ending ‘rxtmg’ which is the abbreviation for Ranorex test module group.
    • The module group file is created along with the creation of a test solution, independent if you define a module group, or not.

    Creating a new module group

    Assume that all test activities concerning the insertion of person data to the database form shall be grouped logically into a module group.

    Creating a new module group

    Creating a new module group

    Select the recording modules to be grouped together
    Open the context menu and click > Group selected modules
    See the register pane opening a module group file
    Find the new module group with included recording modules

    Renaming module groups

    Module groups can be renamed easily. This can be done by opening the context menu and choosing the corresponding menu selection, by selecting the module group and pressing F2 on the keyboard, or by a slow-double-click.

    Renaming module groups

    Renaming module groups

    Change the module group name in the module browser view
    See the changed module group name in the test suite view

    Cut/copy/paste/delete

    All elements within the test suite can be cut, copied, pasted and deleted. The basic principle is easy and well known.

    Cut/copy/paste/delete menus

    Cut/copy/paste/delete menus

    Deleting recording modules from the test suite structure

    • Be aware that deleted recording modules are only removed from the test suite
    • They usually remain stored and managed within the project file view until they are deleted from there
    • Adding a recording module to the test suite means adding a ‘reference’ to the test suite
    • Deleting a recording module means deleting the reference of the module, not its physical representation
    • This concept allows applying a recording module multiple times within a test suite in different test cases, smart folders and module groups

    Deleting module groups

    • Deleting a module group means deleting the reference to the module group
    • The module group itself remains maintained within the module browser view and the module group file remains in the project file view until it is deleted from there

    Moving test suite elements

    Nearly any test suite element can be moved within the test suite structure at the user’s will. There are moving restrictions with respect to the destination position which have their origin in the initially presented test suite structure overview.

    Test suite structure summary

    Test suite structure summary

    Important to know:

    • Test containers (test case, smart folder) and test items (recording module, code module, module group) can only be moved in the way they can be created (see corresponding section of the user guide)
    • This means, that a recording module cannot be moved into the test suite or a smart folder which is the direct descendant of a test suite
    Note icon

    Note

    Ranorex assists you in moving test suite elements by means of an auto-convert functionality. This function may overcome type-based test suite element conversions.

    How to move?

    Moving test suite elements is done by simple drag&drop. Usually, you are able to select one or more test suite elements by using Shift+Ctrl and move them by one drag&drop action. Moving a structuring element implies the movement of all including elements.

    Example for moving a recording module

    Example for moving a recording module

    Move to setup/teardown

    Module groups, module recordings and code modules within test cases, or smart folders can directly be moved to corresponding setup and teardown regions.

    Context menu of test items

    Context menu of test items

    Select the test item(s) which is to be moved
    Open the context menu
    Click > Move to setup or > Move to teardown

    Alternative:

    Alternatively, you can drag&drop items.