Modularizing test script

After you record a test, you can modularize or split the test into multiple test segments with different nodes. With the test-splitting capability, you can record a relatively long scenario with many functional steps against an application and then, in the editor, modify the target apps. Then you can generate multiple tests from a single recording that you can replay in a different order with a schedule. You can also insert in a test such elements as transactions, loops, IF-THEN conditions or random selectors.

Procedure

To split test actions:
  1. In the Test Navigator, browse to the test and double-click it. The test opens.
  2. In the test editor, select one or more actions in the test script for splitting into one or more application nodes. You can select elements, except for variable containers, that are immediate child elements of the root node of the test.
  3. Right-click the selected elements, and then select Split UI actions. The Refactoring test window opens:

    Refactoring test to split actions

  4. On the right side of the Refactoring test window, under After Refactoring, examine the changes to be performed as a result of the split. Then, click Next.

    Summary to split changes

    You can leave or clear the options if you do not want certain data to be correlated. Then, click Finish.

  5. Alternatively, select Split and create container and the container that you want to be created: transaction, loop, IF-THEN conditions or random selector.

    Test elements to add when splitting test

  6. Select one of the following options: Create containers for selected nodes only, which applies only to the selected nodes, or Create containers for all group of nodes, which applies to all groups of nodes containing selected steps in the test script. In the right pane, under After refactoring, you can see a dynamic view of the structure that could apply to your test script depending on the option selected.
  7. Click Next to display a view of the refactoring changes.
    One or more app nodes In application: AppName are created in the test script from the selected test element.
  8. Click Finish to complete the refactoring.
  9. Optionally: you can change the target app to be tested for a selected app node. Here's how:
    1. Select an app node in the Test Contents.
    2. Click the Change Application button and in the list of applications available, select a new app.
    3. Select Starts a new instance of application selected below.
    4. To apply the change of app to all the test nodes, that is to the whole test suite, click change application in the whole test suite.
    The test nodes turn from In application: AppName to Launch application: AppName.
  10. Save the test.