当前位置: 首页 > 知识库问答 >
问题:

加特林重复动作

胡新
2023-03-14

我有一个加特林记录,现在我想重复这个场景10次,但我遇到了一些问题,我的重复动作只在第一步启动,不会完成场景的整个步骤。我能知道有什么问题吗?我是否需要在每一步中添加重复(10){}?下面是我的scala代码。

class Portal_Selfcare_TelephoneLine_Test1 extends Simulation {

    val httpConf = httpConfig
            .baseURL("http://10.14.24.29:7281")
            .acceptHeader("text/html, application/xhtml+xml, */*")
            .acceptEncodingHeader("gzip, deflate")
            .acceptLanguageHeader("en-US")
            .userAgentHeader("Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; managedpc)")


    val headers_1 = Map(
            "Accept-Encoding" -> """gzip, deflate, peerdist""",
            "X-P2P-PeerDist" -> """Version=1.0"""
    )

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


    val scn = scenario("New_Install_TelLine")
        .repeat(10)
        {
          exec(http("Browse_URL")
                    .get("/iCarePrimePortal/selfcare.portal")
                    .headers(headers_1)
                    .queryParam("""_nfls""", """false""")
                    .queryParam("""_nfpb""", """true""")
                    .queryParam("""_pageLabel""", """selfcare_cus_bk""")
            )
         .pause(3)
         .exec(http("Click_ServiceRegistration")
                    .get("/iCarePrimePortal/selfcare.portal")
                    .headers(headers_1)
                    .queryParam("""_nfls""", """false""")
                    .queryParam("""_nfpb""", """true""")
                    .queryParam("""_pageLabel""", """selfcare_consumer_serviceregistration""")
            )
        .pause(2)
        .exec(http("SelectProduct_TelLine")
                    .post("/iCarePrimePortal/selfcare.portal")
                    .headers(headers_3)
                    .queryParam("""_windowLabel""", """s_con_registration_preorder""")
                    .queryParam("""s_con_registration_preorder_actionOverride""", """/portlets/ordercapture/preorder/begin""")
                    .queryParam("""_nfpb""", """true""")
                        .param("""s_con_registration_preorder{pageFlow.userCategory}""", """Customer""")
                        .param("""s_con_registration_preorderwlw-select_key:{pageFlow.product}OldValue""", """true""")
                        .param("""s_con_registration_preorderwlw-select_key:{pageFlow.product}""", """Telephony - Home Line""")
                        .param("""s_con_registration_preorderwlw-select_key:{actionForm.quantityBField}OldValue""", """true""")
                        .param("""s_con_registration_preorderwlw-select_key:{actionForm.quantityBField}""", """1""")
                        .param("""s_con_registration_preorderwlw-select_key:{actionForm.quantityRField}OldValue""", """true""")
                        .param("""s_con_registration_preorderwlw-select_key:{actionForm.quantityRField}""", """1""")
                        .param("""s_con_registration_preorderwlw-select_key:{actionForm.quantityB3Field}OldValue""", """true""")
                        .param("""s_con_registration_preorderwlw-select_key:{actionForm.quantityR3Field}OldValue""", """true""")
                        .param("""s_con_registration_preorderactionOverride:productCheck""", """Next""")
            )
        .pause(8)
        .exec(http("Fill_CustomerDetails")
                    .post("/iCarePrimePortal/selfcare.portal")
                    .headers(headers_3)
                    .queryParam("""_windowLabel""", """s_con_registration_preorder""")
                    .queryParam("""s_con_registration_preorder_actionOverride""", """/portlets/ordercapture/preorder/planCheck""")
                    .queryParam("""_nfpb""", """true""")
                        .param("""s_con_registration_preorderwlw-select_key:{actionForm.customerCategory}OldValue""", """true""")
                        .param("""s_con_registration_preorderwlw-select_key:{actionForm.customerCategory}""", """Personal""")
                        .param("""s_con_registration_preorderwlw-select_key:{actionForm.planName}OldValue""", """true""")
                        .param("""s_con_registration_preorderwlw-select_key:{actionForm.planName}""", """No Call Plan""")
                        .param("""s_con_registration_preorderwlw-select_key:{actionForm.identityIdPrefix}OldValue""", """true""")
                        .param("""s_con_registration_preorderwlw-select_key:{actionForm.identityIdPrefix}""", """New NRIC""")
                        .param("""s_con_registration_preorder{actionForm.identityID}""", """870609-10-8907""")
                        .param("""s_con_registration_preorder{actionForm.identityIDP}""", """""")
                        .param("""s_con_registration_preorder{actionForm.identityIDPo}""", """""")
                        .param("""s_con_registration_preorder{actionForm.identityIDM}""", """""")
                        .param("""s_con_registration_preorder{actionForm.oldNric}""", """""")
                        .param("""s_con_registration_preorder{actionForm.customerName}""", """""")
                        .param("""s_con_registration_preorderactionOverride:preServiceCheck""", """Submit""")
            )
        .pause(1)
        .exec(http("Choose_State")
                    .post("/iCarePrimePortal/selfcare.portal")
                    .headers(headers_3)
                    .queryParam("""_windowLabel""", """s_con_registration_preorder""")
                    .queryParam("""s_con_registration_preorder_actionOverride""", """/portlets/nisAddressSearch/changeState""")
                    .queryParam("""_nfpb""", """true""")
                        .param("""s_con_registration_preorder{actionForm.selectedState}""", """SELANGOR""")
                        .param("""s_con_registration_preorderactionOverride:changeState""", """SELANGOR""")
            )
        .pause(9)
        .exec(http("Search_Address")
                    .post("/iCarePrimePortal/selfcare.portal")
                    .headers(headers_3)
                    .queryParam("""_windowLabel""", """s_con_registration_preorder""")
                    .queryParam("""s_con_registration_preorder_actionOverride""", """/portlets/nisAddressSearch/searchAddressByStreet""")
                    .queryParam("""_nfpb""", """true""")
                        .param("""s_con_registration_preorder{actionForm.selectedState}""", """SELANGOR""")
                        .param("""s_con_registration_preorderwlw-select_key:{actionForm.streetType}OldValue""", """true""")
                        .param("""s_con_registration_preorderwlw-select_key:{actionForm.streetType}""", """JALAN""")
                        .param("""s_con_registration_preorder{actionForm.streetName}""", """bunga""")
            )
        .pause(4)
        .exec(http("Select_Address")
                    .get("/iCarePrimePortal/selfcare.portal")
                    .headers(headers_1)
                    .queryParam("""_windowLabel""", """s_con_registration_preorder""")
                    .queryParam("""s_con_registration_preorderaddressId""", """12""")
                    .queryParam("""s_con_registration_preorder_actionOverride""", """/portlets/nisAddressSearch/selectAddress""")
                    .queryParam("""_nfpb""", """true""")
            )
        .pause(4)
        .exec(http("Proceed_ServiceCheck")
                    .post("/iCarePrimePortal/selfcare.portal")
                    .headers(headers_3)
                    .queryParam("""_windowLabel""", """s_con_registration_preorder""")
                    .queryParam("""s_con_registration_preorder_actionOverride""", """/portlets/nisAddressSearch/proceedWithServiceCheck""")
                    .queryParam("""_nfpb""", """true""")
                        .param("""s_con_registration_preorderactionOverride:proceedWithServiceCheck""", """Next""")
            )
        .pause(1)
        .exec(http("Show_Result")
                    .post("/iCarePrimePortal/selfcare.portal")
                    .headers(headers_3)
                    .queryParam("""_windowLabel""", """s_con_registration_preorder""")
                    .queryParam("""s_con_registration_preorder_actionOverride""", """/portlets/ordercapture/preorder/showResult""")
                    .queryParam("""_nfpb""", """true""")
                        .param("""s_con_registration_preorderactionOverride:goToTandCs""", """Proceed to Order""")
            )
        .pause(3)
        .exec(http("Proceed_Order")
                    .post("/iCarePrimePortal/selfcare.portal")
                    .headers(headers_3)
                    .queryParam("""_windowLabel""", """s_con_registration_preorder""")
                    .queryParam("""s_con_registration_preorder_actionOverride""", """/portlets/ordercapture/preorder/goToOC""")
                    .queryParam("""_nfpb""", """true""")
                        .param("""s_con_registration_preorderwlw-checkbox_key:{pageFlow.acceptTandCs}OldValue""", """false""")
                        .param("""s_con_registration_preorderwlw-checkbox_key:{pageFlow.acceptTandCs}""", """on""")
                        .param("""s_con_registration_preorderactionOverride:goToOC""", """Next""")
            )
        .pause(2)
        .exec(http("Pick_Number")
                    .post("/iCarePrimePortal/selfcare.portal")
                    .headers(headers_3)
                    .queryParam("""_windowLabel""", """s_con_registration_preorder""")
                    .queryParam("""s_con_registration_preorder_actionOverride""", """/portlets/ordercapture/verifyPickNumber""")
                    .queryParam("""_nfpb""", """true""")
                        .param("""s_con_registration_preorderwlw-checkbox_group_key:{actionForm.selectedServiceNumbers}""", """00390192953""")
                        .param("""s_con_registration_preorderwlw-checkbox_group_key:{actionForm.selectedServiceNumbers}OldValue""", """true""")
                        .param("""s_con_registration_preorderactionOverride:verifyPickNumber""", """Next""")
            )
        .pause(32)
        .exec(http("Fill_CustomerInfo")
                    .post("/iCarePrimePortal/selfcare.portal")
                    .headers(headers_3)
                    .queryParam("""_windowLabel""", """s_con_registration_preorder""")
                    .queryParam("""s_con_registration_preorder_actionOverride""", """/portlets/ordercapture/verifyOrderDetails""")
                    .queryParam("""_nfpb""", """true""")
                        .param("""s_con_registration_preorder{actionForm.fullName}""", """ROTAN""")
                        .param("""s_con_registration_preorder{actionForm.identityIdPrefix}""", """New NRIC""")
                        .param("""s_con_registration_preorder{actionForm.identityId}""", """870609-10-8907""")
                        .param("""s_con_registration_preorder{actionForm.countryCode}""", """""")
                        .param("""s_con_registration_preorder{actionForm.acctCategory}""", """Personal""")
                        .param("""s_con_registration_preorderwlw-select_key:{actionForm.gender}OldValue""", """true""")
                        .param("""s_con_registration_preorderwlw-select_key:{actionForm.gender}""", """Male""")
                        .param("""s_con_registration_preorderwlw-select_key:{actionForm.religion}OldValue""", """true""")
                        .param("""s_con_registration_preorderwlw-select_key:{actionForm.religion}""", """Christian""")
                        .param("""s_con_registration_preorderwlw-select_key:{actionForm.race}OldValue""", """true""")
                        .param("""s_con_registration_preorderwlw-select_key:{actionForm.race}""", """Chinese""")
                        .param("""s_con_registration_preorder{actionForm.dateOfBirth}""", """""")
                        .param("""s_con_registration_preorderwlw-select_key:{actionForm.nationality}OldValue""", """true""")
                        .param("""s_con_registration_preorderwlw-select_key:{actionForm.nationality}""", """Citizen""")
                        .param("""s_con_registration_preorder{actionForm.emailAddress}""", """""")
                        .param("""s_con_registration_preorderwlw-checkbox_key:{actionForm.enrollTMRewards}OldValue""", """false""")
                        .param("""s_con_registration_preorder{actionForm.hul}""", """L-4-52""")
                        .param("""s_con_registration_preorder{actionForm.floorNo}""", """""")
                        .param("""s_con_registration_preorder{actionForm.buildingName}""", """APT TERATAI BLOK L""")
                        .param("""s_con_registration_preorder{actionForm.streetType}""", """JALAN""")
                        .param("""s_con_registration_preorder{actionForm.streetName}""", """BUNGA RAYA""")
                        .param("""s_con_registration_preorder{actionForm.section}""", """TAMAN BUNGA RAYA""")
                        .param("""s_con_registration_preorder{actionForm.city}""", """SERENDAH""")
                        .param("""s_con_registration_preorder{actionForm.postcode}""", """48300""")
                        .param("""s_con_registration_preorder{actionForm.state}""", """SELANGOR""")
                        .param("""s_con_registration_preorder{actionForm.country}""", """MALAYSIA""")
                        .param("""s_con_registration_preorderwlw-select_key:{actionForm.homePhonePrefix}OldValue""", """true""")
                        .param("""s_con_registration_preorderwlw-select_key:{actionForm.homePhonePrefix}""", """Please select""")
                        .param("""s_con_registration_preorder{actionForm.homePhone}""", """""")
                        .param("""s_con_registration_preorderwlw-select_key:{actionForm.officePhonePrefix}OldValue""", """true""")
                        .param("""s_con_registration_preorderwlw-select_key:{actionForm.officePhonePrefix}""", """Please select""")
                        .param("""s_con_registration_preorder{actionForm.officePhone}""", """""")
                        .param("""s_con_registration_preorderwlw-select_key:{actionForm.mobilePhonePrefix}OldValue""", """true""")
                        .param("""s_con_registration_preorderwlw-select_key:{actionForm.mobilePhonePrefix}""", """014""")
                        .param("""s_con_registration_preorder{actionForm.mobilePhone}""", """5678905""")
                        .param("""s_con_registration_preorder{actionForm.contactName}""", """Rotan""")
                        .param("""s_con_registration_preorderwlw-select_key:{actionForm.mobileNumberPrefix}OldValue""", """true""")
                        .param("""s_con_registration_preorderwlw-select_key:{actionForm.mobileNumberPrefix}""", """014""")
                        .param("""s_con_registration_preorder{actionForm.mobileNumber}""", """5678905""")
                        .param("""s_con_registration_preorder{actionForm.contactEmail}""", """rotan@gmail.com""")
                        .param("""s_con_registration_preorder{actionForm.orderRemarks}""", """""")
                        .param("""s_con_registration_preorderactionOverride:verifyOrderDetails""", """Next""")
            )
        .pause(5)
        .exec(http("Submit_Order")
                    .post("/iCarePrimePortal/selfcare.portal")
                    .headers(headers_3)
                    .queryParam("""_windowLabel""", """s_con_registration_preorder""")
                    .queryParam("""s_con_registration_preorder_actionOverride""", """/portlets/ordercapture/goToOrderSummary""")
                    .queryParam("""_nfpb""", """true""")
                        .param("""s_con_registration_preorderactionOverride:gotoSubmitOrderOrRewardsTnc""", """Submit""")
            )
        .pause(2)
        .exec(http("View_Confirmation")
                    .get("/iCarePrimePortal/portlets/ordercapture/preorder/PreOrderController.portlet")
                    .headers(headers_1)
                    .queryParam("""s_con_registration_preorder_netui:returnActionViewRenderer""", """org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer""")
                    .queryParam("""s_con_registration_preorder_netui:returnActionCallback""", """Netui_OnPopupDone""")
                    .queryParam("""_portlet.themeAltSkeleton""", """true""")
                    .queryParam("""_portlet.title""", """Preordercontroller""")
                    .queryParam("""s_con_registration_preorder_actionOverride""", """/portlets/ordercapture/viewConfirmation""")
                    .queryParam("""_portlet.themeName""", """plain""")
                    .queryParam("""_portlet.contentType""", """text/html; charset=UTF-8""")
                    .queryParam("""s_con_registration_preorderjpfScopeID""", """s_con_registration_preorder""")
                    .queryParam("""_portlet.lafUniqueId""", """icareprime3DefinitionLabel_1""")
                    .queryParam("""_portlet.contentOnly""", """true""")
                    .queryParam("""_portlet.contentMode""", """FULL""")
                    .queryParam("""_portlet.portalId""", """selfcare_portal""")
                    .queryParam("""_windowLabel""", """s_con_registration_preorder""")
                    .queryParam("""_portlet.themeAltSkin""", """true""")
                    .queryParam("""_nfpsid""", """/portlets/ordercapture/viewConfirmation""")
                    .queryParam("""_portlet.portalUrl""", """/iCarePrimePortal/selfcare.portal""")
                    .queryParam("""_nfpb""", """true""")
                    .queryParam("""_portlet.asyncMode""", """compat_9_2""")
            )
        }
        setUp(scn.users(10).protocolConfig(httpConf))
}

