pass .param(b(0),b(1)) values iteratively

hi Stephane,

i want to pass .param(b(0),b(1)) values iteratively

val httpProtocol = http
.baseURL(“url”)

.disableFollowRedirect

.acceptHeader(“text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8”)
.doNotTrackHeader(“1”)
.acceptLanguageHeader(“en-US,en;q=0.5”)
.userAgentHeader(“Mozilla/5.0 (Windows NT 6.1; rv:32.0) Gecko/20100101 Firefox/32.0”)
.acceptLanguageHeader(“en-US,en;q=0.5”)
.acceptEncodingHeader(“gzip, deflate”)
.userAgentHeader(“Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0”)
.connection(“keep-alive”)

val header = Map(“Content-Type” → “application/x-www-form-urlencoded”)

var i=0
var j=0
val prop = new Properties()
val writer = {
val fos = new java.io.FileOutputStream(“D:/test-data.properties”)
new java.io.PrintWriter(fos,true)
}
val writer1 = {
val fos = new java.io.FileOutputStream(“D:/test-data.csv”)
new java.io.PrintWriter(fos,true)
}
writer1.println(“key,value”)

try {

val file1 = new FileInputStream(“D:\Config.properties”)
prop.load(file1);
}
catch {
case ex: IOException => Logger.getLogger(classOf[RecordedSimulation123].getName).log(Level.SEVERE, null, ex)
}

val list = prop.propertyNames()

try {
while (list.hasMoreElements()) {

val key = list.nextElement().asInstanceOf[String]
val s=prop.get(key).toString()
val a:Array[String]=s.split("&")
writer.println(a(0)+"\t\t"+a(1)+"\n\n\n")
j=a.length

while( i != a.length)
{

val b:Array[String]=a(i).split("\^")

writer1.println(b(0)+","+b(1))

i+=1
}

val productIems = csv(“D:/test-data.csv”).queue
val scn = scenario(“scenario param”)

.exec(http(“GET web service”)
.headers(header)
.post(key)
.repeat(b.length){
.param(b(0), b(1))
}
)

setUp(scn.inject(atOnce(1 user))).protocols(httpProtocol)

}
}

catch {
case e: Exception =>e.printStackTrace()
} finally {

}

}our suggetions are most useful to me
thanks in advance

What exactly are you trying to do? Pull data from a configuration file and pass the data as form params?

.repeat does not work on an http() object, it is at the level of .exec(). What you really want is to load the config into a map and use .formParamMap().

And if you haven’t already, you might want to upgrade to 2.0.1 :slight_smile: