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 start 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.

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 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 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 the 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.