locked
How to set a value in the cookie for a load test RRS feed

  • Question

  • The Application I am trying to load-test sets a value in the Cookie via javascript (client side).

    Because of this, the recorded load test does not populate this value into the cookie (it is missing). For this Application to work as expected, it needs this value in the cookie.

    So my question is, how can I add a value to the cookie being sent?

    Thursday, March 22, 2018 1:45 PM

All replies

  • Hi Stephen,

    Thanks for your posting.

    Is it about web performance testing? 

    Web performance tests are driven at the protocol layer rather than instantiating a browser, since Web Performance Tests work at the HTTP layer.Don't think web performance test could implement JS code directly.

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/321b0385-7ac5-429c-9511-204fd7e6d84a/load-testing-a-web-app-that-includes-java-script?forum=vstest

     

    Regards,

    Fletcher


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Friday, March 23, 2018 8:19 AM
  • To be clear; this is a yes it is a web performance test (load test) in visual studio.

    I have a value i need to put into the cookie, I have this value in a context parameter that is pulled from a previous request using an extraction rule.

    Now I want to mimic what javascript does but putting this value into the cookie as part of the webtest. From searching, it looks like the way to do this is to write a custom request plugin to do this for me.

    Friday, March 23, 2018 12:07 PM
  • Yeah, you might be right the custom Web performance test plug-in probably could be a workaround.

     

    Regards,

    Fletcher


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Monday, March 26, 2018 8:43 AM
  • Hi Stephen 

    you need to add the cookie to you response for example on your page load 

    protected void Page_Load(object sender ,EventArgs e)

    {

    Response.Cookies.Add (new HttpCookie ("youcookiename","youcookievalue"));

    }


    Monday, March 26, 2018 9:08 AM
  • I have now solved this by writing a custom plug-in that inserts the desired values into the cookie (so it mimics what the javascript would do).

    Tuesday, March 27, 2018 9:16 AM
  • Glad you've resolved this issue. And thanks for sharing your soluiton, you could mark your reply as answer if it's ok for you.

     

    Regards,

    Fletcher


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    • Edited by Fletch Zhou Wednesday, March 28, 2018 1:48 AM
    Wednesday, March 28, 2018 1:48 AM
  • Hi Greena66,

    We don't get your response for about one week, as this issue has been resolved in your side, would you please mark your reply as the answer? So we could help you close this case, and it would help other community members who get the same issue as yours.

    Have a nice day,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, April 5, 2018 5:11 AM