Dynamically Choose Feeder Method

I am looking to dynamically choose the feeder method based on a default/system variable so I can create load/stress tests versus a repeatable baseline style test.

val feederMethod = System.getProperty(“feeder.method”,“circular”)

val feeder= RecordSeqFeederBuilder[String]
if(feederMethod==“circular”) {
feeder = csv(tmpDir + “/AddUniqueMemberFeeder-” + tmpKey + “.csv”).circular
feeder = csv(tmpDir + “/AddUniqueMemberFeeder-” + tmpKey + “.csv”).random

However it reports that csv(…) doesn’t conform to the expected type

"Expression of type REcordSeqFeederBuilder[String] doesn’t conform to expected type (indexedSeq[feeder.Record[String]], FeederStrategy) => RecordSeqFeederBuilder[String]

Is there a better way to achieve what I am looking for?

Please double check Scala’s syntax, this is your problem here :slight_smile:

val feeder= RecordSeqFeederBuilder[String]

= is use for assignation. : is used for declaring type.

Incredibly sorry - I wasn’t thinking straight last night and this morning realized my error. Thanks again.


var feeder: RecordSeqFeederBuilder[String] = csv(…).random //default feeder
feeder = csv(…).circular

You shouldn’t be using a var but a val. In Scala, if blocks return something:

val feeder: RecordSeqFeederBuilder[String] =
} else {

csv(…).random //default feeder