Scenarios

PDF Print E-mail
User Rating: / 10  |  Rate this article: PoorBest 

LoadUI further allows you to create any number of Scenarios in your project; a Scenario is basically a separate collection of components that can be executed independently of your test and that can be deployed to a remote LoadUI Agent (this is the core of the distributed testing functionality).

Add a new Scenario to your project by simply dragging it from the component bar on to the Project View:

addedtestcase

Once created as in the screenshot above, double-click the Scenario to open it for editing, which will open the following view:

scenario_view

This is basically the same view are as you had at the project level, the only differences being;

  • A Scenario bar has been added at the top of the window for controlling the Scenario execution
  • The Scenario Category is no longer available from the Component toolbar (since you cannot nest Scenario)

When you add components and close the Scenario, it will display a miniature of its setup in the project view:

testcaseminiature

(The toolbar on the Scenario component at this level allows you to control Scenario execution just as you can with the toolbar inside the ScenarioView)

As mentioned above, one of the main reasons for setting up your load scenario in a Scenario instead of at the project level is that you can distribute it to any desired number of remote LoadUI Agents, read more about distributed testing in Distributed Testing.

Running Scenarios

A Scenario is a collection of components that can be run either locally or on a remote LoadUI Agent. Opening a Scenario reveals a slightly extended Runner Toolbar at the top of the ScenarioView:

scenario_bars

Here can on the top see a miniature version of the containing projects runner toolbar and below it a Scenario Runner Toolbar containing the same buttons and counters as the Project Toolbar did above, with the addition of a “Link” button (which is selected by default).

The buttons and counters work just as their project level counterparts; with them you can run/pause/stop the Scenario, set limits, etc. If you are running in “Local Mode” (as configured in the Main Toolbar) the Scenario will be run locally just like components on the Project level, if you are running in Distributed mode then the Scenariowill be run on the Agents it has been deployed to (see Distributed Testing for more details on distributed execution).

The Link button allows you to control how a Scenario executes in regard to the containing Projects execution:

  • If it is enabled the Scenario will start running when the Project is run (if it isn't connected to a Scheduler, see below)
  • If it is disabled the Scenario has to be started either manually or using one of the Scheduler components (more on that later)

In either case, pressing the Stop button on the project level will always stop everything, including all Scenarios in your Project (this is your “Panic” button).

You can control the execution of a Scenario from its miniature also:

testcaseminiature

The corresponding buttons for starting/pausing/stopping and related counters are here as well.

Using a Scheduler to run a Scenario

One common use for a Scenario is to use one of the available scheduler components to run the Scenario at certain intervals or specific times during the execution of the Project. For example we can use the “Interval Scheduler” to start a Scenario 5 minutes after the Project has started:

testcasewithscheduler

The Interval Scheduler to the left will initially disable the Scenario when the test starts (thus overriding the Link setting on the Scenario ) and then start (and stop) the Scenario as configured. In the following example we've set a Schedule Scheduler to run the Scenario the first 5 minutes of every hour:

testcasewithscheduler2