Last modified on May 27, 2020.

About scenarios

In LoadNinja, a scenario (or load scenario) defines all the parameters for the load test run:

  • The number of virtual users to be simulated.

  • The “single-user” UI or API tests that these virtual users will simulate.

    (A UI test is a sequence of user actions on a web page. These tests correspond to a user working with the website. And an API test is a sequence of API requests to the tested web service. They correspond to client apps working with the service.)

  • Load type.

  • Think time settings.

  • Error-handling options.

To work with scenarios of your project, go to the Load Test Scenarios tab of the project editor:

List of scenarios in the project editor

Click the image to enlarge it.

To view properties of some existing scenario, click this scenario in the scenario list.

Here is a sample view of scenario settings:

Scenario editor

Click the image to enlarge it.

Virtual users

  • The Number of concurrent virtual users setting specifies the desired number of concurrent virtual users your load test will simulate. The maximum number is limited by your plan.

    LoadNinja simulates every virtual user several times during the run. If some user completes their test, LoadNinja starts the next iteration of that virtual user.

  • Every virtual user runs one of UI or API tests, depending on the load distribution. A scenario can have several UI tests or several API tests.

    Currently, you can create scenarios that have UI or API tests only. This is specified by the type of the first test you added to your scenario: if it is a UI test, you can then add only UI tests to the scenario. If it is an API test, you can add API tests only. To change the scenario type, remove all UI tests (or all API tests) from the scenario and add tests anew.

  • Each of UI tests can have multiple steps. Similarly, each of API tests can have multiple requests. The total number of all “UI-test” steps in a scenario must not exceed 45 regardless of the plan you have. The maximum allowed total number of API tests’ requests in one load scenario is 100.

Load Distribution settings

Click the image to enlarge it.

Load types

Each scenario uses one of the following load types:

  • Duration-based means LoadNinja simulates virtual users for a specified period of time. If some virtual user completes its test, LoadNinja starts the next iteration of that user simulating the same test. The number of iterations is not limited. If the load-test time elapses, LoadNinja doesn’t start new iterations anymore.

    Duration-based load tests
  • Iteration-based means LoadNinja simulates each virtual user for the specified number of times.

    Iteration-based load tests

For more information on load types and other parameters, see Load Configuration Settings.

Scenario settings

For more information on scenario settings, follow these links:

Create a scenario

  1. Go to Projects and click your project there:

    The list of proojects

    Click the image to enlarge it.

  2. In the project editor, switch to the Scenarios tab and click Create Scenario:

    Create scenario

    Click the image to enlarge it.

    This will open the scenario editor.

  3. At the editor’s top, click to rename the scenario. Specify a new name and press Enter:

    Rename scenario

    Click the image to enlarge it.

  4. Configure scenario settings as needed.

  5. Click Save to save the scenario and to return to Projects:

    Save scenario

    Click the image to enlarge it.

Create a scenario from the UI test recorder

To create a scenario right after recording or editing a UI test:

  1. Record a script as usual.

  2. Click on the recorder’s toolbar to play back the script.

  3. If the playback is successful, you will see a dialog from which you can run this script in a load test:

    Create scenario from dialog

    Click the image to enlarge it.

  4. Click Save and run load test.

  5. On the subsequent page, name your script and select the project you want to associate this script with, then click Save script and continue.

  6. Next, configure the available settings:

    Create scenario from dialog: Settings

    Click the image to enlarge it.

    • Number of concurrent virtual users

      The maximum number of concurrent virtual users (VUs) to be simulated during the run.

      During the ramp-up period (if you use it), the number of concurrent virtual users will be less than this number. LoadNinja starts running the load test with 0 virtual users and adds them gradually during the ramp-up period until their amount reaches the value specified by the Virtual Users setting.

      For information on how LoadNinja simulates virtual users, see load type descriptions.

    • Duration of tests (min)

      Duration-based load tests run for some period of time. The Duration of test value sets the duration of the maximum load in minutes.

      Note: For more information, see Load Configuration Settings.

    Tip: To access other settings, click More config options. This will open the scenario editor.

  7. Click Save and run load test to run the test based on the created scenario.

Edit a scenario

  • Find your scenario on the Projects > Scenarios page and click it there:

    Edit a scenario

    Click the image to enlarge it.

    Tip: Use the search box to filter the scenario list. It allows searching for a specific character in a scenario name or for a specific date.
  • Edit scenario settings in the scenario editor as needed.

  • Save the changes.

    Save scenario

    Click the image to enlarge it.

Run a scenario

To run a load test based on a scenario, go to Projects > Scenarios, locate the needed scenario in the list and click Run on the right.

Tip: Use the search box to filter the scenario list. You can enter any part of the scenario name or date.
Run a scenario

Click the image to enlarge it.

To run a load test directly from the scenario editor, simply click Save and Run at the page’s top:

Scenario editor: Save and Run button

Click the image to enlarge it.

Delete a scenario

  1. Go to Projects and click your project in the list.

    The list of proojects

    Click the image to enlarge it.

  2. In the project editor, switch to the Scenarios tab.

  3. Find the needed scenario and select a check box on the left of it. Select the check boxes of other scenarios to be deleted.

    Tip: Use the search box to filter the scenario list.
    You can enter any part of the scenario name or of the Last Opened value.
  4. Click Delete (this button appears above the list after you select the check box).

    Project: Delete a scenario

    Click the image to enlarge it.

  5. Confirm the deletion in the subsequent message box.

See Also

UI Tests (or Scripts)
LoadNinja Documentation

Highlight search results