Here is what I NEED to do:
.feed(\"users.csv\") // includes username, password, groupid
// login...
.duration(x) {
feed( csv(\"${groupid}.csv\")
Thanks to Stephane for the information, on which the final solution was built.
Here is what I did that works for 1.5.5:
object Data {
var groupList : List[Int] = List( ... ) // long list of IDs
def branchByGroup ( path: String ) : ChainBuilder = {
var c = bootstrap
groupList.foreach( x => {
c = c.doIf( "${groupId}", x.toString() ) {
feed( csv( path + "/" + x.toString() + ".csv" ).random )
}
})
return c
}
def searchCriteria () : ChainBuilder = branchByGroup( "search" )
def other() : ChainBuilder = branchByGroup( "other" )
}
Then, inside my scenario, I call it, like so:
def scn = scenario("My Scenario")
.feed( credentialSource )
.exec( Login.steps )
.during( loopTime ) {
Data.searchCriteria()
.exec( Search.steps )
The call to Data.searchCriteria
is injecting the .doIf() calls into the chain. If it was not the first thing in the block, I would have had to wrap it in .exec()
of course.
As a side-note, there was a gotcha that I had to figure out. Notice the part that says c = c.doIf
- the function needs to return the END of the chain, as opposed to the beginning. You can't build a chain by attaching everything to the first link in the chain! Simulating what the DSL does requires this call-and-assign approach.
Hope this helps someone other than just me. :)