locked
Cookie RRS feed

  • Question

  • Hi,

    i have recorded a script, with ever single user logging in it generates a authentication as security token in the form of Cookie which is very very large. when i run webtest after data binding, 
    data is getting picked up from the data file but the same is not reflecting on the browser. why???

    Is there any plugin to clear the cookie.



    Wednesday, May 20, 2009 1:24 PM

Answers

  • Hi LoadPerformer,

    The best advice I can give you is to work directly with the team who is developing / implementing the system you are trying to test. Have them explain and walk you through how the system works and show them how you are building the tests. You should be able to acheive a good result by collobarting with the developers this way, as it is very difficult to try to convey what to do over a web forum like this.

    I would also reccomend that you get the fiddler tool, and use it to help you decipher the conversation between the server and the browser. http://www.fiddler2.com/fiddler2/

    Robert


    http://blogs.msdn.com/rogeorge
    Thursday, May 28, 2009 3:07 PM

All replies

  • Hi LoadPerformer,

    Not exactly sure from the description what the problem/issue is? Does the cookie cause some kind of failure to occur in your tests? VSTS does automatically handle cookies, though there are cases where you might have to do some manipulation with the data in a cookie to get your test to run correctly.

    As for clearing the cookie value you can do that. You will need to create a webtest plugin to do that, but I am concerned that you may inadvertantly break your test.

    On the PostRequest event in either a WebTest Plugin (which will fire for all requests in your tests) or a WebTestRequest Plugin, which you attach to specific requests, have the following code. You need to specify the name of the cookie that you wish to have its value removed.

       void WebTest1Coded_PostRequest(object sender, PostRequestEventArgs e)
            {
                for (int i = 0; i < e.Response.Cookies.Count; i++)
                {
                    if (e.Response.Cookies[i].Name.Equals("YourCookieName", StringComparison.InvariantCultureIgnoreCase))
                    {
                        e.Response.Cookies[i].Value = string.Empty;
                    }
                }
             
            }



    http://blogs.msdn.com/rogeorge
    • Proposed as answer by Bill.Wang Monday, May 25, 2009 7:30 AM
    Thursday, May 21, 2009 2:28 PM
  • Hi,

    Thanks for your response, what you thought was correct, if i clear the cookie it breaks my request and test is getting failed.

    detailed description..
     

    I have record a script with valid user and password, once i record it, it generates a secured token which is in the form of a cookie which is very large and this cookie is also used in later part of the script.

    When i do the data binding of the user/ password, from the external source, and i can see that the user is getting picked up from the file but it is not able to login, i think there is something to do with the handling of the cookie as it is dynamic.

    If i record the script today and replay(iterations) its getting passed, i think it should fail  as this cookie is generated once.   

    I have implemented (Data binding) the same on different social networking sites and it’s working absolutely fine.

    Kindly advise how to proceed further.

     

    Monday, May 25, 2009 1:33 PM
  • Hi LoadPerformer,

    If the cookie is generated by the server dynamically when your user login completes then VSTS should handle the cookie for you automatically.

    That said, you may have a dependency on some client side script that executes in the browser normally that manipulates or uses that cookie data in some fashion. You would need to isolate how it is getting generated (server/client/both) and then duplicate the same mechanism in your test script if there is some client side script that normally does some processing. Keep in mind there is not an instance of Internet Explorer running in your test, you are working at the fundamental HTTP protocol layer. 
     

    Robert


    http://blogs.msdn.com/rogeorge
    Tuesday, May 26, 2009 7:38 PM
  • Hi Robert,

                  I am very much new to this tool and also to load testing arena, can you elaborate in detail, how do i isolate the cookie, so that i can implement(code).
    ie Every time i need to clear the cookie and capture the new cookie (secured token).

    Thanks in advance.
    Wednesday, May 27, 2009 7:12 AM
  • Hi LoadPerformer,

    The best advice I can give you is to work directly with the team who is developing / implementing the system you are trying to test. Have them explain and walk you through how the system works and show them how you are building the tests. You should be able to acheive a good result by collobarting with the developers this way, as it is very difficult to try to convey what to do over a web forum like this.

    I would also reccomend that you get the fiddler tool, and use it to help you decipher the conversation between the server and the browser. http://www.fiddler2.com/fiddler2/

    Robert


    http://blogs.msdn.com/rogeorge
    Thursday, May 28, 2009 3:07 PM