Control structures

If

The control-if action conditionally executes a group of actions, depending on the boolean value of the condition

Name Type Required Action Info
condition action Yes Yes Condition for the "if" control. The action must evaluate to a boolean. Can be a combination of checks and logical operations.
then list of actions Yes No Sequence of actions.
else list of actions No No Sequence of actions.

Example

{"control-if" : {
         "condition": { "check-eq" : {
                                       "left" : {"counter-value":{"counter":"Session-Id"}},
                                       "right" : 3
                                       }
                       },
          "then" : [
                     {"counter-inc" : {
                                        "counter" : "Session-Id",
                                        "increment" : 1
                                      }
                     }
                   ],
           "else" : [
                      {"counter-inc" : {
                                         "counter" : "Session-Id",
                                         "increment" : 10
                                        }
                      }
                    ]
                }
}

Abort

The control-abort action aborts the scenario execution if condition returns false.

Name Type Required Action Info
condition action Yes Yes Condition for the ‘abort’ control.

Example

{"control-abort" : {
        "condition" : {"check-gt" : {
                             "left" : { "counter-value" : { "counter" : "Session-Id" } },
                             "right" : 3
                                    }
                      }
                   }
}

For

The control-for action executes a sequence of actions a specified number of times.

Name Type Required Action Info
from integer Yes Yes Counter initialization.
to integer Yes Yes Counter end.
then list of actions Yes No Sequence of actions.

Executes a list of actions \textit{from} to \textit{to} times.

Example

{"control-for" : {
                   "from" : 1,
                   "to" : 10,
                   "then" : [
                             {"counter-inc" : {
                                      "counter" : "Session-Id",
                                      "increment" : 1
                                              }
                             }
                            ]
                 }
}

While

The control-while action executes a sequence of actions as long as the specified condition is true.

Name Type Required Action Info
condition action Yes Yes Condition for the ‘while’ control. The action must evaluate to a boolean. Can be a combination of checks and logical operations.
then list of actions Yes No Sequence of actions.

Example

{"control-while" : {
          "condition": { "check-eq" : {
                                        "left" : {"counter-value":{"counter":"Session-Id"}},
                                        "right" : 3
                                      }
                       },
          "then" : [
                     {"counter-inc" : {
                                        "counter" : "Session-Id",
                                        "increment" : 1
                                      }
                     }
                   ]
                  }
}

Periodic

The control-periodic action can be used to repeat a sequence of actions at a specified interval. The periodic action is interleaved with the rest of actions in the scenario, but it is not enough to keep a scenario running. Once all other actions are finished, the scenario will finish.

Name Type Required Action Info
actions list of actions Yes No Sequence of actions.
milliseconds integer No No Time in milliseconds.
seconds integer No No Time in seconds.
minutes integer No No Time in minutes.

At least one of the time units must be specified. The time will be added and the total of milliseconds used as a "wait time". The list of actions will be executed periodically every time after the "wait time".

Example

{"control-periodic" : {
               "minutes" : 5,
               "actions" : [
                             {"counter-inc" : {
                                      "counter" : "Session-Id",
                                      "increment" : 1
                                              }
                                      }
                                    ]
                      }
}