Forum Discussion

hienhoang88's avatar
hienhoang88
Occasional Contributor
8 years ago

LoadComplete - Parameterization the request body

Hi everybody,

 

I am new with LoadComplete and I would like for ask your support for my case.

 

Actually I have I request which look like the captured image. How could I parameterize username and password value in this request since when I check with Set Parameter Values options, I only find requests for which request body is displayed as couple of key - value field.

 

Thanks for your help.

6 Replies

    • hienhoang88's avatar
      hienhoang88
      Occasional Contributor

      Hi,

       

      Firstly I would like to thanks for your help but is is not the answer that I want. Maybe I don't make it clear enough and it makes you to be confused.

       

      Allow me to specify again my case:

       

      - I have an POST request which aims to authenticate user's login and password.

      - This request body is the following one:

      <root><type>SQL</type><p1>cpt_tm45</p1><p2>smart</p2><p3>0</p3><p5></p5><p6></p6><p7></p7><p8>00000000-0000-0000-0000-000000000000</p8><p9></p9></root>

      - And as you can see, value in p1 represents user login and the one in p2 represents user password.

      - Now, I have a csv file containing user login and password. Format of this file is:

        cpt_tm46;smart

        cpt_tm47;smart

       

      => So, I would like to have something like <root><type>SQL</type><p1>@username</p1><p2>@password</p2><p3>0</p3><p5></p5><p6></p6><p7></p7><p8>00000000-0000-0000-0000-000000000000</p8><p9></p9></root>

      , and @username and @password are extracted from my csv file.

       

      This will help me to have a request body like this:

      <root><type>SQL</type><p1>cpt_tm46</p1><p2>smart</p2><p3>0</p3><p5></p5><p6></p6><p7></p7><p8>00000000-0000-0000-0000-000000000000</p8><p9></p9></root> if the first line is read 

       

      AND

       

      <root><type>SQL</type><p1>cpt_tm47</p1><p2>smart</p2><p3>0</p3><p5></p5><p6></p6><p7></p7><p8>00000000-0000-0000-0000-000000000000</p8><p9></p9></root> if the second line is read

       

      Could we do that with any feature of LoadComplete?

       

      Regards.

      • hienhoang88's avatar
        hienhoang88
        Occasional Contributor

        Hi,

         

        I still stuck with this issue. Here I was trying these following solutions that I could imagine but they doesn't work:

         1 - I created the csv file which contains body request, which is ;

               <root><type>SQL</type><p1>cpt_tm80</p1><p2>smart</p2><p3>0</p3><p5></p5><p6></p6><p7></p7><p8>00000000-0000-0000-0000-000000000000</p8><p9></p9></root>

               <root><type>SQL</type><p1>cpt_tm81</p1><p2>smart</p2><p3>0</p3><p5></p5><p6></p6><p7></p7><p8>00000000-0000-0000-0000-000000000000</p8><p9></p9></root>

         

        but in log, request body is encoded, so I abandoned this solution.

         

        2 - I created a second csv file, which contains :

              cpt_tm80;smart

              cpt_tm81;smart

         

        and in the request body, I edited it to obtain something like : <root><type>SQL</type><p1>@username</p1><p2>@password</p2><p3>0</p3><p5></p5><p6></p6><p7></p7><p8>00000000-0000-0000-0000-000000000000</p8><p9></p9></root>

         

        but once again, it still fail.

         

        Please note that in my case, I have many requests which are very similar to this one. It means I have many request for which the request body contains only one field which is represented in format XML with many values to be parameterized and I have no value. 

         

        If I can't do it, then it is very hard to convince my boss about the advantages that LoadComplete bring to us since with JMeter, we can do it easily.

         

        Many thanks and regards