locked
Hidden field problem in VS2010 load test

    Question

  • Hi, I have a serious problem with hidden fields. I hev read all the necessary pages and other forum pages abut hidden fields and extraction rules but still I can not find a solution to my problem.

    In my web test record , I record a form page to ubdate a user's address,before that all virtual users sign in to web site successfully,

    When I finished my recording, I see that Visaul Studio 2010 makes an Extract Hidden Field with Extraction Rule for the form page. I see there is an extraction rule in GET request, and a hidden field form paramter as AddressId={{HIDDEN1.AddressId}}

    But the truth is that actually however there is no hidden field in the page et all! (as far as coder of the page told me)

    It only post addressId as a query string, which is also written on the link line on form page. By the way , the  ASP.NET is written with MVC.

    So, I gave recored form's link parameters from a database, I mean all virtual usrs addres ids given as a paramter

    but still some users get can pass the test. It gives this exception

    Exception WebTestException 165 Context parameter '$HIDDEN1.AddressId' not found in test context 

    Can anybody please help me on this issue ?

    Wednesday, August 10, 2011 1:03 PM

Answers

  • Hi, thanks for te links but Edglass 's page is an introduction one, and the other page which I have read before ,is one of the realy helpful sites about that error but does not solve my problem. I realy had hardtimes and headache with those hidden value problems in my test.

    Here is his experience and comments and mines

    "The built in Extract Hidden Fields rule does not know which fields it is extracting.  It just extracts all hidden fields on the page and puts them in the context."

    -Hey, what is menaing that hidden field does not know which field is extracting

    The reason is that the previous request was probably redirected to an error page but still returned an http status of 200 OK

    -why ? I dont know why he think th eprevious request was redirected to an error .. . So is this a redireciton problem ? Not sure.

    1)      I recorded my web test and now I am playing the web test back.  The first time I played the web test back it was successful.

    -No, even first playback is not succesful. I dont think the problem is with cookies. Mines are always error with hidden values.

    OK, here is my solution. This time I willl handle another scenerio, where my users logins, and tries to updatase his address.

    By the way,  I cant understand why any of the sites and blogs out tehere never mention about it but I think the problem is with VS test recorder. The default aciton of VS testing (2008 and 2010) has some wrong-action problems with form pages.

    First of all, the pages I am testing has no hidden values et al. I look in teh codes, there is no hidden tag.

    Secondly, as far as I undrstand, VS Test Recorder automaticaly tries to extract hidden values whenever it sees a page with a form, whether there are hidden values or not.

    First it puts Hidden Value Extraction Rule in GET requests of the pages that includes a form. (In my case this is login and address pages)

    And it polulates some hidden values in the POST request of login as returnUrl, and in the adrress page with the form, as WPPS, EVENTTARGET, EVENTARGUMENT, LASTFOCUS, VIEWSTATE, PREVIOUSSTATE in respective order.

    When I triy to run , it gives erros for hidden values, but If I unbind those hidden values, then no errors in test..

    Thirdly, if you uncheck "Automaticaly extract and bind hidden fields" in the Tools -> Optios -> Test Tools -> Web Test

    Does not put any extraction rule in GET request but again produces those parameters in the POST request but this time they are not equal to any hidden values, they look just as when you manuely unbind them.

    Finaly, this scenerio work with no error and headaches, and after test I manually check and users updated their address pages.

    So, as a result, here is my solution. Just remove automaticaly hidden field from tools, and happily live ever after!



    Thursday, August 11, 2011 1:14 PM

