Different protocol within same scenario and access currently selected domain

Hi I have two questions:

  1. I have a scenario for which need to alter between different protocols: http and https. It looks like below:

scenarioWithPostalCode(“ATL Scenario”)

.exec(http("/summary") <===== Using http



.exec(http("/sign-in") <===== Using https



Currently I am having to insert the protocol with domain and not use scenario.inject(…).protocols(httpConf). Is there a better way to support both http and https within the same domain?

  1. Second of all, for one kind of service, I am alternating between few urls using http.baseURLs(…,…,…) method. At run time, randomly a url is selected. Is there a way to access currently selected domain? HttpProtocolBuilder doesn’t seem to have any sufficient method.


Use Scala String interpolation.

val domain = “domain.com

scenarioWithPostalCode(“ATL Scenario”)





More tricky.

You could write a function, such as:

def url(scheme: String, path: String): Expression[String] =

(session: Session) => {

val domain = ThreadLocalRandom.current.nextInt(3) match {

case 0 => “domain0”

case 1 => “domain1”

case 2 => “domain2”