Creating If-Then-Else

Document created by Chris Sommerstad Employee on Jul 21, 2017
Version 1Show Document
  • View in full screen mode

About If-Then-Else

If-Then-Else containers are conditional statements that work similarly to those common in many programming languages. They provide actions to take when a predicate event occurs (the if), in which case a consequence is executed (the then), and in the absence of which (the else) an alternative action occurs.

In CloudTest, an If-Then-Else statement generally checks a constant, property, or script for an expected value. If the constant is true, or the value of a property is returned, then a consequence occurs (such as the execution of the page shown above). In the case of the above example, if the property condition is not as expected, the Else action is provided to exit that portion of the test.

Creating an If-Then-Else Statement in Icon View

If-Then-Else containers can be created either on one or two containers, messages, or browser actions. They cannot be created on clip elements within a page.

  • Select one item to create and If/Then.
  • Select two items to create an If-Then-Else. An Else statement can be added at a later time by using drag and drop on any valid clip element (e.g. messages, browser actions, or containers).
  1. First, identify to clip elements to create the If-Then-Else container. Right-click and choose Create If-Then-Else after doing so.

When you do so, the selected items are placed into the container with the default IF value of Property [not specified].

    1. Define the IF portion of the statement by selecting from the drop-down. Choose from among Constant, Property, Linked Script, or Embedded Script.

  • For a Constant, set the value to True or False. The use of a constant in this context is useful for test creation and provides an additional “debug” mode. In cases where more than two values are possible in a response, consider using the new Switch container.

    • For a Property, click Browse to select the value from the Property Chooser dialog box.

      • For a Linked Script, click the Script icon to select from the Script Browser. The script must already exist at the time of selection.

After selection, the script name is inserted into the Switch line.

    • For an Embedded Script, click the Plus icon if necessary to expand the entry field and enter or paste the script.

 

  1. Save the test clip after making the above changes.

 

Creating an If-Then-Else Statement in List View

If-Then-Else statements can be created either on one or two containers, messages, or browser actions. They cannot be created on clip elements within a page.

 

    1. First, identify to clip elements to create the If-Then-Else container. Right-click and choose Create If-Then-Else after doing so.

When you do so, the selected items are placed into the container with the default IF value of Constant is True.

  1. Define the IF portion of the statement by selecting from the drop-down. Choose from among Constant, Property, Linked Script, or Embedded Script.
    • For a Constant, set the value to True or False. The use of a constant in this context provides an additional “debug” mode within CloudTest.
    • For a Property, click Browse to select the value from the Property Chooser dialog box.
    • If-Then-Else containers can also use any existing script in the repository for their condition. To use a script, browse to select a script from the Script Browser.
  2. Save the test clip after making any changes.

 

If-Then-Else in Result Details

If-Then-Else appear in the Result Details navigation tree just as other containers or clip elements from the CloudTest repository appear.

Locate the If-Then-Else in the navigation tree and expand it to display its children. The result for the If-Then-Else container above shows the conditional action that was taken during the test.

Once the container is selected in the Navigation Tree (or in the Cover Flow at the top), review its Summary information on the right.

Click the Events List tab to display more detail statistics about the nested clip.

If-Then-Else in Basic Widgets

If-Then-Else containers appear in results for all widgets that display containers.

Nesting is now reflected in the Clip Analysis, Clip Element Analysis, Collection Analysis, and Composition Analysis.

 

Clip Element Analysis

If-Then-Else containers appear in the parent clip’s object hierarchy at the same level as other clip elements that reside at that level.

Collection Analysis

If-Then-Else are shown in the Collection Analysis chart alongside any other collection types.

Composition Analysis

The Composition Analysis also shows the object hierarchy, including clip elements such as If-Then-Else.

If-Then-Else in Charts

If-Then-Else are also shown in the Charts category where the given chart shows collections.

 

Bandwidth by Collection

This chart will show If-Then-Else as a percent of bandwidth along with any other collections.

Top N Collections by Bits Received

This chart shows If-Then-Else whenever they rank among the Top N by bits received.

Attachments

    Outcomes