我有一個gatling記錄,現在我想重複這個場景10次,但是我遇到了一些問題,我的重複動作只在第一步觸發,並且不會經歷場景的整個步驟。我可以知道它有什麼問題嗎?是否需要向每一步添加重複(10){}?以下是我的scala代碼。Gatling重複動作
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}""", """[email protected]""")
.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))
}
你可以做一個更小例子,解釋或進一步究竟問題出在哪裏? –
例如,如果我運行場景的第一步驟中的代碼時,得到所需的結果 .repeat(10) { EXEC(HTTP( 「Browse_URL」) .pause(3) } 但是,當我灣它在這個場景的每一步都會運行,它失敗了 – user3571738
這並沒有太大的幫助,只是重複你在問題中提到的內容,請在問題中付出一些努力,並且人們會更有能力(也更有可能)提供幫助。 –