Hello,
In my test case scenario I have some setup data required before actually beginning the load test.
So I have something like this
`
setUp(
setupScenario.inject(atOnceUsers(1)).protocols(HttpConfig()),
theScenario.inject(rampUsers(100) over (10 seconds)).protocols(HttpConfig()))
.assertions(
global.successfulRequests.percent.is(100))
`
However I wanted to make sure the setup is complete before the actual test scenario begins as on the server side it will not behave as expected if the setup scenario (and data) have been created.
It seems the current way this works is that both scenarios will be eligible for execution and begin executing concurrently!
So I came up with something.
`
object SetupLock {
private val setupComplete: AtomicBoolean = new AtomicBoolean(false)
/**
* Unlock the setup lock , will allow those waiting for setup to finish to proceed.
*/
def unlock(): ChainBuilder = {
exec((session: Session) => {
setupComplete.set(true)
session
})
}
/**
* Call this early in the scenario to wait until the setup lock is unlocked.
* That way when you move forward you can know that setup finished.
*/
def waitForSetup(): ChainBuilder = {
exec(asLongAs((_: Session) => !setupComplete.get()) {
pause(1 second)
})
}
}
`
So to sum up.
- Did I misread the doc, Is there an inbuilt way to make dependencies between scenarios work like I want.
- Any holes/issues you can see with my proposed solution, Did I miss something?