Description

This method is used to initialize a Scenario prior to calling the method scenarioRun(scenarioName).  This method needs to be called when controlling the run of a given Scenario within a Scenario chain.


For example, a set of Scenarios are defined within a Scenario chain called, WorkFlowScenarioChain. When the Scenario called, CheckAccount, is reached, the User Domain, amount Attribute's Generator value will be changed to 1000.00.  Note line number 14, each Scenario is initialized before any modifications can happen or the Scenario will not run successfully.


def workFlowExample() {
    // Instantiate the API
    EngineManual api = new EngineManual()

    // Load the Scenario chain
    api.scenarioLoad("WorkFlowScenarioChain")
    
    // Get the name of each scenario in the order they are to be run.
    List<String> scenarioNames = api.scenarios()

    // Traverse the list of scenario names
    scenarioNames.each { scenarioName ->
      // Initialize the Scenario
      api.initialize(scenarioName)

      // Set the User.amount to 1000.00 when CheckAccount Scenario is reached.
      if (scenarioName == 'CheckAccount') {
        api.generatorParameterSet('User.amount', 0, 'value', 1000.00.toString())
      }

      // Run the Scenario
      api.scenarioRun(scenarioName)
    }
  }


Exceptions

The following GenRocket exceptions may be thrown by this method:  

  • If no Scenarios have been loaded because loadScenario() has not be run.
  • If the Scenario defined by scenarioName is not found.


Runtime Method Signature

Use this method signature when directly accessing the GenRocket binary runtime.


public void initialize(String scenarioName)



REST/Socket Payload Request

Use this API JSON request payload when making an API call to the GenRocket REST or Socket Engine.


{
  "interfaceType": "Manual",
  "methodName": "initialize",
  "parameters": {
    "scenarioName": ""
  }
}


REST/Socket Payload Successful Payload Response

The API JSON response payload for this method will be empty.


{
  "responseType": "OK",
  "data": ""
}