Scala 加特林-在收割台内未识别会话EL
我试图分离这个链,并将其保存在一个可重用的变量中Scala 加特林-在收割台内未识别会话EL,scala,chain,gatling,Scala,Chain,Gatling,我试图分离这个链,并将其保存在一个可重用的变量中 package computerdatabase import io.gatling.core.Predef._ import io.gatling.http.Predef._ import scala.concurrent.duration._ import io.gatling.jsonpath._ class Test1 extends Simulation { //Global Users val userMap = sca
package computerdatabase
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._
import io.gatling.jsonpath._
class Test1 extends Simulation {
//Global Users
val userMap = scala.collection.concurrent.TrieMap[String, String]()
//Randomiser
val rnd = new scala.util.Random
val httpConf = http
.baseURL("http://demo1263864.mockable.io/") // Here is the root for all relative URLs
.acceptHeader("application/json") // Here are the common headers
.doNotTrackHeader("1")
.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")
val headers_1 = scala.collection.mutable.Map("Content-Type" -> "application/json")
val chain1 = exec(
http("chain request ")
.post("gatling1")
.headers((headers_1 += "pList" -> "${pList}").toMap)
.body(StringBody("""{"${pList}"}"""))
.check(status.is(404)))
val scn = scenario("Simple request")
.exec(
http("If request ")
.get("gatling1")
.headers(headers_1.toMap)
.check(jsonPath("$.result").is("SUCCESS"),
jsonPath("$.data[*]").ofType[Map[String, Any]].findAll.saveAs("pList")))
.exec(chain1)
setUp(scn.inject(atOnceUsers(1)).protocols(httpConf))
}
这可以很好地编译,但在运行时会出现以下错误
16:35:25.156[信息]i.g.h.c.HttpProtocol-启动预热
16:35:25.681[信息]i.g.h.c.HttpProtocol-预热完成
16:35:25.731[错误]i.g.h.a.HttpRequestAction-未命名属性
定义了“pList”
16:35:25.732[错误]i.g.h.a.HttpRequestAction-未命名属性
定义了“pList”
它没有给出任何行号,但我确信下面这行有问题
.headers((headers_1 += "pList" -> "${pList}").toMap)
当我在exec中使用chain1内联时,它工作得很好
来自Gatling用户组