...
Code Block |
---|
scenarios: # we can define multiple scenarios in 1 yml file if we want to - name: "TM_OrderTickets_v2" flow:TV_Test_iosE789" # in this case we have only 1 scenario, this is the name of the scenario flow: - page: # URLs need to be attached to pages, if a page is not defined, then one is automatically created name: "FirstPage" # name of the page thinktime: 6000 - transaction: transactionname: "Trans1" flow: - get: # HTTP method goes here url: "https://www.google.com" # this is an example of using a relative URL - get: url: "https://www.unsplash.com" # this is an example of using a relative URL - loop: loopname: "Loop1" count: 3 flow: - page: name: "DRM" - get: url: "https://www.google.com" headers: # signifies the adding or updating of a header field Authorization: "{{inputsTestVar}}" # variables go inside curly brackets - page: name: "Manifest" - get: capture: - header: target: 'x-cdn-forward' as: 'cdncompare' assert: # allow both 302 and 200 because the cdn can change - status: codes: - 200 - 302 - text: string1: "test" operand: "1" string2: "test2" onfail: "continue" after: - inline: code: | isakamai = strCompareIgnoreCase(cdncompare,"Akamai") IF isakamai THEN Location = getHTTPResponseHeaderField("Location") temp1 = strSplit(Location,"\\/vod") temp2 = temp1(1) temp3 = strSplit(temp2,"https:\\/\\/") cdnforward = temp3(2) ELSE cdnforward = "lbs-usp-hls-vod.cmore.se" ENDIF input: - '{{testVarInlineAfterInput1}}' output: - '{{testVarInlineAfterOutput1}}' before: - inline: code: | isakamai = strCompareIgnoreCase(cdncompare,"Akamai") IF isakamai THEN Location = getHTTPResponseHeaderField("Location") temp1 = strSplit(Location,"\\/vod") temp2 = temp1(1) temp3 = strSplit(temp2,"https:\\/\\/") cdnforward = temp3(2) ELSE cdnforward = "lbs-usp-hls-vod.cmore.se" ENDIF input: - '{{testVarInlineBeforeInput1}}' output: - '{{testVarInlineBeforeOutput1}}' url: "https://www.google.com/inputsTestVar" - get: capture: - regex: target: '([a-zA-Z0-9\(\)\_]+-audio_eng=[a-zA-Z0-9\(\)\_]+-video_eng=.*m3u8)' as: "submanifest_url" - xpath: target: 'test' as: "xpath_test" - json: target: 'jsonstring' as: "json_target" url: "http://zebracli.zebracli.zebracli" - page: name: "Submanifest" - get: capture: - boundary: leftboundary: "leftTest" rightboundary: "rightTest" as: 'boundaryVar' - regex: target: '(.*\.ts?)' occurrence: 1 as: 'regexVar' - header: target: "headerName" as: "headerVar" url: "http://zebracli.zebracli.zebracli" - page: name: "Segments" - loop: flow: - page: name: "testPagex" - transaction: transactionname: "testTransactionx" flow: - post: url: "http://zebracli.zebracli.zebracli/segment_loop_Item" body: "<html><body><h1>Hello, World!</h1></body></html>" before: - inline: code: | print("test") input: - '{{testVarInlineBeforeInput2}}' output: - '{{testVarInlineBeforeOutput2}}' # - plugin: # file: "addNumbers.class" # output: # - "testvaroutput" # input: # - "testvarinput" # after: # - inline: # code: | # print("test") # input: # - '{{testVarInlineAfterInput2}}' # output: # - '{{testVarInlineAfterOutput2}}' # - plugin: # output: # - "testvaroutput2" # input: # - "testvarinput2" # file: "addNumbers.class" - get: url: "http://zebracli.zebracli.zebracli" - get: # the "segment_loop_Item" part of the url is replaced with a segment defined in the "over" list after: - inline: code: | print("test") input: - '{{testVarInlineAfterInput3}}' output: - '{{testVarInlineAfterOutput3}}' before: - inline: code: | print("test") input: - '{{testVarInlineBeforeInput3}}' output: - '{{testVarInlineBeforeOutput3}}' url: "http://zebracli.zebracli.zebracli" - page: name: "Test" thinktimename: 0"testPagey" - get: urlloopname: "https://www.google.com"segment_loop" assert over: # the loop iterates once over each -item status:in the "over" list codes: - "{{boundaryVar}}" - 200 - text:"{{regexVar}}" string1: "My Test String- "{{headerVar}}" |
The scenarios section of the definition file is where one or more scripts are defined. If multiple scripts are defined, the config options will be applied to all scripts within the “scenarios” section.
...