修改scala文件Gatling时出错

时间:2017-10-09 04:59:49

标签: web-services request gatling stress-testing

我在尝试修改scala文件时出错。

当我想插入新脚本时,原始脚本。我似乎不会在Gatling.bat中执行或只执行我正在修改的先前请求

示例我需要在Request12中插入新代码,但是当我尝试它发生在我上面提到的时,只执行0到11的请求或者只是我的scala文件没有显示在Gatling.bat中运行

还有其他人有此错误吗?

编辑:

我的代码:在此文件中,我想添加请求12

  package blablabla

 import scala.concurrent.duration._

 import io.gatling.core.Predef._
 import io.gatling.http.Predef._
 import io.gatling.jdbc.Predef._

 class SearchCustomerClientNumber2 extends Simulation {

     val httpProtocol = http
    .baseURL("http://URL")
    .inferHtmlResources()
    .acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
    .acceptEncodingHeader("gzip, deflate")
    .acceptLanguageHeader("es-CL,es;q=0.8,en-US;q=0.5,en;q=0.3")
    .userAgentHeader("Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0")

Variables to read CSV FILE
val csvFeeder = csv("Users.csv").circular // use a comma separator
val ic= feed(csvFeeder)

//当我将这些变量置于请求(请求12)之上时,只执行前11个请求,当我将它们放在此处时,它不会读取csv文件

救救我!! :C

val headers_0 = Map("Upgrade-Insecure-Requests" -> "1")

val headers_1 = Map("Accept" -> "*/*")

val headers_12 = Map(
    "Content-length" -> "1135",
    "Content-type" -> "text/xml; charset=utf-8",
    "SOAPAction" -> """""""")

val headers_13 = Map(
    "Content-length" -> "388",
    "Content-type" -> "text/xml; charset=utf-8",
    "SOAPAction" -> """""""")

val headers_17 = Map(
    "Content-length" -> "306",
    "Content-type" -> "text/xml; charset=utf-8",
    "SOAPAction" -> """""""")

val headers_19 = Map(
    "Content-length" -> "390",
    "Content-type" -> "text/xml; charset=utf-8",
    "SOAPAction" -> """""""")

val headers_21 = Map(
    "Content-length" -> "400",
    "Content-type" -> "text/xml; charset=utf-8",
    "SOAPAction" -> """""""")

val headers_23 = Map(
    "Content-length" -> "396",
    "Content-type" -> "text/xml; charset=utf-8",
    "SOAPAction" -> """""""")

val headers_29 = Map(
    "Content-length" -> "409",
    "Content-type" -> "text/xml; charset=utf-8",
    "SOAPAction" -> """""""")

val headers_30 = Map(
    "Content-length" -> "435",
    "Content-type" -> "text/xml; charset=utf-8",
    "SOAPAction" -> """""""")

val headers_32 = Map(
    "Content-length" -> "449",
    "Content-type" -> "text/xml; charset=utf-8",
    "SOAPAction" -> """""""")

val headers_34 = Map(
    "Content-length" -> "533",
    "Content-type" -> "text/xml; charset=utf-8",
    "SOAPAction" -> """""""")

val headers_35 = Map(
    "Content-length" -> "534",
    "Content-type" -> "text/xml; charset=utf-8",
    "SOAPAction" -> """""""")

val headers_42 = Map(
    "Content-length" -> "453",
    "Content-type" -> "text/xml; charset=utf-8",
    "SOAPAction" -> """""""")

val headers_44 = Map(
    "Content-length" -> "459",
    "Content-type" -> "text/xml; charset=utf-8",
    "SOAPAction" -> """""""")

val headers_45 = Map(
    "Content-length" -> "813",
    "Content-type" -> "text/xml; charset=utf-8",
    "SOAPAction" -> """""""")

val headers_46 = Map(
    "Content-length" -> "940",
    "Content-type" -> "text/xml; charset=utf-8",
    "SOAPAction" -> """""""")

val headers_54 = Map(
    "Content-length" -> "376",
    "Content-type" -> "text/xml; charset=utf-8",
    "SOAPAction" -> """""""")

val uri1 = "URL/b0001b/"




val scn = scenario("SearchCustomerClientNumber2")


    .exec(http("request_0")
        .get("/bei010Web/")
        .headers(headers_0)
        .resources(http("request_1")
        .get("/bei010Web/images/logo.jpg")
        .headers(headers_1),
        http("request_2")
        .get("/bei010Web/images/***.jpg")
        .headers(headers_1),
        http("request_3")
        .get("/bei010Web/images/flagES.png")
        .headers(headers_1),
        http("request_4")
        .get("/bei010Web/images/****.jpg")
        .headers(headers_1),
        http("request_5")
        .get("/bei010Web/images/****.jpg")
        .headers(headers_1),
        http("request_6")
        .get("/bei010Web/images/flagUSA.png")
        .headers(headers_1),
        http("request_7")
        .get("/bei010Web/images/*****.jpg")
        .headers(headers_1),
        http("request_8")
        .get("/bei010Web/images/***.jpg")
        .headers(headers_1)))
    .pause(1)
    .exec(http("request_9")
        .get("/bei010Web/bei010/sp_MX/bei10.jsp")
        .headers(headers_0))
    .pause(1)
    .exec(http("request_10")
        .get("/bei010Web/WEBSERVICE?WSDL")
        .resources(http("request_11")
        .get("/bei010Web/WEBSERVICE?WSDL")))
    .pause(4)


          //before:

         .exec(http("request_12")
        .post("/bei010Web/webservicesecurity")
        .headers(headers_12)
        .body(RawFileBody("SearchAccountNumberxxx_0012_request.txt"))
           //This code i want to add:
         // I want:                    
        .exec(http("request_12")
        .post("/bei010Web/WEBSERVICESECURITY")
        .headers(headers_12)
         .body(StringBody("""<SOAP-ENV:Envelope xmlns:SOAP-
       ENV="http://schemas.xmlsoap.org/soap/envelope/" 
      xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <SOAP-ENV:Body>
    <tns:authenticateUserxmlns:tns="http://******.com/">
        <login>${Username}</login>
         <password>${pass}</password>
           <program>1</program>
     </tns:authenticateUser>
     </SOAP-ENV:Body>
   </SOAP-ENV:Envelope>"""))








        .resources(http("request_13")
        .post("/bei010Web/WEBSERVICE")
        .headers(headers_13)
        .body(RawFileBody("SearchCustomerClientNumber2_0013_request.txt")),
        http("request_14")
        .get("/bei010Web/WEBSERVICE?WSDL"),
        http("request_15")
        .get("/bei010Web/WEBSERVICE?WSDL"),
        http("request_16")
        .get("/bei010Web/DWEBSERVICE?WSDL"),
        http("request_17")
        .post("/bei010Web/WEBSERVICE")
        .headers(headers_17)
        .body(RawFileBody("SearchCustomerClientNumber2_0017_request.txt")),
        http("request_18")
        .get("/bei010Web/WEBSERVICE?WSDL"),
        http("request_19")
        .post("/bei010Web/DelinquentServiceService")
        .headers(headers_19)
        .body(RawFileBody("SearchCustomerClientNumber2_0019_request.txt")),
        http("request_20")
        .get("/bei010Web/WEBSERVICE?WSDL"),
        http("request_21")
        .post("/bei010Web/WEBSERVICE")
        .headers(headers_21)
        .body(RawFileBody("SearchCustomerClientNumber2_0021_request.txt")),
        http("request_22")
        .post("/bei010Web/WEBSERVICE")
        .headers(headers_13)
        .body(RawFileBody("SearchCustomerClientNumber2_0022_request.txt")),
        http("request_23")
        .post("/bei010Web/WEBSERVICE")
        .headers(headers_23)
        .body(RawFileBody("SearchCustomerClientNumber2_0023_request.txt"))))



       This code is in another file:
       .exec(http("request_12")
        .post("/bei010Web/WEBSERVICESECURITY")
        .headers(headers_12)
         .body(StringBody("""<SOAP-ENV:Envelope xmlns:SOAP-
       ENV="http://schemas.xmlsoap.org/soap/envelope/" 
       xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <SOAP-ENV:Body>
     <tns:authenticateUserxmlns:tns="http://******.com/">
      <login>${Username}</login>
      <password>${pass}</password>
      <program>1</program>
     </tns:authenticateUser>
     </SOAP-ENV:Body>
     </SOAP-ENV:Envelope>"""))

**我更改了一些名字,但除了我想要添加的内容之外,它还在工作

请帮帮我。

此致

0 个答案:

没有答案