The test suite structure

In this chapter, you’ll learn about the items that make up a test suite, how to add them, their purpose and functions, and the hierarchy they follow.

In this chapter

    Add test suite items

    There are three ways to add items to a test suite.

    Use the ADD button.

    Adding test suite items using the ADD button
    Use the context menu in the test suite workspace.
    Adding test suite items using the context menu
    Drag and drop from the module browser. This only works for modules and module groups.
    Adding test suite items using drag&drop
    Note icon

    Note

    You can only add items to the test suite as the test suite hierarchy permits. If an item can’t be added at the desired position, it is grayed out in the menu. The test suite hierarchy is explained at the end of this chapter.

    Test suite items

    In this section, you’ll learn about the items that make up a test suite. Test suite items can be separated into two groups, structure items and test action items.

    Structure items form the framework of your test.

    Test suite structure items
    Test action items contain the actions to perform during your test.
    Test suite action items

    The test suite

    The test suite item serves as the root structuring item. It contains all other items and cannot be cut, copied, pasted, or deleted. It can contain only other structuring items as direct children, i.e. no modules or module groups.

    The test suite item is where you configure global parameters and report settings for the test suite. Access these through the context menu.

    Test cases

    A test case is a structuring item. Each test case represents a primary function of your test suite, such as adding an entry to a database. Build test cases by populating them with modules and module groups. You can also add smart folders to test cases to organize them further. Test cases cannot contain other test cases.

    You can configure error behavior, data bindings, and conditions for test cases through their context menu.

    Test cases are the only items counted in the test report success counter.

    Smart folders

    A smart folder is a structuring item. Use smart folders to organize your test suite as you would in a folder hierarchy. You can populate smart folders with modules and module groups, but only if the smart folder is a child of a test case.

    You can configure error behavior, data bindings, and conditions for smart folders through their context menu.

    Setup/teardown regions

    Setup and teardown regions are structuring items. You can add one of each to the test suite item, test cases, and smart folders. The setup region will always be placed at the beginning of an item and the teardown region at the end.

    To add a setup or teardown region:

    Right-click the desired item.

    Click Add setup or Add teardown.

    Adding setup & teardown regions

    Adding setup & teardown regions

    Setup regions are always executed before anything else in the direct parent item. Populate setup regions with the modules and module groups needed to bring the AUT to the state required for the following modules to run, such as starting the AUT and logging in.

    Teardown regions are always executed after everything else, or when an error occurs in the direct parent item. Populate teardown regions with the modules and module groups needed to clean up the AUT after a test run, such as deleting all entered data and closing the AUT.

    Modules

    Modules are test data items. They contain the actions performed during a test. You can add modules to all structure items except the test suite item and smart folders that aren’t the child of a test case.

    There are two types of modules:

    Recording and code modules

    Recording and code modules

    Recording modules

    • Contain actions you’ve recorded or added using the Ranorex Recorder and its action table.

    Code modules

    • Contain actions programmed in code.

    You can configure data bindings for modules through their context menu. You can also group several modules to create module groups, as explained below.

    Note icon

    Note

    When you add a module to a test suite, you only add a reference to it. In the same way, when you delete a module from the test suite, you only delete that reference and not the module itself.

    Module groups

    Module groups are test data items. Use them to group modules that logically belong together, such as data validations that usually occur together. You can add module groups to all structure items except the test suite item and smart folders that aren’t the child of a test case.

    All module groups are stored in a separate file. You can locate this file under the project in the projects view. By default, it’s named
    [Project name].rxtmg (for Ranorex test module group).

    Module group file

    Module group file

    There are two ways to add module groups:

    Direct grouping

    In the test suite view, select one or more modules that you want to group.
    Right-click one of them and click Group selected modules.
    The newly created module group opens in the module group view.

    The module group view opens with the new module group selected. The new module group also appears in the module browser.

    Creating a module group with direct grouping

    Creating a module group with direct grouping

    Adding modules individually

    In the test suite view, right-click the structure item to contain the new module group.

    Click Add > New module group. The module group view opens with the new module group selected.

    Creating a module group using the context menu

    Creating a module group using the context menu

    Drag and drop the desired modules from the module browser to the module group.

    The new module group appears in the module browser. You can rename module groups and organize them in folders in the module group view.

    Note icon

    Note

    When you add a module group to the test suite, you only add a reference to it. In the same way, when you delete a module group from the test suite, you only delete that reference and not the module group itself.

    Test suite hierarchy

    Test suite items are organized in a hierarchy. This hierarchy controls where items can be added or moved, as illustrated below:

    Test suite hierarchy

    Test suite hierarchy

    Note icon

    Note

    • Test cases can never be a child of another test case.
    • When you move a test case into another test case, Ranorex will automatically convert it to a smart folder for you.
    • A smart folder can contain modules or module groups only when it is the child of a test case.