Answered by:
How to Extract Cookie Values and Get Values from Database

Question
-
I am Automating functional test cases for my asp.net application.
The home page of my site is a master page
My site also buit as 508 compliant
My site is not using any query string parameters at home page
An another page for my site is also deployed which shows the cookie valuesHow can I get all those cookie values and to get values from database table such as SessionId and ASP.NET Sesson_Code
1. When I just record my web test by clicking on Stop button from Web Test Recorder then Result Window shown as
Result Test Name project Error Message
Failed abc abc 1 primary requests and 0 dependant requests failed2. This recorded web test appears with this hierarchy
Web Test Name
Page URL as http://my site url/
Validation Rules (folder)
Response URLBut in fiddler many other requests for Images, CSS, JavaScript and User Control files shown
3. This site is added in Trusted Sites and Cookie values and passwords are exist
4. The home page has a redirect to another page5. When I run the test for the first time after recording then the test run appears as
Request HTTP Status
Top Request as URL http://my site url/ 302 Found
1st Child Request URL http://url/Authentication.aspx?URL=Defaut.aspx 302 Found
2nd Child Reqeust URL http://url/Defaut.aspx?GoToDefault=tru 200 Ok with a Red x in start
This child request has all other requests (which shown in Fiddler) with HTTP Status 200 Ok6. Again the Test Result shown as
Result Test Name project Error Message
Failed abc abc 1 primary requests and 0 dependant requests failedWednesday, September 9, 2009 9:03 AM
Answers
-
Hello,
About step 1 and 6:
Open the Web-test result in the Web-test result viewer. You can do this by double clicking the result in the Test Results window (or it is automatically shown if you launched the Web-test run from the web test editor).In the Web-test result viewer, you will see the requests that were submitted in the top pane. You will be able to see which requests succeded and failed. Select a request in the top pane... the bottom pane will show all the details about that request. You will be able to view the full HTTP request and full HTTP response for the failed request. Inspect the request URI that was submitted and verify that it is formed properly. If not, then inspect to Web-test to see why it is forming an invalid request URI.
About step 2:
Even though the recorder now captures all requests, some requests are still filtered when the web test is generated. First of all, “dependent” requests are filtered. Web Test has a feature to “Parse Dependent Links”, in which resources on a page such as images, java scripts sources, and css references are not recorded, but at run time the web test engine parses the response, finds all references to dependents, and then fetches them.
In general, we can wirte a web test request plug-in or create an extraction rule to extract cookie values. In the request plug-in, you can access to the related database to extract the value and have it binded to one context value.
For more detailed information, you can refer to the following articles:· Web Test Authoring and Debugging Techniques for VS 2008
· How to: Create a Request-Level Plug-In
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.- Proposed as answer by Edwer FangModerator Tuesday, September 15, 2009 3:19 AM
- Marked as answer by Edwer FangModerator Wednesday, September 16, 2009 2:03 AM
Thursday, September 10, 2009 7:00 AMModerator
All replies
-
I am Automating functional test cases for my asp.net application.
The home page of my site is a master page
My site also buit as 508 compliant
My site is not using any query string parameters at home page
An another page for my site is also deployed which shows the cookie valuesHow can I get all those cookie values and to get values from database table such as SessionId and ASP.NET Sesson_Code
Following are the steps
1. When I just record my web test by clicking on Stop button from Web Test Recorder then Result Window shown asResult Test Name project Error Message
Failed abc abc 1 primary requests and 0 dependant requests failed2. This recorded web test appears with this hierarchy
Web Test Name
Page URL as http://my site url/
Validation Rules (folder)
Response URLBut in fiddler many other requests for Images, CSS, JavaScript and User Control files shown
3. This site is added in Trusted Sites and Cookie values and passwords are exist
4. The home page has a redirect to another page5. When I run the test for the first time after recording then the test run appears as
Request HTTP Status
Top Request as URL http://my site url/ 302 Found
1st Child Request URL http://url/Authentication.aspx?URL=Defaut.aspx 302 Found
2nd Child Reqeust URL http://url/Defaut.aspx?GoToDefault=tru 200 Ok with a Red x in start
This child request has all other requests (which shown in Fiddler) with HTTP Status 200 Ok6. Again the Test Result shown as
Result Test Name project Error Message
Failed abc abc 1 primary requests and 0 dependant requests failed- Merged by Edwer FangModerator Thursday, September 10, 2009 2:20 AM
Wednesday, September 9, 2009 8:57 AM -
Hello,
About step 1 and 6:
Open the Web-test result in the Web-test result viewer. You can do this by double clicking the result in the Test Results window (or it is automatically shown if you launched the Web-test run from the web test editor).In the Web-test result viewer, you will see the requests that were submitted in the top pane. You will be able to see which requests succeded and failed. Select a request in the top pane... the bottom pane will show all the details about that request. You will be able to view the full HTTP request and full HTTP response for the failed request. Inspect the request URI that was submitted and verify that it is formed properly. If not, then inspect to Web-test to see why it is forming an invalid request URI.
About step 2:
Even though the recorder now captures all requests, some requests are still filtered when the web test is generated. First of all, “dependent” requests are filtered. Web Test has a feature to “Parse Dependent Links”, in which resources on a page such as images, java scripts sources, and css references are not recorded, but at run time the web test engine parses the response, finds all references to dependents, and then fetches them.
In general, we can wirte a web test request plug-in or create an extraction rule to extract cookie values. In the request plug-in, you can access to the related database to extract the value and have it binded to one context value.
For more detailed information, you can refer to the following articles:· Web Test Authoring and Debugging Techniques for VS 2008
· How to: Create a Request-Level Plug-In
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.- Proposed as answer by Edwer FangModerator Tuesday, September 15, 2009 3:19 AM
- Marked as answer by Edwer FangModerator Wednesday, September 16, 2009 2:03 AM
Thursday, September 10, 2009 7:00 AMModerator