Dynamic Parameters in web performance test RRS feed

  • Question

  • Hello,

    I am new to web performance testing.

    I came through many articles describing how to create web test and load test for a website. But, my requirement is to create web test for web services. At the end, I created web tests for web services and running successfully.

    And now, I want to pass values dynamically to the services.

    To do this, we have extraction rules to extract the data from previous request and with the help of context parameters in the next request, we are passing dynamic values.

    Here, I've only one request so extraction won't work. So I went for data source to replace the context parameters.

    Now, my question is can we update/modify the request data before sending the request like extracting to context parameters.



    a and b values am replacing with the help of context parameters and data source.


    with out using the database can we do this?

    Can we modify the request body before sending the request?

    Note: We have a prerequest event in web test.

    Thanks in Advance...


    Tahnks & Regards Kiran Chinthakuntla

    Thursday, May 29, 2014 9:57 AM


All replies

  • Hi Kiran

    Yes you can there are many ways for you to add context parameters.  Probably easiest for you would be to convert to a coded webtest as you'll see the body of the request more clearly than by drilling down into a normal webtest.  Simply use the double curly brackets {{}} to encase any context parameter and it will replace it with the value when the request is submitted.


    Thursday, May 29, 2014 10:09 AM
  • You can also use pluging to change the request details. See WebTestPlugin.PreRequestDataBinding Method and WebTestRequestPlugin.PreRequestDataBinding Method.


    Thursday, May 29, 2014 11:57 AM
  • Yes Kiran, you can modify the request body as suggested by Ian.

    What's your Visual Studio version?

    In case if you have missed out this plug-in....I highly recommend.

    1. Editor for Request body: The plugins provide a tree view of the structured data which allows easy editing, parameterization and data binding.


    This plug-in is available for VS 2012/13 as well..you can search in codeplex

    Thursday, May 29, 2014 11:59 AM
  • Hi TejasJ,

    Already I verified all these. Can you please provide an example how to override these methods in my application.

    Work done: Created request plugins and web test plugins (custom), but unable to work with them in my application.

    Can you please provide me a working example?

    Thanks & Regards,

    Kiran Ch

    Tahnks & Regards Kiran Chinthakuntla

    Wednesday, June 11, 2014 7:21 AM
  • In Visual Studio, view the properties panel for the string body of the web service request.

    Click the ellipsis to open a text box containing the string body. Edit the text to add the context parameters you need. The example below is NOT a valid body, but it shows how to access value from the "Town" and "Country" fields of my example data source. Note the punctuation between the pieces of the data source access.



    Wednesday, June 11, 2014 7:57 AM
  • Thanks Adrian,

    This was already done.

    My requirement is to change the data after data binding from the data source into context parameters i.e. I need to change before sending the request.


    I am using .CSV file as data source.

    There is a country code should have min 4 digits. If it is less than 4 digits, it should be preceded with 0's before submitting the request.

    Data source is like: 1234, 23, 123, 5555

    (.CSV doesn't allow values 1234, 0023, 0123, 5555. But .xls (Excel) allowing)

    When 23 is taken from the source, I want to replace 23 as 0023.

    Like anything I want to make before sending the request and after binding the data from data source.

    I tried by generating code through web test and debugging. But I can't able to debug.

    Thanks in Advance,

    Kiran Ch

    Tahnks & Regards Kiran Chinthakuntla

    Wednesday, June 11, 2014 8:46 AM
  • Is the following the case? The data source CSV has a country code with, for example:


    You want "1234" and "0056" and "0789" passed in the requests, but you are getting "1234" and "56" and "789".

    There are at several ways of handing this.

    (1) Alter the data source so that zero suppression does not happen. The CSV reader in Visual Studio appears to handle strings much like Excel does, it converts them to numbers if it can. So prevent it happening. Try quoting the strings and/or adding spaces. For example

    " 0789 ",opq,rst

    I do not remember which will work, but one of them should. There are lots of web pages discussing keeping leading zeroes in CSV or Excel or spreadsheets.

    (2) Instruct Coded UI to treat the field as text via a "schema.ini" or an ".xsd" file.

    (3) Write a plugin that reads the values from the data source, adds any wanted leading zeroes and write the value to a context parameter which can be used in the generated request.

    (4) Get the website designers to allow missing leading zeroes.



    Wednesday, June 11, 2014 10:11 AM
  • Hi Kiran

    Adrian is absolutely correct checkout Schema


    Wednesday, June 11, 2014 10:16 AM