Test suite structure & elements | Ranorex
HomeUser GuideRanorex Studio FundamentalsTest suiteTest suite structure & elements

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:

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

    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
    See 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

    Action(s):

    1. Build a test suite structure
    2. Select and drag test items (recording modules, code modules) into the structure elements
    3. Correct test item position if necessary

    Smart folder

    Smart folders enable to further structure test cases (and test suites) to keep or improve test case organization, overview and test efficiency.

    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 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 hitting F2 on the keyboard, or by simply pressing the left mouse button on the name of the module group.

    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 and the module browser 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 project file view and the module browser 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 might be 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

    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 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

    Action(s):

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