@Prepare and @CleanUp annotations are to be used on static methods.
Rationale
Prepare and CleanUp methods are executed for every user and user session respectively, before simulations are run by the framework. The instance on which the reflection methods are executed, created and initialised every time scenarios are executed so the isolation level between scenario executions / or a set of scenario executions if multiple scenarios defined, is to be brought to its highest degree. However, the prepare and clean up methods are run only once before the simulation is started, while the object instance is not fully initialised, so prepare and cleanup methods can not be bound to object's state which is used by scenario execution:
prepare run (static scope)
while (simulation is active):
create object state o1
initialize state on o1
run scenario1 on o1
run scenario2 on o1
reset state on o1
cleanup run (static scope)
@Prepare
and@CleanUp
annotations are to be used on static methods.Rationale Prepare and CleanUp methods are executed for every user and user session respectively, before simulations are run by the framework. The instance on which the reflection methods are executed, created and initialised every time scenarios are executed so the isolation level between scenario executions / or a set of scenario executions if multiple scenarios defined, is to be brought to its highest degree. However, the prepare and clean up methods are run only once before the simulation is started, while the object instance is not fully initialised, so prepare and cleanup methods can not be bound to object's state which is used by scenario execution: