Dynamic searchParameters in http request of jmeter












0















This is my ThreadGroup



enter image description here



enter image description here



enter image description here



enter image description here



enter image description here



IndexFile.csv is like




type,text,code,,,FileOne.csv
req,,,,,FileTwo.csv
And soo on which means dynamic number of params for http request





FileOne.csv is like






44-3ef-k23,string,http://someThing:port/Something|something
string,"string,string",1234





So i need http encoding i.e utf-8 while reading file.



Can someone help me how to do this










share|improve this question



























    0















    This is my ThreadGroup



    enter image description here



    enter image description here



    enter image description here



    enter image description here



    enter image description here



    IndexFile.csv is like




    type,text,code,,,FileOne.csv
    req,,,,,FileTwo.csv
    And soo on which means dynamic number of params for http request





    FileOne.csv is like






    44-3ef-k23,string,http://someThing:port/Something|something
    string,"string,string",1234





    So i need http encoding i.e utf-8 while reading file.



    Can someone help me how to do this










    share|improve this question

























      0












      0








      0








      This is my ThreadGroup



      enter image description here



      enter image description here



      enter image description here



      enter image description here



      enter image description here



      IndexFile.csv is like




      type,text,code,,,FileOne.csv
      req,,,,,FileTwo.csv
      And soo on which means dynamic number of params for http request





      FileOne.csv is like






      44-3ef-k23,string,http://someThing:port/Something|something
      string,"string,string",1234





      So i need http encoding i.e utf-8 while reading file.



      Can someone help me how to do this










      share|improve this question














      This is my ThreadGroup



      enter image description here



      enter image description here



      enter image description here



      enter image description here



      enter image description here



      IndexFile.csv is like




      type,text,code,,,FileOne.csv
      req,,,,,FileTwo.csv
      And soo on which means dynamic number of params for http request





      FileOne.csv is like






      44-3ef-k23,string,http://someThing:port/Something|something
      string,"string,string",1234





      So i need http encoding i.e utf-8 while reading file.



      Can someone help me how to do this






      type,text,code,,,FileOne.csv
      req,,,,,FileTwo.csv
      And soo on which means dynamic number of params for http request





      type,text,code,,,FileOne.csv
      req,,,,,FileTwo.csv
      And soo on which means dynamic number of params for http request





      44-3ef-k23,string,http://someThing:port/Something|something
      string,"string,string",1234





      44-3ef-k23,string,http://someThing:port/Something|something
      string,"string,string",1234






      csv testing groovy jmeter jsr223






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 23 '18 at 9:49









      venkat saivenkat sai

      15110




      15110
























          1 Answer
          1






          active

          oldest

          votes


















          0














          One thing is obvious: you should not be using __CSVRead() function inside the JSR223 script.



          According to JSR223 Sampler documentation:




          JMeter processes function and variable references before passing the script field to the interpreter, so the references will only be resolved once. Variable and function references in script files will be passed verbatim to the interpreter, which is likely to cause a syntax error. In order to use runtime variables, please use the appropriate props methods, e.g.



          props.get("START.HMS");
          props.put("PROP1","1234");



          So I would suggest to use File.readLines() function in order to read your CSV file(s) into memory, once done you should be able to call split() function to split each line by comma and do what you need with the results.



          Check out Working with Files chapter of The Groovy Templates Cheat Sheet for JMeter article for more information and examples






          share|improve this answer
























          • But here the problem is the data is huge in the file and the buffer will run out of memory, so is it possible in any way to read a single line per iteration of the loop. And can you write down the split function with separator as semicolan (;) and http encoding for the values

            – venkat sai
            Nov 23 '18 at 12:22














          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53444209%2fdynamic-searchparameters-in-http-request-of-jmeter%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          One thing is obvious: you should not be using __CSVRead() function inside the JSR223 script.



          According to JSR223 Sampler documentation:




          JMeter processes function and variable references before passing the script field to the interpreter, so the references will only be resolved once. Variable and function references in script files will be passed verbatim to the interpreter, which is likely to cause a syntax error. In order to use runtime variables, please use the appropriate props methods, e.g.



          props.get("START.HMS");
          props.put("PROP1","1234");



          So I would suggest to use File.readLines() function in order to read your CSV file(s) into memory, once done you should be able to call split() function to split each line by comma and do what you need with the results.



          Check out Working with Files chapter of The Groovy Templates Cheat Sheet for JMeter article for more information and examples






          share|improve this answer
























          • But here the problem is the data is huge in the file and the buffer will run out of memory, so is it possible in any way to read a single line per iteration of the loop. And can you write down the split function with separator as semicolan (;) and http encoding for the values

            – venkat sai
            Nov 23 '18 at 12:22


















          0














          One thing is obvious: you should not be using __CSVRead() function inside the JSR223 script.



          According to JSR223 Sampler documentation:




          JMeter processes function and variable references before passing the script field to the interpreter, so the references will only be resolved once. Variable and function references in script files will be passed verbatim to the interpreter, which is likely to cause a syntax error. In order to use runtime variables, please use the appropriate props methods, e.g.



          props.get("START.HMS");
          props.put("PROP1","1234");



          So I would suggest to use File.readLines() function in order to read your CSV file(s) into memory, once done you should be able to call split() function to split each line by comma and do what you need with the results.



          Check out Working with Files chapter of The Groovy Templates Cheat Sheet for JMeter article for more information and examples






          share|improve this answer
























          • But here the problem is the data is huge in the file and the buffer will run out of memory, so is it possible in any way to read a single line per iteration of the loop. And can you write down the split function with separator as semicolan (;) and http encoding for the values

            – venkat sai
            Nov 23 '18 at 12:22
















          0












          0








          0







          One thing is obvious: you should not be using __CSVRead() function inside the JSR223 script.



          According to JSR223 Sampler documentation:




          JMeter processes function and variable references before passing the script field to the interpreter, so the references will only be resolved once. Variable and function references in script files will be passed verbatim to the interpreter, which is likely to cause a syntax error. In order to use runtime variables, please use the appropriate props methods, e.g.



          props.get("START.HMS");
          props.put("PROP1","1234");



          So I would suggest to use File.readLines() function in order to read your CSV file(s) into memory, once done you should be able to call split() function to split each line by comma and do what you need with the results.



          Check out Working with Files chapter of The Groovy Templates Cheat Sheet for JMeter article for more information and examples






          share|improve this answer













          One thing is obvious: you should not be using __CSVRead() function inside the JSR223 script.



          According to JSR223 Sampler documentation:




          JMeter processes function and variable references before passing the script field to the interpreter, so the references will only be resolved once. Variable and function references in script files will be passed verbatim to the interpreter, which is likely to cause a syntax error. In order to use runtime variables, please use the appropriate props methods, e.g.



          props.get("START.HMS");
          props.put("PROP1","1234");



          So I would suggest to use File.readLines() function in order to read your CSV file(s) into memory, once done you should be able to call split() function to split each line by comma and do what you need with the results.



          Check out Working with Files chapter of The Groovy Templates Cheat Sheet for JMeter article for more information and examples







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 23 '18 at 11:41









          Dmitri TDmitri T

          74.8k33765




          74.8k33765













          • But here the problem is the data is huge in the file and the buffer will run out of memory, so is it possible in any way to read a single line per iteration of the loop. And can you write down the split function with separator as semicolan (;) and http encoding for the values

            – venkat sai
            Nov 23 '18 at 12:22





















          • But here the problem is the data is huge in the file and the buffer will run out of memory, so is it possible in any way to read a single line per iteration of the loop. And can you write down the split function with separator as semicolan (;) and http encoding for the values

            – venkat sai
            Nov 23 '18 at 12:22



















          But here the problem is the data is huge in the file and the buffer will run out of memory, so is it possible in any way to read a single line per iteration of the loop. And can you write down the split function with separator as semicolan (;) and http encoding for the values

          – venkat sai
          Nov 23 '18 at 12:22







          But here the problem is the data is huge in the file and the buffer will run out of memory, so is it possible in any way to read a single line per iteration of the loop. And can you write down the split function with separator as semicolan (;) and http encoding for the values

          – venkat sai
          Nov 23 '18 at 12:22






















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53444209%2fdynamic-searchparameters-in-http-request-of-jmeter%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

          Alcedinidae

          Origin of the phrase “under your belt”?