how to repeat a scenario

I created a scenario that I need to repeat several iterations, I tried using .repeat(5), but I keep on getting error message

Error message
11:42:34,365 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@33ae93c5 - Registering current configuration as sa
fe fallback point
Exception in thread “main” Compilation failed
at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:76)
at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:35)
at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:29)
at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileScala$1$1.apply$mcV$sp(AggressiveCompile.scala:71)
at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:71)
at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:71)

My Code:

.repeat(2){

val scn = scenario(“NMLSubmitMonthlyMiles”)

.feed(BiotronikUserCredentials)

.repeat(2)
.exec(http(“Landing Page”)
.get(“https://zsousa-vm.crsinc.local/”)

.pause(15)

.exec(http(“login User”)
.post(“https://zsousa-vm.crsinc.local/system/login.php”)
.headers(headers_2)
.param(""“username”"", “”"${username}""")
.param(""“password”"", “”"${password}""")
.param(""“ajaxLogin”"", “”“1"”")
)
.pause(530 milliseconds)

}

setUp(scn.users(1).ramp(60).protocolConfig(httpConf))

}

What is this outer .repeat(2) doing here?
repeat is a method on chains and scenarios.

sorry, ignore the outer repeat

val scn = scenario(“NMLSubmitMonthlyMiles”)

.feed(BiotronikUserCredentials)

.repeat(2) { // add missing curly brace
exec(http(“Landing Page”) // remove wrong leading point
.get(“https://zsousa-vm.crsinc.local/”)
) // add missing bracket
.pause(15)

.exec(http(“login User”)
.post(“https://zsousa-vm.crsinc.local/system/login.php”)
.headers(headers_2)
.param(""“username”"", “”"${username}""")
.param(""“password”"", “”"${password}""")
.param(""“ajaxLogin”"", “”“1"”")
)
.pause(530 milliseconds)

}

setUp(scn.users(1).ramp(60).protocolConfig(httpConf))

didnt work.

I am including the entire program
package BMLSubmitMilesClearMiles
import com.excilys.ebi.gatling.core.Predef._
import com.excilys.ebi.gatling.http.Predef._
import com.excilys.ebi.gatling.jdbc.Predef._
import com.excilys.ebi.gatling.http.Headers.Names._
import akka.util.duration._
import bootstrap._
import assertions._

class NMLSubmitMiles extends Simulation {

val httpConf = httpConfig
.baseURL(“https://zsousa-vm:443”)
.acceptHeader(“text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8”)
.acceptEncodingHeader(“gzip, deflate”)
.acceptLanguageHeader(“en-US,en;q=0.5”)
.connection(“keep-alive”)
.userAgentHeader(“Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20100101 Firefox/21.0”)

val headers_2 = Map(
“Cache-Control” → “”“no-cache”"",
“Content-Type” → “”“application/x-www-form-urlencoded; charset=UTF-8"”",
“Pragma” → “”“no-cache”"",
“X-Requested-With” → “”“XMLHttpRequest”""
)

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

val headers_11 = Map(
“X-Requested-With” → “”“XMLHttpRequest”""
)

val headers_17 = Map(
“Accept” → “”“text/javascript, text/html, application/xml, text/xml, /”"",
“Cache-Control” → “”“no-cache”"",
“Content-Type” → “”“application/x-www-form-urlencoded; charset=UTF-8"”",
“Pragma” → “”“no-cache”"",
“X-Prototype-Version” → “”“1.6.0.3"”",
“X-Requested-With” → “”“XMLHttpRequest”""
)

val BiotronikUserCredentials = csv(“biotronik_user_data.csv”).queue

val scn = scenario(“NMLSubmitMonthlyMiles”)

.feed(BiotronikUserCredentials)
.repeat(2) {

.exec(http(“Landing Page”)
.get(“https://zsousa-vm”)
)
.pause(15)

.exec(http(“login User”)
.post(“https://zsousa-vm.crsinc.local/system/login.php”)
.headers(headers_2)
.param(""“username”"", “”"${username}""")
.param(""“password”"", “”"${password}""")
.param(""“ajaxLogin”"", “”“1"”")
)
.pause(530 milliseconds)
}
.exec(http(“Mileage Entry Page”)
.get(“https://zsousa-vm.crsinc.local/system/enterMileage.php”)
.check(currentLocation.is(“https://zsousa-vm.crsinc.local/system/enterMileage.php”))
)

.exec(http(“Submit Miles and Odometer Reading”)
.post(“https://zsousa-vm.crsinc.local/system/enterMileage.php”)
.headers(headers_4)
.param(""“miles”"", “”"${miles}""")
.param(""“month”"", “”“201305"”")
.param(""“odometer_reading”"", “”“333333"”")
.param(""“save_current”"", “”“Submit May 2013 business miles”"")
.param(""“last_daily_odometer”"", “”"""")
)
.pause(3)
.exec(http(“Confirm Submission”)
.post(“https://zsousa-vm.crsinc.local/system/enterMileage.php”)
.headers(headers_4)
.param(""“month”"", “”“201305"”")
.param(""“confirm_current”"", “”“1"”")
)
.pause(4)
.exec(http(“logout user”)
.get(“https://zsousa-vm.crsinc.local/system/logout.php”)
)
.pause(6)
.exec(http(“login CRS Admin”)
.post(“https://zsousa-vm.crsinc.local/system/login.php”)
.headers(headers_2)
.param(""“username”"", “”“zsousa”"")
.param(""“password”"", “”“1"”")
.param(""“ajaxLogin”"", “”“1"”")
)

.pause(10)
.exec(http(“Go to Driver”)
.post(“https://zsousa-vm.crsinc.local/system/driverSearch.php”)
.headers(headers_4)
.param(""“username”"", “”"${username}""")
.param(""“x”"", “”“40"”")
.param(""“y”"", “”“5"”")
)
.pause(2)

.exec(http(“viewMileageHistory”)
.post(“https://zsousa-vm.crsinc.local/system/groupadmin/viewMileageHistory.php”)
.headers(headers_4)
.queryParam(""“id”"", “”"${driverid}""")
.queryParam(""“modify_mileage_entry”"", “”"${monthlymileageid}""")
.param(""“miles”"", “”"${miles}""")
.param(""“odometer”"", “”“333333"”")
.param(""“entered_timestamp”"", “”“2013-05-22 08:50AM”"")
.param(""“id”"", “”"${driverid}""")
.param(""“modify_mileage_entry”"", “”"${monthlymileageid}""")
.param(""“clear”"", “”“Clear”"")
.param(""“change_explain”"", “”"""")
)
.pause(2)
.exec(http(“Confirm clear mileage”)
.post(“https://zsousa-vm.crsinc.local/system/groupadmin/viewMileageHistory.php”)
.headers(headers_4)
.queryParam(""“id”"", “”"${driverid}""")
.queryParam(""“modify_mileage_entry”"", “”"${monthlymileageid}""")
.param(""“confirm_clear”"", “”“Submit”"")
)
.pause(5)
.exec(http(“CRS Admin logout.php”)
.get(“https://zsousa-vm.crsinc.local/system/logout.php”)
)

setUp(scn.users(1).ramp(60).protocolConfig(httpConf))

}

Didn’t work because you didn’t remove this wrong leading dot on “Landing Page” as instructed.

worked. one more question. If I wanted to repeat the entire scenario would I remove the dot from every single “.exec”?

What do you mean? Repeat the sequence, or repeat every step of the scenario?

repeat the step of every scenario

You’ll have to add a repeat on each action.

If a repeat is added to each action can you advise how they are expected. For example will action 1 be repeated twice then Action 2?

Gatling DSL is a programming language. It will do what you tell it to do. So the answer to your question is, it depends on how you code it. And you know, you can always code things up and run them to see what they do.