1
的成員,這是ser.scala的代碼我得到錯誤:值EXEC不是io.gatling.http.request.builder.HttpRequestBuilder
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文件沒有錯誤。