共有2个答案

仲孙温文
2023-03-14

暗箱操作:你确定第一个请求之后的请求不是简单地缓存的吗?尝试禁用缓存。

丁震博
2023-03-14

我不确定你的问题是否解决了。我也遇到了同样的问题,禁用缓存也帮了我的忙。

disableCachingparam设置为您的httpProtocolconfig,如下所示:

val httpConf = http
.acceptHeader("application/json") 
.acceptLanguageHeader("en-US,en;q=0.5")
.acceptEncodingHeader("gzip, deflate")
.disableWarmUp
.disableCaching
 类似资料:
  • Gatling解析Strings参数值并将它们转换为函数,这些函数将根据存储在会话中的数据计算结果,然后对其进行评估。 加特林文件 有没有办法在exec中手动执行此操作? 我有多个使用EL属性的请求体模板,发送的请求将因进纸器而异 我目前拥有的代码如下: 我希望没有办法评估嵌套的EL属性,但是有没有办法使用会话变量手动评估它?类似于 我在其他一些问题中看到过ELCompiler被引用,但不确定从哪

  • 我试着用各种“Rest”和“atOnceUser”进行注射。我在留档上没有找到一个好的解决方案。 我的方法是使用本地计数器创建一个名为“getNextNumber()”的函数,以增加“atOnceUser”的数量,但该函数一开始只调用一次。 有什么想法吗? 我的代码:

  • 我有一个包含JSON数组的JSON文件 测验json 我想针对endpoint测试JSON数组中的每个元素,以观察系统针对唯一有效负载的性能 目前我有 测试ervice.scala 我无法从作为JSON Gatling文档称JSON Feeder将数组的每个元素加载到一个记录集合中 https://gatling.io/docs/2.3/session/feeder/ 即: 并将正文设置为 问题是

  • 我正在和空手道加特林一起做一个POC,以了解这种组合对我们性能要求的可行性。到目前为止,我能够成功地运行空手道功能文件与gatling。 但我面临两个问题: 我不能更新模拟类名。demo(空手道gatling)项目模拟默认类名是CatsKarate模拟。我想给它重新命名。 问题是: 当我重命名它时,它开始抛出以下错误: 无法执行目标io.gatling:gatlin-maven-plugin:2.

  • 我有一个数组,我想用于2个馈线。我希望每个馈线都能够使用数组中的所有值。但似乎值用完了

  • 我需要在Gatling中发出请求,在其中我能够访问会话项(没有表达式语言)。我需要这样做,因为我想将数据注入到来自csv进纸器的请求中。为了演示我的问题,我有一个小例子(没有会话的实际需要)。 以下场景运行良好: 但那一个没有(我得到异常