[Java] Dynamically setup scenario for simulation

Hello,

I would like to know if one thing is possible to implement. I have two classes with simulations e.g.
LoadTest and CapacityTest.

At both classes I don’t have any implementation of Scenario. Scenarios implementations are stored at different classes as a Static ScenarioBuilder objects. Those Objects can be used at Simulations classes and know I’m not sure if it is possible.

I want to start my tests using mvn CLI. I know that I can provide a Simulation class which should be triggered but how to configure scenario for it?

I think it can be done via some additional configuration file and for example additional script which can according to input prepare data at configuration file and after that trigger test using mvn CLI

Do you know any other solution for this case?

Hi MSlaski,

I’m not sure to understand the question.

Scenario defines the journey of a single user. (say AdminScenario, LurkerScenario, CustomerScenario, etc.)
Simulation defines the actual test, ie. how many users are injected for each scenario.

So, it makes sense to launch one Simulation class, but there is no meaning to launch a Scenario from the CLI.

Perhaps you want to multiply your simulation definitions and give them more meaningful names?

  • HeavyPeakOfCustomerSimulation (with lots of customers and some lurkers)
  • CapacitySimulation with a constant ratio of Admins, Lurkers and Customers but the total amount increasing too reach the breaking point.
  • MemoryTest with small amount of each kind but during a very long time.

etc.

Note that the injection profiles (arguments of setUp method in your Simulation) can reference variables that you loads or compute from environment variables or Java System Properties.

Does that helps?

Cheers!

I will try to clarify

I have two scenarios: two different user journeys
And I want to use them at two different test types: capacity and load.
Differences between load and capacity are the way how injection will be implemented

And now I want to start one of simulation from CLI (load or test) and somehow inject particular scenario (first user journey or second user journey). Scenarios will be not triggered together

So, you should create 4 different simulations:

  • User1CapacitySimulation => a simulation that will inject scn1 for capacity test
  • User2CapacitySimulation
  • User1LoadSimulation
  • User2LoadSimulation

As you will have 4 different classes, you will be able to launch each one separately.

Cheers!

Thank you very much!