Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gatling repeat action

Tags:

scala

gatling

I have one gatling record, now I want repeat the scenario for 10 times, but I am encounter some problem, which my repeat action only fire on first step, and will not go through whole step of scenario. May I know what wrong with it?Is it I need to add repeat(10){} to every single step? Below is my scala code.

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))
}
like image 763
user3571738 Avatar asked Jan 11 '23 17:01

user3571738


1 Answers

I'm not sure if you resolved your issue. I had the same problem and disabling the caching did the trick for me.

Set disableCaching param to your httpProtocol config, like this:

val httpConf = http
.acceptHeader("application/json") 
.acceptLanguageHeader("en-US,en;q=0.5")
.acceptEncodingHeader("gzip, deflate")
.disableWarmUp
.disableCaching
like image 199
Suresh Avatar answered Jan 18 '23 12:01

Suresh