Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Scala 我收到错误:value exec不是io.gatling.http.request.builder.HttpRequestBuilder的成员_Scala_Netbeans 8_Gatling - Fatal编程技术网

Scala 我收到错误:value exec不是io.gatling.http.request.builder.HttpRequestBuilder的成员

Scala 我收到错误:value exec不是io.gatling.http.request.builder.HttpRequestBuilder的成员,scala,netbeans-8,gatling,Scala,Netbeans 8,Gatling,这是ser.scala的代码 val uploadTn = exec(http("Upload numbers") .post(Constants.url + Constants.tnservice + "/numbers") .headers(Constants.maplAuthorizedHeaders_multipart) .bodyPart(RawFileBodyPart("file", "BUpload.cs

这是ser.scala的代码

val uploadTn =
           exec(http("Upload numbers")
        .post(Constants.url + Constants.tnservice + "/numbers")
          .headers(Constants.maplAuthorizedHeaders_multipart)
          .bodyPart(RawFileBodyPart("file", "BUpload.csv"))
          .check(status.is(201))
            .**exec**(session => {
              println(session)
              session
            }))
在这段代码中,我得到了一个错误,因为我第二次使用了exec

simulation.scala的代码

class TNServiceSimulation extends Simulation {
    val scn = scenario("Test Auth Service ")
        .feed(randomTN)
        .exec(AuthService.getAccessToken)
        .pause(1)
        .exec(TnService.SearchTasks)
        .pause(1)
        .exec(TnService.uploadTn)
        .pause(1)
        .exec(session => {
          try {
            Class.forName(Constants.driver)
            var connection = DriverManager.getConnection(Constants.url_db, Constants.username, Constants.password)
            val statement = connection.createStatement
            val rs = statement.executeQuery("delete from TNINVENTORY.TNRPOOL where fnn=(0345678912)")
            connection.close
          } catch {
            case e: Exception => e.printStackTrace
          }
          session.set("test", "test")
        })
      setUp(
        scn.inject(atOnceUsers(Constants.numberOfUsers)).protocols(Constants.httpProtocol)
      )

该错误仅适用于ser.sala文件,simualtion文件没有错误。

必须将Execs链接在一起,否则无法执行。在这种情况下,您需要在带有复选框的行末尾添加一个

.check(status.is(201)))
                      ^