Forum Discussion

exp1's avatar
exp1
Occasional Contributor
15 years ago

Managing Cookies

Hi,

I have a problem about managing cookies. I am working on a online shopping web site.

I want to run a test with 250 vuser, each logins with its unique mail address and password, and then they will do add to chart process on the site.

I took parameters from an access db file. Before recording the task, I checked to use real-time cookies in the options.



In the task I login and add an item to the basket. After running the test, when I check the website manually with some user from tha database I see that none of them added anything to their cart, instead, all items added to my chart, which is given during the task recording.

The Web-site I have been testing , saves cookies for a week. But even I delete cookies before and after every record, I ignore cookies in the browser.I set the browser configration "Everytime I visit the web page" , the situation doesnt change, just the user in the record phase works true.



The problem still continues. How can I handled this problem?
  • Hi Celalettin,



    If the users are supposed to be identified by cookies, it looks like a problem in the tested web application's authentication mechanism. However, there is also a small chance that the problem is caused by the fact that the problematic user's credentials are sent to the web server in some earlier requests (if some login operations which are not related to cookies have been performed earlier). To check whether this assumption is correct, please zip your entire project suite folder along with the log of the failed test execution and send us the archive via our Contact Support form. Make sure that messages in your log correspond to the latest version of your tests.
  • exp1's avatar
    exp1
    Occasional Contributor
    Hi Allen,

    We already posted the project suite to support(Via Rasim account). 

    I scanned the log files and noticed that the vusers mail and passwords event not written in the POST method of the Login.aspx page.

    I wonder whether if the real cause of the problem is this or not, I mean ableness to login vusers.





    This the the POST method of the vusers after running the test, takken from the srver log

    2011-01-08 12:56:09 POST /Login.aspx UserName=engin%2E78%5Fdemirci%40hotmail%2Ecom&PassWord=*****



    And this is from the server log file after manuely access within IE, not used Test Complete.(which is also the same int the task when I make record)

    2011-01-08 12:26:40 POST /Login.aspx - engin.78_demirci@hotmail.com ..........



    Why the vusers name and address written in hardcode during test ?

    And why there is no item in vusrs basket after running test ?



    I also tried to use hardcode names as parameters within the TestComplete and used in the access parameter database, still nothing changes !

    I wrote the POST method of the Login.aspx page as below within TestComplete task.

    POST /Login.aspx?ctl00%24PageContent2%24UserName=@UserName&ctl00%24PageContent2%24Password=@Password HTTP/1.1







    Thanks for advanced.



  • Hi Celalettin,





    Let's continue working on this problem in the support case created by Rasim.


  • exp1's avatar
    exp1
    Occasional Contributor
    Hi Allen,



    I found the problem.But I don't know how can I fix it.



    When I run test for login task with diferrent Vusers account(with parameter) they used which recorded the task account cookies.And cookies saved userId.



    This log header.



    POST /Login.aspx?ctl00%24PageContent2%24UserName=serap59860%40hotmail%2Ecom&ctl00%24PageContent2%24Password=***** HTTP/1.1

    Accept: image/jpeg, image/gif, image/pjpeg, application/x-ms-application, application/xaml+xml, application/x-ms-xbap, application/vnd.ms-excel, */*

    Accept-Encoding: gzip, deflate

    Accept-Language: en-US

    Cache-Control: no-cache

    Connection: Keep-Alive

    Content-Length: 372

    Content-Type: application/x-www-form-urlencoded

    Cookie: AC7.ASPXANONYMOUS=v-MTopmxywEkAAAAYmVlNTI3NDYtOGI1ZS00YzJlLWE1MjgtYmI2MWNhODJiMWY4fOjw5YiTc3szOuLB0t0VX4nCtDY1; HttpOnly; AC7.SESSIONID=r0bxzz55ea0suvb24bx0pz45; HttpOnly

    Host: www.trendyol.com:80

    Referer: http://www.trendyol.com/Login.aspx

    User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727)



    HTTP/1.1 302 Found

    Cache-Control: private

    Content-Type: text/html; charset=utf-8

    Location: /default.aspx

    Server: Microsoft-IIS/7.5

    X-AspNet-Version: 2.0.50727

    Set-Cookie: TY.Entrance=x=2481448&pp=xNNCAmR+YyNtmi2LNHeJnV+1jbc=&name=Celalettin; domain=webpage.com; expires=Mon, 17-Jan-2011 14:12:55 GMT; path=/

    Set-Cookie: AC7.ASPXAUTH=35D48DD8949FFA437AC1DEAF777B3C055DC22A7DC2F81EBE9A5DAD40963B4B13BEC27D410B7732036B777A5E8F661692C8AB48A9C39E0ECDD8D5172082C4F6E1607A66DEA5A03F5FDA251A3CC6619CD08444A2A03CA172EC78AC20F670967B0ECA47C8193CEE425080A5DA2EA6724199D84ED0A7CE78F9D5F0694358392066A4BF774B9DD5E7DD054E463F7D0761A5710EDEB150; path=/; HttpOnly

    X-Powered-By: ASP.NET

    Date: Mon, 10 Jan 2011 14:12:55 GMT

    Content-Length: 26063



    Set-Cookie: TY.Entrance=x=2481448 this userId when I recording of the task.



    And this is response header in the task.



    Set-Cookie:TY.Entrance=x=2481448&pp=xNNCAmR+YyNtmi2LNHeJnV+1jbc=&name=Celalettin; domain=webpage.com; expires=Mon, 17-Jan-2011 11:04:06 GMT; path=/

    This my UserId in the response tab.

    Therefore Vuser act like one user.



    I think the questions is "How can I parameterize userId."



    Becauser if I can parameterize userId.I can set userId for every Vuser.





    Best regards.

  • Hi Celalettin,





    TestComplete handles cookies automatically by default (recorded cookies are replaced with those generated by the server dynamically), so I suppose the problem is more related to the tested application's logic. I'm not sure how your application works, however I suppose here is what happens:

    1. When you login to the application for the first time (during recording), the server generates some cookie for your user session. 

    2. When you stop recording, the cookie is stored in your web browser and in your recorded traffic.

    3. If you did not log out after that, your user session remains active in the web application. I've noticed the following part in the server response: "expires=Mon, 17-Jan-2011 14:12:55". So, it looks like your session is supposed to remain active for about a week until you logout.

    4. When you play back the recorded test, TestComplete logs in the application with your credentials and gets the same cookie value because your user session is still active in the web application.





    So, I recommend that you do the following:

    1. Decrease the number of virtual users. Make the test work correctly with a single virtual user and then add just one more virtual user to check how different login information is handled. It will be much easier to debug your tests this way.

    2. Try logging out from your application manually and check whether the same cookie is returned from the web server on test playback after that. If my assumption is correct, the server should generate another cookie value for your account after logout.





    BTW, you can find more information on cookie handling in the "Managing Cookies" (http://www.automatedqa.com/support/viewarticle/12629/) help topic.


  • exp1's avatar
    exp1
    Occasional Contributor
    Hi Allen,



    I fixed my problem.



    Now I have good result for one Vuser.



    Thanks Anyway.
  • Could you please share information about the solution you found?  I am running into a similar issue.



    Thanks,

    Patrick
  • exp1's avatar
    exp1
    Occasional Contributor
    Hi,

    I have no idea how I was fixed this issue.But when I read other post.I think I parameterized userId and I handled this issue.

    First of all you must defining how your web site authentication is runing.Then you must choose a available auth mode on testcomplete then you need paramaterized web request.



    Another issue is how is ur web site is running for add an item to chart.If you are running website based on userId you need parameterized other request for dynamic userId.For add item to different userId.You need first of all know how is your website is running.Than you need create case about your website behavior.



    Thanks.