All replies

  • Hi Rastek,

     

    Make sure you review this information http://blogs.msdn.com/b/edglas/archive/2010/03/24/web-test-authoring-and-debugging-techniques-for-visual-studio-2010.aspx and this one before you proceed http://blogs.msdn.com/b/slumley/archive/2007/04/10/how-to-debug-a-web-test.aspx.

    The WebTest contains the extraction rules for the hidden fields, these were present when the recording took place. It then attempted to fix up your test by putting these values extracted at runtime into your subsequent requests with the context parameter syntax you outlined AddressId={{HIDDEN1.AddressId}}. In your case, it sounds like some tests are passing and some are failing. The ones that failed were not able to extract a value for the AddressID in the response, so when the test was run it tried to access the ((HIDDEN1.AddressId}} value but there was not one present. Debug why that happens and you will figure out the answer to your question.

    A couple suggestions, identify some of the logins/address ids that are failing, and confirm that those work manually in the browser, it could be as simple as you have some bad data. Next, the site you are suggesting could have some problem and its not responding correclty, or it is malformed HTML that is coming down - which could break the extraction rules. There could be other problems, maybe the users are not actually succeeding there Sign-In process. Point is that its hard to know, so thats why you have to do the research, debug through it and work to narrow this down to debug the real problem. Also, Make sure you put validation rules for all the request/responses leading up to the requests that fail, as that will help you to figure out what place things are really breaking. Also, some people find it easier to debug using the Fiddler tool to examine the chain of HTTP requests/responses.

    Hope that will help get you back on track,

    Robert


    http://blogs.msdn.com/rogeorge
    Wednesday, August 10, 2011 8:15 PM
  • Hello Rastek,

    I think Robert's sharing is useful.

    If have no helps, I think you could use Extract Form Field to instead of Extract Hidden Fields to have a try. For more information, see this thread How to use Extract Hidden Field.

    This is a FAQ which is collected by our engineers. see Web and Load Test FAQs. It told about helpful information about hidden field problem. Hope it helps.

    Thanks,

     


    Jack Zhai[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.



    Thursday, August 11, 2011 2:51 AM
  • Hi, thanks for te links but Edglass 's page is an introduction one, and the other page which I have read before ,is one of the realy helpful sites about that error but does not solve my problem. I realy had hardtimes and headache with those hidden value problems in my test.

    Here is his experience and comments and mines

    "The built in Extract Hidden Fields rule does not know which fields it is extracting.  It just extracts all hidden fields on the page and puts them in the context."

    -Hey, what is menaing that hidden field does not know which field is extracting

    The reason is that the previous request was probably redirected to an error page but still returned an http status of 200 OK

    -why ? I dont know why he think th eprevious request was redirected to an error .. . So is this a redireciton problem ? Not sure.

    1)      I recorded my web test and now I am playing the web test back.  The first time I played the web test back it was successful.

    -No, even first playback is not succesful. I dont think the problem is with cookies. Mines are always error with hidden values.

    OK, here is my solution. This time I willl handle another scenerio, where my users logins, and tries to updatase his address.

    By the way,  I cant understand why any of the sites and blogs out tehere never mention about it but I think the problem is with VS test recorder. The default aciton of VS testing (2008 and 2010) has some wrong-action problems with form pages.

    First of all, the pages I am testing has no hidden values et al. I look in teh codes, there is no hidden tag.

    Secondly, as far as I undrstand, VS Test Recorder automaticaly tries to extract hidden values whenever it sees a page with a form, whether there are hidden values or not.

    First it puts Hidden Value Extraction Rule in GET requests of the pages that includes a form. (In my case this is login and address pages)

    And it polulates some hidden values in the POST request of login as returnUrl, and in the adrress page with the form, as WPPS, EVENTTARGET, EVENTARGUMENT, LASTFOCUS, VIEWSTATE, PREVIOUSSTATE in respective order.

    When I triy to run , it gives erros for hidden values, but If I unbind those hidden values, then no errors in test..

    Thirdly, if you uncheck "Automaticaly extract and bind hidden fields" in the Tools -> Optios -> Test Tools -> Web Test

    Does not put any extraction rule in GET request but again produces those parameters in the POST request but this time they are not equal to any hidden values, they look just as when you manuely unbind them.

    Finaly, this scenerio work with no error and headaches, and after test I manually check and users updated their address pages.

    So, as a result, here is my solution. Just remove automaticaly hidden field from tools, and happily live ever after!



    Thursday, August 11, 2011 1:14 PM
  • Hello Rastek,

    Thanks for your sharing with us. I think more communicators will benefit from your solution. Have a happy day.

    Thanks, 


    Jack Zhai[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, August 12, 2011 2:08 AM
  • In that sceneria, AddressId is not a hidden value, it is just a query string, which can alo seen in the url of the page.

    When User want to change his adress, the web site  posts the request with necessary form paramters using users AddressId,

    I Also identified ids that are falling, and all they are working. Actulay they are prepared test users, no problem with the users.

    Another question why you think some request fail and I need to insert custom validaiton rules or sth.

    This is a plain, ASP.NET application and uses just ordinary tags, which VS must handle. No special tags inserted.The problem is why the recorder handles some parameters, and not handle some parameters. By the way same problems occurs both in ASP 2.0 aspx files, and in ASP 4.0 MVC version of the page.


    No matter, I solve it by not using automatic handling, but I wonder whether VS Test Recorder works correct or not.
    Friday, August 12, 2011 10:13 AM
  • Hello,

    it would be better if you open up a new thread for the new question. In this way, our discussion here will not deviate too much from the original issue. This will make answer searching in the forum easier and be beneficial to other community members as well. Thank you for your understanding.

    Thanks,


    Jack Zhai[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, August 15, 2011 3:08 AM