Ways to design your Scenario

Business Scenarios consist of one or more inbound and outbound messages.

The OSV Host uses the values of specific message elements as identifiers to start or resume business Scenarios. With the help of these identifiers, the system assigns inbound messages to the respective business Scenario.

The OSV Monitor displays a Scenario's identifiers in the Identifier column of completed Scenarios, pending Scenarios or the environment log (see chapter "Display completed Scenarios", chapter "Check pending Scenarios" or chapter "Check the Environment Log").

Depending on your Scenario, the system automatically assigns inbound messages to your Scenario. OSV distinguishes between three main approaches:

Blue algorithm

Blue algorithm - concept

OSV uses the blue algorithm if your Scenario fulfills the following requirements:

  • The value of the identifier does not change during the Scenario, i.e. all identifiers of inbound messages within the same Scenario have the same value as in the first inbound message.

    Usually, this concerns CustomerIDs or AccountIDs. These IDs can appear in different messages in different nodes.

    You can also use a wildcard * in your first inbound message if the value is unknown at this point. If you want to reuse the currently unknown value later, perform a buffer on the value (see below).

  • Each inbound message contains the identifier.

    If one or more inbound messages do not contain the identifier, the message is likely not relevant from a business perspective.

You can specify the value of the identification elements as static string, a semicolon-separated list of static strings, or use regular expressions (see chapter "ActionMode WaitOn").

To run a Scenario, the inbound message must contain all specified identification elements with their identifiers.

If an identifier consists of a list of strings, the identification element must contain at least one of the specified values.

Instead of defining identifiers within Scenarios, you can also define them in an external Excel spreadsheet (see chapter "Work with XExcel").

The following example illustrates a practical application of the blue algorithm.

In this case, the system runs the following test:

  • request details for an order with an orderId of 2

  • respond with the corresponding information

  • change the order status to pending

  • verify the new order status

The orderId is part of both inbound messages. Moreover, its Value of 2 is known beforehand and will not change over the course of the test.

Request and response messages

The example below illustrates the use of a wildcard.

At runtime, the first name is not yet known. However, you want to use it in your tests later on.

Setting a wildcard

Yellow algorithm

Yellow algorithm - concept

OSV uses the yellow algorithm for your Scenario if:

  • You have control over at least one field of your inbound messages, i.e. you can configure your own message elements with flexible values.

  • You want to know which user is running which tests.

  • You want to have Scenario ID control and information on the run instance.

  • You want to tell the system explicitly which Scenario to run. To view a list of your pending Scenarios, check the OSV Monitor (see chapter "Check pending Scenarios").

In this case, the identifier used in your inbound message must follow the syntax below:

Syntax:

<Scenario name>+<Scenario ID>+<username>

  • Scenario name: The Scenario name must match the name given during Scenario design (e.g. OSV Yellow Scenario).

  • Scenario ID: The Scenario ID is any number used to differentiate between various runs of the same Scenario (e.g. "1").

  • username: Define the user name of the user currently running the Scenario (e.g. "john").

When you design your Scenario, define one identification element whose value contains the name of the Scenario.

The following example illustrates a practical application of the yellow algorithm.

In this case, a tester named Jane wants to create an order and add the information that she is running the test.

Jane adds a string to the first inbound message. The string contains a counter and Jane's name.

First message from Jane

The orderID does not need to be unique. Therefore, OSV identifies inbound messages for the same Scenario using the yellow algorithm and the element identifier as identification element.

Scenario Design yellow algorithm

Green algorithm

Green algorithm - concept

OSV uses the green algorithm for your Scenario if:

  • The value of the identifier changes during the Scenario. In this case, the system needs to identify the first inbound message using the blue or yellow algorithm.

    Use green buffers as green algorithm identifiers. They are the only buffers OSV validates for identification elements. Green buffers have the prefix $.

    You can define more than one green buffer for the same Scenario. The names are independent from other Scenarios.

  • You need to continue your Scenario after an ID has changed.

    To continue a pending Scenario, you have to define green buffers during the Scenario design (see chapter "Use buffer and green buffer").

  • The identifier appears in different fields.

    Define several identification elements using the {optional} keyword (see chapter "Use the green Selector"). In this case, at least one of the identification elements have to match the value stored in one of the defined green buffers.

Define identification elements explicitly by specifying the name of the green buffer in the Value column. In this case, each identification element has to match the value stored in the specified buffer.

You cannot start Scenarios with the green algorithm. Scenarios need to start with either the blue or yellow algorithm.

In this example, OSV gets a request to create a new order for somebody who lives in Vienna, Austria.

The following example illustrates a practical application of the green algorithm.

In this case, the system runs the following test:

  • create an order for a customer who lives in Vienna, Austria

  • insert a random order number into the orderID and write the value to the green buffer

  • change the order status to pending

  • verify the success

OSV starts the Scenario with the blue algorithm.

The system uses the green selector {optional} to assign the message to the Scenario whose identification element matches the previously created green buffer.

Scenario Design yellow algorithm