Overview 

Depending on how parameters are set on a Genrocket Generator, each time a GenRocket Scenario is run, that Generator will produce that identical test data each time. For example, if a User Domain, containing an Id Attribute, using a RangeGen Generator whose startRange parameter is set to 10000, then each time a Scenario containing the User Domain is run, it will start generating the Id at 10000.


Generating the same test data each time a Scenario is run is the most common way test data is generated. However, there are times when it is desirable to have the test data continue increasing its values each time a given Scenario is run. For example, the first time a  given Scenario is run to generate 100 users, its User Domain will start generating user.Ids at 10000. However, the second time the same Scenario is run, it should begin to generating user.Ids 10100. If when the second time the Scenario is run, it generates 500 users, then if the Scenario is run a third time, it should start generating user.Ids at 10600.   


Getting a Scenario to perform this way is done by saving the Scenario's state at the end of each successful run. If the run is not completed successfully, the state will not be saved. Thus, a Scenario can be in either one of two states:

  • stateful - The Scenario will maintain the state of all Domain Attribute Generators after each run and initialize all Domain Attribute Generators to their saved state on the next Scenario is run.

  • stateless - The Scenario will not maintain the state of any Domain Attribute Generate after each run and initialize all Domain Attribute Generators to the default parameters on the next Scenario run.

In This Article


Making a Scenario Stateful

To make Scenario Stateful, on the Scenario form, simply click the Make Stateful button. 



Making a Scenario Stateless

By default, all Scenarios are initially Stateless. However, if the Scenario is made Stateful, it can be changed back to being Stateless. To change a Stateful Scenario back to being Stateless, simply click the Make Stateless button.



How It Works

When a Scenario is Stateful, GenRocket creates a small H2 database in the .genrocket subdirectory on the given computer where the Scenario is running; this is where Scenario state information is stored, in the local H2 database. The following activity diagram describes the logical steps that the GenRocket engine follows when running a Scenario and determining what actions to take when a Scenario is Stateful or Stateless.



Command Line Options

There are currently two command line options that will clear Scenarios states from the local H2 database and list the Scenarios that are currently holding state with the local H2 database.

  • --state-clear - clears stored Scenario state information.
  • --state-list - displays Scenario state information to the command line console.


--state-clear

The following command line options instruct the GenRocket Runtime to clear stored Scenario state information. 


Command

-sc <stateClear>
--state-clear <stateClear>


Required Parameters

  • <stateClear>- defines whose state should be cleared. There are two options:
    • id - the identification number of the Scenario whose state will be removed
    • all - remove the state of all Scenarios


--state-list

The following command line options instruct the GenRocket Runtime to echo Scenario state information to the command line console.   


Command

-sl
--state-list


Example Output

The output below shows two Scenarios that are currently Stateful and having their Generator's parameter values saved after each successful Scenario run. Each Scenario is given a unique Id so it can be cleared via it's Id.


: genrocket -sl
GenRocket Runtime Version: 3.5.14
GenRocket Version: 3.5.14
GenRocket Engine Version: 3.5.14.3
GenRocket Generator Runtime Version: 3.5.14.2
GenRocket Receiver Runtime Version: 3.5.14.1


+--------+--------------------+----------------------+----------------+--------------------+------------------+----------------------------+
|   id   |  Scenario Version  |  Organization Name   |  Project Name  |  Project Version   |  Scenario Name   |        Last Updated        |
+--------+--------------------+----------------------+----------------+--------------------+------------------+----------------------------+
|  1774  |         2          |      GenRocket       |    LiveDemo    |        1.0         |   TestScenario   |  2017-04-10 09:52:22.133   |
|  3239  |         6          |      GenRocket       |  GenRocketBank |        1.0         |   UserScenario   |  2018-01-12 13:57:51.409   |
+--------+--------------------+----------------------+----------------+--------------------+------------------+----------------------------+