@@ -40947,6 +40947,250 @@ if(response.data.categoryList.length !== 4){
4094740947 </hashTree>
4094840948
4094940949
40950+ <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="GraphQL Categories Query: Get Multiple Categories By Id" enabled="true">
40951+ <intProp name="ThroughputController.style">1</intProp>
40952+ <boolProp name="ThroughputController.perThread">false</boolProp>
40953+ <intProp name="ThroughputController.maxThroughput">1</intProp>
40954+ <stringProp name="ThroughputController.percentThroughput">${graphqlGetCategoryListByCategoryIdPercentage}</stringProp>
40955+ <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController>
40956+ <hashTree>
40957+ <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true">
40958+ <stringProp name="script">
40959+ var testLabel = "${testLabel}" ? " (${testLabel})" : "";
40960+ if (testLabel
40961+ && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy'
40962+ ) {
40963+ if (sampler.getName().indexOf(testLabel) == -1) {
40964+ sampler.setName(sampler.getName() + testLabel);
40965+ }
40966+ } else if (sampler.getName().indexOf("SetUp - ") == -1) {
40967+ sampler.setName("SetUp - " + sampler.getName());
40968+ }
40969+ </stringProp>
40970+ <stringProp name="scriptLanguage">javascript</stringProp>
40971+ <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/setup_label.jmx</stringProp></JSR223PreProcessor>
40972+ <hashTree/>
40973+ <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true">
40974+ <stringProp name="BeanShellSampler.query">
40975+ vars.put("testLabel", "GraphQL Categories Query: Get Multiple Categories By Id");
40976+ </stringProp>
40977+ <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp>
40978+ </BeanShellSampler>
40979+ <hashTree/>
40980+
40981+ <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true">
40982+ <collectionProp name="HeaderManager.headers">
40983+ <elementProp name="" elementType="Header">
40984+ <stringProp name="Header.name">Content-Type</stringProp>
40985+ <stringProp name="Header.value">application/json</stringProp>
40986+ </elementProp>
40987+ <elementProp name="" elementType="Header">
40988+ <stringProp name="Header.name">Accept</stringProp>
40989+ <stringProp name="Header.value">*/*</stringProp>
40990+ </elementProp>
40991+ </collectionProp>
40992+ <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/api/header_manager_before_token.jmx</stringProp></HeaderManager>
40993+ <hashTree/>
40994+
40995+ <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Init Random Generator" enabled="true">
40996+ <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/init_random_generator_setup.jmx</stringProp>
40997+ <stringProp name="BeanShellSampler.query">
40998+ import java.util.Random;
40999+
41000+ Random random = new Random();
41001+ if (${seedForRandom} > 0) {
41002+ random.setSeed(${seedForRandom} + ${__threadNum});
41003+ }
41004+
41005+ vars.putObject("randomIntGenerator", random);
41006+ </stringProp>
41007+ <stringProp name="BeanShellSampler.filename"/>
41008+ <stringProp name="BeanShellSampler.parameters"/>
41009+ <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp>
41010+ </BeanShellSampler>
41011+ <hashTree/>
41012+
41013+ <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="SetUp - Prepare Category Data" enabled="true">
41014+ <stringProp name="scriptLanguage">javascript</stringProp>
41015+ <stringProp name="parameters"/>
41016+ <stringProp name="filename"/>
41017+ <stringProp name="cacheKey"/>
41018+ <stringProp name="script">random = vars.getObject("randomIntGenerator");
41019+
41020+ var categories = props.get("categories");
41021+
41022+ var numbers = [];
41023+
41024+ var sanity = 0;
41025+ for(var i = 0; i < 4; i++){
41026+ sanity++;
41027+ if(sanity > 100){
41028+ break;
41029+ }
41030+ var number = random.nextInt(categories.length)
41031+ if(numbers.indexOf(number) >= 0){
41032+ i--;
41033+ continue;
41034+ }
41035+ numbers.push(number);
41036+ }
41037+
41038+ vars.put("category_id_1", categories[numbers[0]].id);
41039+ vars.put("category_id_2", categories[numbers[1]].id);
41040+ vars.put("category_id_3", categories[numbers[2]].id);
41041+ vars.put("category_id_4", categories[numbers[3]].id);
41042+ </stringProp>
41043+ <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/extract_multiple_categories_setup.jmx</stringProp>
41044+ </JSR223Sampler>
41045+ <hashTree/>
41046+
41047+ <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="[categories query] Get multiple categories by ID" enabled="true">
41048+ <boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
41049+ <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
41050+ <collectionProp name="Arguments.arguments">
41051+ <elementProp name="" elementType="HTTPArgument">
41052+ <boolProp name="HTTPArgument.always_encode">false</boolProp>
41053+ <stringProp name="Argument.value">{"query" : "{\n categories(filters:{ids: {in: [\"${category_id_1}\", \"${category_id_2}\", \"${category_id_3}\", \"${category_id_4}\"]}}) {\n total_count\n page_info {\n total_pages\n current_page\n page_size\n }\n items{\n id\n children {\n id\n name\n url_key\n url_path\n children_count\n path\n image\n productImagePreview: products(pageSize: 1, sort: {name: ASC}) {\n items {\n small_image {\n label\n url\n }\n }\n }\n }\n }\n }\n}"}</stringProp>
41054+ <stringProp name="Argument.metadata">=</stringProp>
41055+ </elementProp>
41056+ </collectionProp>
41057+ </elementProp>
41058+ <stringProp name="HTTPSampler.domain"/>
41059+ <stringProp name="HTTPSampler.port">${graphql_port_number}</stringProp>
41060+ <stringProp name="HTTPSampler.connect_timeout">60000</stringProp>
41061+ <stringProp name="HTTPSampler.response_timeout">200000</stringProp>
41062+ <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp>
41063+ <stringProp name="HTTPSampler.contentEncoding"/>
41064+ <stringProp name="HTTPSampler.path">${base_path}graphql</stringProp>
41065+ <stringProp name="HTTPSampler.method">POST</stringProp>
41066+ <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
41067+ <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
41068+ <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
41069+ <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
41070+ <boolProp name="HTTPSampler.monitor">false</boolProp>
41071+ <stringProp name="HTTPSampler.embedded_url_re"/>
41072+ <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/graphql/categories_query_get_multiple_categories_by_id.jmx</stringProp>
41073+ </HTTPSamplerProxy>
41074+ <hashTree>
41075+ <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="Assert category count" enabled="true">
41076+ <stringProp name="scriptLanguage">javascript</stringProp>
41077+ <stringProp name="parameters"/>
41078+ <stringProp name="filename"/>
41079+ <stringProp name="cacheKey"/>
41080+ <stringProp name="script">var response = JSON.parse(prev.getResponseDataAsString());
41081+
41082+ if(response.data == undefined || response.data.categories == undefined){
41083+ AssertionResult.setFailureMessage("Categories result is empty.");
41084+ AssertionResult.setFailure(true);
41085+ }
41086+
41087+ if(response.data.categories.items.length !== 4){
41088+ AssertionResult.setFailureMessage("Categories query expected to find 4 categories. " + response.data.categories.items.length + " returned.");
41089+ AssertionResult.setFailure(true);
41090+ }
41091+ </stringProp>
41092+ </JSR223Assertion>
41093+ <hashTree/>
41094+ </hashTree>
41095+ </hashTree>
41096+
41097+
41098+ <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="GraphQL Categories Query: Get Many Categories with Pagination" enabled="true">
41099+ <intProp name="ThroughputController.style">1</intProp>
41100+ <boolProp name="ThroughputController.perThread">false</boolProp>
41101+ <intProp name="ThroughputController.maxThroughput">1</intProp>
41102+ <stringProp name="ThroughputController.percentThroughput">${graphqlGetCategoryListByCategoryIdPercentage}</stringProp>
41103+ <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController>
41104+ <hashTree>
41105+ <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true">
41106+ <stringProp name="script">
41107+ var testLabel = "${testLabel}" ? " (${testLabel})" : "";
41108+ if (testLabel
41109+ && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy'
41110+ ) {
41111+ if (sampler.getName().indexOf(testLabel) == -1) {
41112+ sampler.setName(sampler.getName() + testLabel);
41113+ }
41114+ } else if (sampler.getName().indexOf("SetUp - ") == -1) {
41115+ sampler.setName("SetUp - " + sampler.getName());
41116+ }
41117+ </stringProp>
41118+ <stringProp name="scriptLanguage">javascript</stringProp>
41119+ <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/setup_label.jmx</stringProp></JSR223PreProcessor>
41120+ <hashTree/>
41121+ <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true">
41122+ <stringProp name="BeanShellSampler.query">
41123+ vars.put("testLabel", "GraphQL Categories Query: Get Many Categories with Pagination");
41124+ </stringProp>
41125+ <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp>
41126+ </BeanShellSampler>
41127+ <hashTree/>
41128+
41129+ <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true">
41130+ <collectionProp name="HeaderManager.headers">
41131+ <elementProp name="" elementType="Header">
41132+ <stringProp name="Header.name">Content-Type</stringProp>
41133+ <stringProp name="Header.value">application/json</stringProp>
41134+ </elementProp>
41135+ <elementProp name="" elementType="Header">
41136+ <stringProp name="Header.name">Accept</stringProp>
41137+ <stringProp name="Header.value">*/*</stringProp>
41138+ </elementProp>
41139+ </collectionProp>
41140+ <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/api/header_manager_before_token.jmx</stringProp></HeaderManager>
41141+ <hashTree/>
41142+
41143+ <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="[categories query] Get many categories by name" enabled="true">
41144+ <boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
41145+ <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
41146+ <collectionProp name="Arguments.arguments">
41147+ <elementProp name="" elementType="HTTPArgument">
41148+ <boolProp name="HTTPArgument.always_encode">false</boolProp>
41149+ <stringProp name="Argument.value">{"query" : "{\n categories(filters:{name: {match: \"Category\"}}) {\n total_count\n page_info {\n total_pages\n current_page\n page_size\n }\n items{\n id\n children {\n id\n name\n url_key\n url_path\n children_count\n path\n image\n productImagePreview: products(pageSize: 1, sort: {name: ASC}) {\n items {\n small_image {\n label\n url\n }\n }\n }\n }\n }\n }\n}"}</stringProp>
41150+ <stringProp name="Argument.metadata">=</stringProp>
41151+ </elementProp>
41152+ </collectionProp>
41153+ </elementProp>
41154+ <stringProp name="HTTPSampler.domain"/>
41155+ <stringProp name="HTTPSampler.port">${graphql_port_number}</stringProp>
41156+ <stringProp name="HTTPSampler.connect_timeout">60000</stringProp>
41157+ <stringProp name="HTTPSampler.response_timeout">200000</stringProp>
41158+ <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp>
41159+ <stringProp name="HTTPSampler.contentEncoding"/>
41160+ <stringProp name="HTTPSampler.path">${base_path}graphql</stringProp>
41161+ <stringProp name="HTTPSampler.method">POST</stringProp>
41162+ <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
41163+ <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
41164+ <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
41165+ <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
41166+ <boolProp name="HTTPSampler.monitor">false</boolProp>
41167+ <stringProp name="HTTPSampler.embedded_url_re"/>
41168+ <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/graphql/categories_query_get_many_categories_by_name_match.jmx</stringProp>
41169+ </HTTPSamplerProxy>
41170+ <hashTree>
41171+ <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="Assert category count" enabled="true">
41172+ <stringProp name="scriptLanguage">javascript</stringProp>
41173+ <stringProp name="parameters"/>
41174+ <stringProp name="filename"/>
41175+ <stringProp name="cacheKey"/>
41176+ <stringProp name="script">var response = JSON.parse(prev.getResponseDataAsString());
41177+
41178+ if(response.data == undefined || response.data.categories == undefined){
41179+ AssertionResult.setFailureMessage("Categories result is empty.");
41180+ AssertionResult.setFailure(true);
41181+ }
41182+
41183+ if(response.data.categories.items.length != 20){
41184+ AssertionResult.setFailureMessage("Categories query expected to find 20 categories. " + response.data.categories.items.length + " returned.");
41185+ AssertionResult.setFailure(true);
41186+ }
41187+ </stringProp>
41188+ </JSR223Assertion>
41189+ <hashTree/>
41190+ </hashTree>
41191+ </hashTree>
41192+
41193+
4095041194 <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="GraphQL Get Url Info by url_key" enabled="true">
4095141195 <intProp name="ThroughputController.style">1</intProp>
4095241196 <boolProp name="ThroughputController.perThread">false</boolProp>
0 commit comments