Scala 转管器中的相关性

Scala 转管器中的相关性,scala,automated-tests,performance-testing,gatling,Scala,Automated Tests,Performance Testing,Gatling,我正在使用加特林工具记录脚本。 我完成了录音部分。 但在保存脚本后,我无法关联动态值。 因为我找不到任何编码,从中我可以找到左右边界并进一步。。。。 所以请帮帮我 代码:- 你需要解释一下你所说的相关性和左右边界是什么意思。也许还可以添加一个简短的描述,说明您正在尝试做什么-我们这里所拥有的只是一个简短的web会话,看起来像是一个航班预订网站。关联是为了给动态值提供一个名称约定,就像上面的代码“我拥有UserSession”。因为当为多个用户运行此脚本时,每个用户的UserSession都会更改

我正在使用加特林工具记录脚本。 我完成了录音部分。 但在保存脚本后,我无法关联动态值。 因为我找不到任何编码,从中我可以找到左右边界并进一步。。。。 所以请帮帮我 代码:-


你需要解释一下你所说的相关性和左右边界是什么意思。也许还可以添加一个简短的描述,说明您正在尝试做什么-我们这里所拥有的只是一个简短的web会话,看起来像是一个航班预订网站。关联是为了给动态值提供一个名称约定,就像上面的代码“我拥有UserSession”。因为当为多个用户运行此脚本时,每个用户的UserSession都会更改。如果有人知道测试、scala和gatling工具,我认为这个细节就足够了。
import io.gatling.core.Predef._
import io.gatling.core.session.Expression
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
import io.gatling.http.Headers.Names._
import io.gatling.http.Headers.Values._
import scala.concurrent.duration._
import bootstrap._
import assertions._

class web_tour_2 extends Simulation {

    val httpProtocol = http
        .baseURL("http://127.0.0.1:1080")
        .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; rv:33.0) Gecko/20100101 Firefox/33.0")

    val headers_3 = Map("""Content-Type""" -> """application/x-www-form-urlencoded""")

    val scn = scenario("Scenario Name")
        //home
        .exec(http("request_1")
            .get("""/cgi-bin/welcome.pl?signOff=true"""))
        .pause(100 milliseconds)
        .exec(http("request_2")
            .get("""/cgi-bin/nav.pl?in=home"""))
        .pause(20)
        //login
        .feed(csv("login.csv"))
        .exec(http("request_3")
            .post("""/cgi-bin/login.pl""")
            .headers(headers_3)
            .param("""userSession""", """114718.724260834fQAAittpDHQVzzzHDftAfpAzzcHf""")
            .param("""username""", """${username}""")
            .param("""password""", """${password}"""))
            .param("""login.x""", """0""")
            .param("""login.y""", """0""")
            .param("""JSFormSubmit""", """off"""))
        .pause(120 milliseconds)
        .exec(http("request_4")
            .get("""/cgi-bin/nav.pl?page=menu&in=home"""))
        .pause(20 milliseconds)
        .exec(http("request_5")
            .get("""/cgi-bin/login.pl?intro=true"""))
        .pause(7)
        //flight
        .exec(http("request_6")
            .get("""/cgi-bin/welcome.pl?page=search"""))
        .pause(90 milliseconds)
        .exec(http("request_7")
            .get("""/cgi-bin/nav.pl?page=menu&in=flights"""))
        .pause(90 milliseconds)
        .exec(http("request_8")
            .get("""/cgi-bin/reservations.pl?page=welcome"""))
        .pause(17)
        //continue
        .exec(http("request_9")
            .post("""/cgi-bin/reservations.pl""")
            .headers(headers_3)
            .param("""advanceDiscount""", """0""")
            .param("""depart""", """Denver""")
            .param("""departDate""", """11/18/2014""")
            .param("""arrive""", """London""")
            .param("""returnDate""", """11/19/2014""")
            .param("""numPassengers""", """1""")
            .param("""seatPref""", """Aisle""")
            .param("""seatType""", """Business""")
            .param("""findFlights.x""", """36""")
            .param("""findFlights.y""", """16""")
            .param(""".cgifields""", """roundtrip""")
            .param(""".cgifields""", """seatType""")
            .param(""".cgifields""", """seatPref"""))
        .pause(13)
        //continue2
        .exec(http("request_10")
            .post("""/cgi-bin/reservations.pl""")
            .headers(headers_3)
            .param("""outboundFlight""", """021;437;11/18/2014""")
            .param("""numPassengers""", """1""")
            .param("""advanceDiscount""", """0""")
            .param("""seatType""", """Business""")
            .param("""seatPref""", """Aisle""")
            .param("""reserveFlights.x""", """23""")
            .param("""reserveFlights.y""", """10"""))
        .pause(13)
        //continue3
        .exec(http("request_11")
            .post("""/cgi-bin/reservations.pl""")
            .headers(headers_3)
            .param("""firstName""", """${username}""")
            .param("""lastName""", """${password}""")
            .param("""address1""", """hdfgh""")
            .param("""address2""", """5765675""")
            .param("""pass1""", """${username} ${password}""")
            .param("""creditCard""", """23gf567""")
            .param("""expDate""", """12/15""")
            .param("""saveCC""", """on""")
            .param("""oldCCOption""", """on""")
            .param("""numPassengers""", """1""")
            .param("""seatType""", """Business""")
            .param("""seatPref""", """Aisle""")
            .param("""outboundFlight""", """021;437;11/18/2014""")
            .param("""advanceDiscount""", """0""")
            .param("""returnFlight""", """""")
            .param("""JSFormSubmit""", """off""")
            .param("""buyFlights.x""", """51""")
            .param("""buyFlights.y""", """8""")
            .param(""".cgifields""", """saveCC"""))
        .pause(14)
        //logout
        .exec(http("request_12")
            .get("""/cgi-bin/welcome.pl?signOff=1"""))
        .pause(70 milliseconds)
        .exec(http("request_13")
            .get("""/cgi-bin/nav.pl?in=home"""))

    setUp(scn.inject(atOnce(1 user))).protocols(httpProtocol)
}