<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="/rss.xsl"?><rss version="2.0"><channel><title>ipfswebtest Wiki &amp; Documentation Rss Feed</title><link>http://www.codeplex.com/ipfswebtest/Wiki/View.aspx?title=Home</link><description>ipfswebtest Wiki Rss Description</description><item><title>New Comment on "IpfsWebtestAutoFixer"</title><link>http://ipfswebtest.codeplex.com/wikipage?title=IpfsWebtestAutoFixer&amp;ANCHOR#C17036</link><description>The dll for VS2010 does not work. I get &amp;#39;Operation not supported&amp;#39; errors when I reference the dll and attemp to open any extraction rule &amp;#63;</description><author>DSF</author><pubDate>Fri, 17 Sep 2010 05:03:10 GMT</pubDate><guid isPermaLink="false">New Comment on "IpfsWebtestAutoFixer" 20100917050310A</guid></item><item><title>Updated Wiki: Home</title><link>http://www.codeplex.com/ipfswebtest/Wiki/View.aspx?title=Home&amp;version=21</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
Writing a Visual Studio Web Test for InfoPath Forms Services 2007
&lt;/h1&gt;To write a Visual Studio web test for InfoPath Forms Services (IPFS), you must first understand some of IPFS’s architecture.  Before continuing, read the &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772323.aspx" class="externalLink"&gt;Forms Services Architecture article&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; on MSDN.  Pay close attention to the “Runtime Architecture” and “Rendering and Query Parameters” sections.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
InfoPath Forms Services HTTP Traffic
&lt;/h2&gt;When using an InfoPath form in the browser, a conversation between the browser and server occurs over HTTP.  This conversation consists of two kinds of transactions: Invocation and Postback.  Invocation occurs once when first opening the form.  After the form has been invoked, one or more postbacks to the server can occur.&lt;br /&gt;&lt;img src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32094" alt="IPFS HTTP traffic.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Invocation
&lt;/h2&gt;Invocation is the first transaction that occurs.  It loads all the resources that allow you to edit the form in the browser.  Invocation is started by making a GET request to FormServer.aspx.  (See How to: &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772417.aspx" class="externalLink"&gt;Use Query Parameters to Invoke Browser-Enabled InfoPath Forms&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; for more information on the format of this request).  The response includes the HTML of the form and some javascript for the form.  This request also causes requests for other dependent resources.  One of these dependent resources is core.js, which defines the core logic for form editing in the browser.&lt;br /&gt;&lt;img src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32095" alt="IPFS invocation.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Current Form Data
&lt;/h2&gt;In the browser, there is javascript running which defines several pieces of data.  In particular, there is an array named g_objCurrentFormData.  Data in this array will later be used to create a postback request.  There are three pieces of dynamic data that will be important when writing the web test: &lt;br /&gt;&lt;table&gt;
&lt;tr&gt;
&lt;th&gt; Data &lt;/th&gt;&lt;th&gt; Index of g_objCurrentFormData &lt;/th&gt;&lt;th&gt; Description &lt;/th&gt;&lt;th&gt; When does it change? &lt;/th&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Editing Session Id &lt;/td&gt;&lt;td&gt; 3 &lt;/td&gt;&lt;td&gt; Identifies your session with the server &lt;/td&gt;&lt;td&gt; When invoking a form &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Solution Id &lt;/td&gt;&lt;td&gt; 4 &lt;/td&gt;&lt;td&gt; Uniquely identifies the form template &lt;/td&gt;&lt;td&gt; When the form template has been updated &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Canary &lt;/td&gt;&lt;td&gt; 25 &lt;/td&gt;&lt;td&gt; Used for security mitigation &lt;/td&gt;&lt;td&gt; With every request/postback &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;(The indicies above assume you have installed Service Pack 1 on your server.  If you are using a pre-SP1 version the Canary will be at index 24.)&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Postback
&lt;/h2&gt;While you are interacting with a form in the browser, you may perform various actions such as typing in a text box or clicking a button.  These actions are recorded in an event log, using javascript.  When the form is submitted, or when logic must be performed on the server, the browser sends the event log to the server.  The server plays back the actions in the event log to recreate the state of the form.   Finally, the updated state of the form is returned to the browser and the browser refreshes its view of the data.  This transaction is known as a postback.  InfoPath has two types of postbacks - partial postback and full page postback.  A partial postback is a more efficent transaction because less data is transmitted.  However, some actions like view switching must use a full page postback.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Partial Postback
&lt;/h2&gt;When a partial postback occurs, the event log is sent to the server using a POST request to Postback.FormServer.aspx.  The body of the POST request contains the event log.  The response from the server contains javascript to evaluate on the browser, which updates its view of the data.&lt;br /&gt;&lt;img src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32096" alt="IPFS postback.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Full Page Postback
&lt;/h2&gt;When a full page postback occurs, the event log, along with some other data, is sent to the server using a POST request to FormServer.aspx.  The response from the server contains HTML and javascript to render the updated view of the data.&lt;br /&gt;&lt;img src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=40179" alt="IPFS full page postback.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Event Log
&lt;/h2&gt;The event log follows a specific format which is described below in &lt;a href="http://en.wikipedia.org/wiki/Backus-Naur_form" class="externalLink"&gt;BNF&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.  Note that the location of spaces is important.&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLog&amp;gt; ::= &amp;lt;EventLogInfo&amp;gt; ” “ &amp;lt;Events&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLogInfo&amp;gt; ::= &amp;lt;Data0&amp;gt; “;” &amp;lt;PostbackCounter&amp;gt; “;” &amp;lt;EditingSessionId&amp;gt; “;” &amp;lt;SolutionId&amp;gt; “;” &amp;lt;Data4&amp;gt; “;” &amp;lt;Data5&amp;gt; “;” &amp;lt;Data6&amp;gt; “;” &amp;lt;Data7&amp;gt; “;” &amp;lt;Data8&amp;gt; “;” &amp;lt;Data9&amp;gt; “;” &amp;lt;Data10&amp;gt; “;” &amp;lt;Data11&amp;gt; “;” &amp;lt;Data12&amp;gt; “;” &amp;lt;Data13&amp;gt; “;” &amp;lt;Data14&amp;gt; “;” &amp;lt;Data15&amp;gt; “;” &amp;lt;Data16&amp;gt; “;” &amp;lt;Data17&amp;gt; “;” &amp;lt;Canary&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;Events&amp;gt; ::= &amp;lt;Events&amp;gt; “ “ &amp;lt;Event&amp;gt; | &amp;lt;Event&amp;gt; “ “&lt;br /&gt; &lt;br /&gt;The event log consists of two main parts: EventLogInfo and Events.  EventLogInfo is simply a list of items separated by semicolons.  Events is a list of items separated by spaces.  Each item of Events represents an action that occurred while interacting with the form.&lt;br /&gt;As you can see, the three important pieces of information from g_objCurrentFormData are used in EventLogInfo.&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Editing Session Id is at index 2&lt;/li&gt;&lt;li&gt;Solution Id is at index 3&lt;/li&gt;&lt;li&gt;Canary is at index 18&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;There is another piece of EventLogInfo to point out.  At index 1 is the PostbackCounter.  This is an integer that starts at 0 and increments with each postback.&lt;br /&gt; &lt;br /&gt;An example event log follows.&lt;br /&gt;&lt;b&gt;Editing Session Id&lt;/b&gt; is bolded&lt;br /&gt;&lt;i&gt;Solution Id&lt;/i&gt; is italicized&lt;br /&gt;&lt;u&gt;Canary&lt;/u&gt; is underlined&lt;br /&gt; &lt;br /&gt;8;0;&lt;b&gt;3a41917c-bc1d-409b-904a-32fb82ce565b&lt;/b&gt;;&lt;i&gt;I:5fdfe5d2-fe2b-446f-9c70-504a30b3b40f:9285a025-812e-4c2f-a194-39edbec6c50a:633415556920000000&lt;/i&gt;;0;;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2F;http%3A%2F%2Fmyserver;http%3A%2F%2Fmyserver%2Fexample%2FForms%2FAllItems.aspx;1;1;0;10;0;633415558731245000;;&lt;u&gt;xKQi13p2GSqnFUzaSU7oMSRrhdC5spPCSnMbGWAd/kp95egDGTpq2vhVf/vz4ASFTrsYvuWQIj4G68gTruRruQ==|633415558731244855&lt;/u&gt; 0;V1_I1_T1;0;Type%20some%20text 14;;false;false &lt;br /&gt; &lt;br /&gt;&lt;h1&gt;
Putting the Pieces together in Visual Studio
&lt;/h1&gt;Now that we have a general idea how IPFS generates HTTP traffic, we can write a web test in Visual Studio.  Let’s recap the relevant IPFS architecture information:&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;IPFS has two main transactions when interacting with a form: Invocation and Postback&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are dynamic.  They will need to be extracted from responses.&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are used in the postback request.  Their values will need to be substituted in the postback body.&lt;/li&gt;&lt;li&gt;Editing Session Id and Solution Id do not change between postbacks.  They will only need to be extracted for the invocation request.&lt;/li&gt;&lt;li&gt;Canary changes after every postback.  It needs to be extracted for every request.&lt;/li&gt;
&lt;/ul&gt;We have all the required knowledge; we just need to put the pieces together.  The basic steps to write a web test for IPFS are:&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Capture HTTP requests using Fiddler or Visual Studio&lt;/li&gt;&lt;li&gt;Add the ExtractAndSubstituteDynamicInfoPathData web test plugin.  This plugin does all the hard work for us at runtime.  It identifies which responses are for InfoPath and extracts Current Form Data to a context parameter.  Then it identifies InfoPath postback requests and substitutes the dynamic pieces of data into the postback body.&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Capture HTTP requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start Visual Studio&lt;/li&gt;&lt;li&gt;Create a new web test&lt;/li&gt;&lt;li&gt;Start capturing using Visual Studios Web Test Recorder&lt;/li&gt;&lt;li&gt;Open an InfoPath form in a web browser &lt;img src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32091" alt="open form.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Perform the actions you want to happen in your test &lt;img src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32092" alt="perform actions in browser.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Click the stop button in the Web Test Recorder&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Add ExtractAndSubstituteDynamicInfoPathData web test plugin
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Add an InfoPathExtractionRules reference to the test project.  (You can download a dll for InfoPathExtractionRules from the &lt;a href="http://www.codeplex.com/ipfswebtest/Release/ProjectReleases.aspx" class="externalLink"&gt;Releases tab&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; of this project.  Or you can download the source code for the extraction rules and plugin on the &lt;a href="http://www.codeplex.com/ipfswebtest/SourceControl/ListDownloadableCommits.aspx" class="externalLink"&gt;Source Code tab&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.)&lt;/li&gt;&lt;li&gt;Add ExtractAndSubstituteDynamicInfoPathData web test plugin.  For the common usage of InfoPath, just leave the InvocationPath parameter blank.  When InvocationPath is blank, the plugin should use _layouts/FormServer.aspx at run time.  However, if your InfoPath form is in an XmlFormViewControl, you will need to specify the InvocationPath parameter to identify which requests act as an InfoPath invocation.  If a request url contains the InvocationPath string, then it is identified as an InfoPath request.&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt; &lt;br /&gt;The original technique for writing a web test with InfoPath involved individual extraction rules and manual steps with context parameters.  The instructions for that technique can be found on &lt;a href="http://www.codeplex.com/ipfswebtest/Wiki/View.aspx?title=Using%20the%20Individual%20Extraction%20Rules&amp;amp;referringTitle=Home"&gt;Using the Individual Extraction Rules&lt;/a&gt;.&lt;br /&gt;
&lt;/div&gt;</description><author>JBooze</author><pubDate>Tue, 18 Nov 2008 23:18:10 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20081118111810P</guid></item><item><title>Updated Wiki: Home</title><link>http://www.codeplex.com/ipfswebtest/Wiki/View.aspx?title=Home&amp;version=20</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
Writing a Visual Studio Web Test for InfoPath Forms Services 2007
&lt;/h1&gt;To write a Visual Studio web test for InfoPath Forms Services (IPFS), you must first understand some of IPFS’s architecture.  Before continuing, read the &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772323.aspx" class="externalLink"&gt;Forms Services Architecture article&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; on MSDN.  Pay close attention to the “Runtime Architecture” and “Rendering and Query Parameters” sections.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
InfoPath Forms Services HTTP Traffic
&lt;/h2&gt;When using an InfoPath form in the browser, a conversation between the browser and server occurs over HTTP.  This conversation consists of two kinds of transactions: Invocation and Postback.  Invocation occurs once when first opening the form.  After the form has been invoked, one or more postbacks to the server can occur.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32094" alt="IPFS HTTP traffic.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Invocation
&lt;/h2&gt;Invocation is the first transaction that occurs.  It loads all the resources that allow you to edit the form in the browser.  Invocation is started by making a GET request to FormServer.aspx.  (See How to: &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772417.aspx" class="externalLink"&gt;Use Query Parameters to Invoke Browser-Enabled InfoPath Forms&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; for more information on the format of this request).  The response includes the HTML of the form and some javascript for the form.  This request also causes requests for other dependent resources.  One of these dependent resources is core.js, which defines the core logic for form editing in the browser.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32095" alt="IPFS invocation.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Current Form Data
&lt;/h2&gt;In the browser, there is javascript running which defines several pieces of data.  In particular, there is an array named g_objCurrentFormData.  Data in this array will later be used to create a postback request.  There are three pieces of dynamic data that will be important when writing the web test: &lt;br /&gt;&lt;table&gt;
&lt;tr&gt;
&lt;th&gt; Data &lt;/th&gt;&lt;th&gt; Index of g_objCurrentFormData &lt;/th&gt;&lt;th&gt; Description &lt;/th&gt;&lt;th&gt; When does it change? &lt;/th&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Editing Session Id &lt;/td&gt;&lt;td&gt; 3 &lt;/td&gt;&lt;td&gt; Identifies your session with the server &lt;/td&gt;&lt;td&gt; When invoking a form &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Solution Id &lt;/td&gt;&lt;td&gt; 4 &lt;/td&gt;&lt;td&gt; Uniquely identifies the form template &lt;/td&gt;&lt;td&gt; When the form template has been updated &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Canary &lt;/td&gt;&lt;td&gt; 25 &lt;/td&gt;&lt;td&gt; Used for security mitigation &lt;/td&gt;&lt;td&gt; With every request/postback &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;(The indicies above assume you have installed Service Pack 1 on your server.  If you are using a pre-SP1 version the Canary will be at index 24.)&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Postback
&lt;/h2&gt;While you are interacting with a form in the browser, you may perform various actions such as typing in a text box or clicking a button.  These actions are recorded in an event log, using javascript.  When the form is submitted, or when logic must be performed on the server, the browser sends the event log to the server.  The server plays back the actions in the event log to recreate the state of the form.   Finally, the updated state of the form is returned to the browser and the browser refreshes its view of the data.  This transaction is known as a postback.  InfoPath has two types of postbacks - partial postback and full page postback.  A partial postback is a more efficent transaction because less data is transmitted.  However, some actions like view switching must use a full page postback.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Partial Postback
&lt;/h2&gt;When a partial postback occurs, the event log is sent to the server using a POST request to Postback.FormServer.aspx.  The body of the POST request contains the event log.  The response from the server contains javascript to evaluate on the browser, which updates its view of the data.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32096" alt="IPFS postback.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Full Page Postback
&lt;/h2&gt;When a full page postback occurs, the event log, along with some other data, is sent to the server using a POST request to FormServer.aspx.  The response from the server contains HTML and javascript to render the updated view of the data.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=33309" alt="IPFS full page postback.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Event Log
&lt;/h2&gt;The event log follows a specific format which is described below in &lt;a href="http://en.wikipedia.org/wiki/Backus-Naur_form" class="externalLink"&gt;BNF&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.  Note that the location of spaces is important.&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLog&amp;gt; ::= &amp;lt;EventLogInfo&amp;gt; ” “ &amp;lt;Events&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLogInfo&amp;gt; ::= &amp;lt;Data0&amp;gt; “;” &amp;lt;PostbackCounter&amp;gt; “;” &amp;lt;EditingSessionId&amp;gt; “;” &amp;lt;SolutionId&amp;gt; “;” &amp;lt;Data4&amp;gt; “;” &amp;lt;Data5&amp;gt; “;” &amp;lt;Data6&amp;gt; “;” &amp;lt;Data7&amp;gt; “;” &amp;lt;Data8&amp;gt; “;” &amp;lt;Data9&amp;gt; “;” &amp;lt;Data10&amp;gt; “;” &amp;lt;Data11&amp;gt; “;” &amp;lt;Data12&amp;gt; “;” &amp;lt;Data13&amp;gt; “;” &amp;lt;Data14&amp;gt; “;” &amp;lt;Data15&amp;gt; “;” &amp;lt;Data16&amp;gt; “;” &amp;lt;Data17&amp;gt; “;” &amp;lt;Canary&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;Events&amp;gt; ::= &amp;lt;Events&amp;gt; “ “ &amp;lt;Event&amp;gt; | &amp;lt;Event&amp;gt; “ “&lt;br /&gt; &lt;br /&gt;The event log consists of two main parts: EventLogInfo and Events.  EventLogInfo is simply a list of items separated by semicolons.  Events is a list of items separated by spaces.  Each item of Events represents an action that occurred while interacting with the form.&lt;br /&gt;As you can see, the three important pieces of information from g_objCurrentFormData are used in EventLogInfo.&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Editing Session Id is at index 2&lt;/li&gt;&lt;li&gt;Solution Id is at index 3&lt;/li&gt;&lt;li&gt;Canary is at index 18&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;There is another piece of EventLogInfo to point out.  At index 1 is the PostbackCounter.  This is an integer that starts at 0 and increments with each postback.&lt;br /&gt; &lt;br /&gt;An example event log follows.&lt;br /&gt;&lt;b&gt;Editing Session Id&lt;/b&gt; is bolded&lt;br /&gt;&lt;i&gt;Solution Id&lt;/i&gt; is italicized&lt;br /&gt;&lt;u&gt;Canary&lt;/u&gt; is underlined&lt;br /&gt; &lt;br /&gt;8;0;&lt;b&gt;3a41917c-bc1d-409b-904a-32fb82ce565b&lt;/b&gt;;&lt;i&gt;I:5fdfe5d2-fe2b-446f-9c70-504a30b3b40f:9285a025-812e-4c2f-a194-39edbec6c50a:633415556920000000&lt;/i&gt;;0;;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2F;http%3A%2F%2Fmyserver;http%3A%2F%2Fmyserver%2Fexample%2FForms%2FAllItems.aspx;1;1;0;10;0;633415558731245000;;&lt;u&gt;xKQi13p2GSqnFUzaSU7oMSRrhdC5spPCSnMbGWAd/kp95egDGTpq2vhVf/vz4ASFTrsYvuWQIj4G68gTruRruQ==|633415558731244855&lt;/u&gt; 0;V1_I1_T1;0;Type%20some%20text 14;;false;false &lt;br /&gt; &lt;br /&gt;&lt;h1&gt;
Putting the Pieces together in Visual Studio
&lt;/h1&gt;Now that we have a general idea how IPFS generates HTTP traffic, we can write a web test in Visual Studio.  Let’s recap the relevant IPFS architecture information:&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;IPFS has two main transactions when interacting with a form: Invocation and Postback&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are dynamic.  They will need to be extracted from responses.&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are used in the postback request.  Their values will need to be substituted in the postback body.&lt;/li&gt;&lt;li&gt;Editing Session Id and Solution Id do not change between postbacks.  They will only need to be extracted for the invocation request.&lt;/li&gt;&lt;li&gt;Canary changes after every postback.  It needs to be extracted for every request.&lt;/li&gt;
&lt;/ul&gt;We have all the required knowledge; we just need to put the pieces together.  The basic steps to write a web test for IPFS are:&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Capture HTTP requests using Fiddler or Visual Studio&lt;/li&gt;&lt;li&gt;Add the ExtractAndSubstituteDynamicInfoPathData web test plugin.  This plugin does all the hard work for us at runtime.  It identifies which responses are for InfoPath and extracts Current Form Data to a context parameter.  Then it identifies InfoPath postback requests and substitutes the dynamic pieces of data into the postback body.&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Capture HTTP requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start Visual Studio&lt;/li&gt;&lt;li&gt;Create a new web test&lt;/li&gt;&lt;li&gt;Start capturing using Visual Studios Web Test Recorder&lt;/li&gt;&lt;li&gt;Open an InfoPath form in a web browser &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32091" alt="open form.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Perform the actions you want to happen in your test &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32092" alt="perform actions in browser.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Click the stop button in the Web Test Recorder&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Add ExtractAndSubstituteDynamicInfoPathData web test plugin
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Add an InfoPathExtractionRules reference to the test project.  (You can download a dll for InfoPathExtractionRules from the &lt;a href="http://www.codeplex.com/ipfswebtest/Release/ProjectReleases.aspx" class="externalLink"&gt;Releases tab&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; of this project.  Or you can download the source code for the extraction rules and plugin on the &lt;a href="http://www.codeplex.com/ipfswebtest/SourceControl/ListDownloadableCommits.aspx" class="externalLink"&gt;Source Code tab&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.)&lt;/li&gt;&lt;li&gt;Add ExtractAndSubstituteDynamicInfoPathData web test plugin.  If your InfoPath form is in an XmlFormViewControl, use the InvocationPath parameter to identify which requests are for InfoPath.  If a request url contains the InvocationPath string, then it is identified as an InfoPath request.&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt; &lt;br /&gt;The original technique for writing a web test with InfoPath involved individual extraction rules and manual steps with context parameters.  The instructions for that technique can be found on &lt;a href="http://www.codeplex.com/ipfswebtest/Wiki/View.aspx?title=Using%20the%20Individual%20Extraction%20Rules&amp;amp;referringTitle=Home"&gt;Using the Individual Extraction Rules&lt;/a&gt;.&lt;br /&gt;
&lt;/div&gt;</description><author>JBooze</author><pubDate>Thu, 24 Jul 2008 22:49:26 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20080724104926P</guid></item><item><title>Updated Wiki: Home</title><link>http://www.codeplex.com/ipfswebtest/Wiki/View.aspx?title=Home&amp;version=19</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
Writing a Visual Studio Web Test for InfoPath Forms Services 2007
&lt;/h1&gt;To write a Visual Studio web test for InfoPath Forms Services (IPFS), you must first understand some of IPFS’s architecture.  Before continuing, read the &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772323.aspx" class="externalLink"&gt;Forms Services Architecture article&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; on MSDN.  Pay close attention to the “Runtime Architecture” and “Rendering and Query Parameters” sections.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
InfoPath Forms Services HTTP Traffic
&lt;/h2&gt;When using an InfoPath form in the browser, a conversation between the browser and server occurs over HTTP.  This conversation consists of two kinds of transactions: Invocation and Postback.  Invocation occurs once when first opening the form.  After the form has been invoked, one or more postbacks to the server can occur.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32094" alt="IPFS HTTP traffic.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Invocation
&lt;/h2&gt;Invocation is the first transaction that occurs.  It loads all the resources that allow you to edit the form in the browser.  Invocation is started by making a GET request to FormServer.aspx.  (See How to: &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772417.aspx" class="externalLink"&gt;Use Query Parameters to Invoke Browser-Enabled InfoPath Forms&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; for more information on the format of this request).  The response includes the HTML of the form and some javascript for the form.  This request also causes requests for other dependent resources.  One of these dependent resources is core.js, which defines the core logic for form editing in the browser.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32095" alt="IPFS invocation.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Current Form Data
&lt;/h2&gt;In the browser, there is javascript running which defines several pieces of data.  In particular, there is an array named g_objCurrentFormData.  Data in this array will later be used to create a postback request.  There are three pieces of dynamic data that will be important when writing the web test: &lt;br /&gt;&lt;table&gt;
&lt;tr&gt;
&lt;th&gt; Data &lt;/th&gt;&lt;th&gt; Index of g_objCurrentFormData &lt;/th&gt;&lt;th&gt; Description &lt;/th&gt;&lt;th&gt; When does it change? &lt;/th&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Editing Session Id &lt;/td&gt;&lt;td&gt; 3 &lt;/td&gt;&lt;td&gt; Identifies your session with the server &lt;/td&gt;&lt;td&gt; When invoking a form &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Solution Id &lt;/td&gt;&lt;td&gt; 4 &lt;/td&gt;&lt;td&gt; Uniquely identifies the form template &lt;/td&gt;&lt;td&gt; When the form template has been updated &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Canary &lt;/td&gt;&lt;td&gt; 25 &lt;/td&gt;&lt;td&gt; Used for security mitigation &lt;/td&gt;&lt;td&gt; With every request/postback &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;(The indicies above assume you have installed Service Pack 1 on your server.  If you are using a pre-SP1 version the Canary will be at index 24.)&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Postback
&lt;/h2&gt;While you are interacting with a form in the browser, you may perform various actions such as typing in a text box or clicking a button.  These actions are recorded in an event log, using javascript.  When the form is submitted, or when logic must be performed on the server, the browser sends the event log to the server.  The server plays back the actions in the event log to recreate the state of the form.   Finally, the updated state of the form is returned to the browser and the browser refreshes its view of the data.  This transaction is known as a postback.  InfoPath has two types of postbacks - partial postback and full page postback.  A partial postback is a more efficent transaction because less data is transmitted.  However, some actions like view switching must use a full page postback.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Partial Postback
&lt;/h2&gt;When a partial postback occurs, the event log is sent to the server using a POST request to Postback.FormServer.aspx.  The body of the POST request contains the event log.  The response from the server contains javascript to evaluate on the browser, which updates its view of the data.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32096" alt="IPFS postback.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Full Page Postback
&lt;/h2&gt;When a full page postback occurs, the event log, along with some other data, is sent to the server using a POST request to FormServer.aspx.  The response from the server contains HTML and javascript to render the updated view of the data.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=33309" alt="IPFS full page postback.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Event Log
&lt;/h2&gt;The event log follows a specific format which is described below in &lt;a href="http://en.wikipedia.org/wiki/Backus-Naur_form" class="externalLink"&gt;BNF&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.  Note that the location of spaces is important.&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLog&amp;gt; ::= &amp;lt;EventLogInfo&amp;gt; ” “ &amp;lt;Events&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLogInfo&amp;gt; ::= &amp;lt;Data0&amp;gt; “;” &amp;lt;PostbackCounter&amp;gt; “;” &amp;lt;EditingSessionId&amp;gt; “;” &amp;lt;SolutionId&amp;gt; “;” &amp;lt;Data4&amp;gt; “;” &amp;lt;Data5&amp;gt; “;” &amp;lt;Data6&amp;gt; “;” &amp;lt;Data7&amp;gt; “;” &amp;lt;Data8&amp;gt; “;” &amp;lt;Data9&amp;gt; “;” &amp;lt;Data10&amp;gt; “;” &amp;lt;Data11&amp;gt; “;” &amp;lt;Data12&amp;gt; “;” &amp;lt;Data13&amp;gt; “;” &amp;lt;Data14&amp;gt; “;” &amp;lt;Data15&amp;gt; “;” &amp;lt;Data16&amp;gt; “;” &amp;lt;Data17&amp;gt; “;” &amp;lt;Canary&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;Events&amp;gt; ::= &amp;lt;Events&amp;gt; “ “ &amp;lt;Event&amp;gt; | &amp;lt;Event&amp;gt; “ “&lt;br /&gt; &lt;br /&gt;The event log consists of two main parts: EventLogInfo and Events.  EventLogInfo is simply a list of items separated by semicolons.  Events is a list of items separated by spaces.  Each item of Events represents an action that occurred while interacting with the form.&lt;br /&gt;As you can see, the three important pieces of information from g_objCurrentFormData are used in EventLogInfo.&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Editing Session Id is at index 2&lt;/li&gt;&lt;li&gt;Solution Id is at index 3&lt;/li&gt;&lt;li&gt;Canary is at index 18&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;There is another piece of EventLogInfo to point out.  At index 1 is the PostbackCounter.  This is an integer that starts at 0 and increments with each postback.&lt;br /&gt; &lt;br /&gt;An example event log follows.&lt;br /&gt;&lt;b&gt;Editing Session Id&lt;/b&gt; is bolded&lt;br /&gt;&lt;i&gt;Solution Id&lt;/i&gt; is italicized&lt;br /&gt;&lt;u&gt;Canary&lt;/u&gt; is underlined&lt;br /&gt; &lt;br /&gt;8;0;&lt;b&gt;3a41917c-bc1d-409b-904a-32fb82ce565b&lt;/b&gt;;&lt;i&gt;I:5fdfe5d2-fe2b-446f-9c70-504a30b3b40f:9285a025-812e-4c2f-a194-39edbec6c50a:633415556920000000&lt;/i&gt;;0;;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2F;http%3A%2F%2Fmyserver;http%3A%2F%2Fmyserver%2Fexample%2FForms%2FAllItems.aspx;1;1;0;10;0;633415558731245000;;&lt;u&gt;xKQi13p2GSqnFUzaSU7oMSRrhdC5spPCSnMbGWAd/kp95egDGTpq2vhVf/vz4ASFTrsYvuWQIj4G68gTruRruQ==|633415558731244855&lt;/u&gt; 0;V1_I1_T1;0;Type%20some%20text 14;;false;false &lt;br /&gt; &lt;br /&gt;&lt;h1&gt;
Putting the Pieces together in Visual Studio
&lt;/h1&gt;Now that we have a general idea how IPFS generates HTTP traffic, we can write a web test in Visual Studio.  Let’s recap the relevant IPFS architecture information:&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;IPFS has two main transactions when interacting with a form: Invocation and Postback&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are dynamic.  They will need to be extracted from responses.&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are used in the postback request.  Their values will need to be substituted in the postback body.&lt;/li&gt;&lt;li&gt;Editing Session Id and Solution Id do not change between postbacks.  They will only need to be extracted for the invocation request.&lt;/li&gt;&lt;li&gt;Canary changes after every postback.  It needs to be extracted for every request.&lt;/li&gt;
&lt;/ul&gt;We have all the required knowledge; we just need to put the pieces together.  The basic steps to write a web test for IPFS are:&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Capture HTTP requests using Fiddler or Visual Studio&lt;/li&gt;&lt;li&gt;Add the ExtractAndSubstituteDynamicInfoPathData web test plugin.  This plugin does all the hard work for us at runtime.  It identifies which responses are for InfoPath and extracts Current Form Data to a context parameter.  Then it identifies InfoPath postback requests and substitutes the dynamic pieces of data into the postback body.&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Capture HTTP requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start Visual Studio&lt;/li&gt;&lt;li&gt;Create a new web test&lt;/li&gt;&lt;li&gt;Start capturing using Visual Studios Web Test Recorder&lt;/li&gt;&lt;li&gt;Open an InfoPath form in a web browser &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32091" alt="open form.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Perform the actions you want to happen in your test &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32092" alt="perform actions in browser.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Click the stop button&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Add ExtractAndSubstituteDynamicInfoPathData web test plugin
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Add an InfoPathExtractionRules reference to the test project.  (You can download a dll for InfoPathExtractionRules from the &lt;a href="http://www.codeplex.com/ipfswebtest/Release/ProjectReleases.aspx" class="externalLink"&gt;Releases tab&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; of this project.  Or you can download the source code for the extraction rules and plugin on the &lt;a href="http://www.codeplex.com/ipfswebtest/SourceControl/ListDownloadableCommits.aspx" class="externalLink"&gt;Source Code tab&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.)&lt;/li&gt;&lt;li&gt;Add ExtractAndSubstituteDynamicInfoPathData web test plugin.  If your InfoPath form is in an XmlFormViewControl, use the InvocationPath parameter to identify which requests are for InfoPath.  If a request url contains the InvocationPath string, then it is identified as an InfoPath request.&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt; &lt;br /&gt;The original technique for writing a web test with InfoPath involved individual extraction rules and manual steps with context parameters.  The instructions for that technique can be found on &lt;a href="http://www.codeplex.com/ipfswebtest/Wiki/View.aspx?title=Using%20the%20Individual%20Extraction%20Rules&amp;amp;referringTitle=Home"&gt;Using the Individual Extraction Rules&lt;/a&gt;.&lt;br /&gt;
&lt;/div&gt;</description><author>JBooze</author><pubDate>Thu, 24 Jul 2008 22:41:37 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20080724104137P</guid></item><item><title>Updated Wiki: Using the Individual Extraction Rules</title><link>http://www.codeplex.com/ipfswebtest/Wiki/View.aspx?title=Using the Individual Extraction Rules&amp;version=1</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
Putting the Pieces together in Visual Studio
&lt;/h1&gt;Now that we have a general idea how IPFS generates HTTP traffic, we can write a web test in Visual Studio.  Let’s recap the relevant IPFS architecture information:&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;IPFS has two main transactions when interacting with a form: Invocation and Postback&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are dynamic.  They will need to be extracted from responses.&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are used in the postback request.  Their values will need to be substituted in the postback body.&lt;/li&gt;&lt;li&gt;Editing Session Id and Solution Id do not change between postbacks.  They will only need to be extracted for the invocation request.&lt;/li&gt;&lt;li&gt;Canary changes after every postback.  It needs to be extracted for every request.&lt;/li&gt;
&lt;/ul&gt;We have all the required knowledge; we just need to put the pieces together.  The basic steps to write a web test for IPFS are:&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Use &lt;a href="http://www.fiddlertool.com/fiddler/" class="externalLink"&gt;Fiddler&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; to capture HTTP requests&lt;/li&gt;&lt;li&gt;Use the captured information to define requests in a web test&lt;/li&gt;&lt;li&gt;Add Extraction Rules to the invocation request&lt;/li&gt;&lt;li&gt;Substitute context variables in the postback bodys&lt;/li&gt;&lt;li&gt;Add an Extraction Rule to the postback requests&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use Fiddler to capture HTTP requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start &lt;a href="http://www.fiddlertool.com/fiddler/" class="externalLink"&gt;Fiddler&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; &lt;span class="unresolved"&gt;Cannot resolve link: &lt;/span&gt;[image:start fiddler.jpg]&lt;/li&gt;&lt;li&gt;Start capturing&lt;/li&gt;&lt;li&gt;Open an InfoPath form in a web browser &lt;span class="unresolved"&gt;Cannot resolve link: &lt;/span&gt;[image:open form.jpg]&lt;/li&gt;&lt;li&gt;Perform the actions you want to happen in your test &lt;span class="unresolved"&gt;Cannot resolve link: &lt;/span&gt;[image:perform actions in browser.jpg]&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use the captured information to define requests in a web test
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start Visual Studio&lt;/li&gt;&lt;li&gt;Create a new web test&lt;/li&gt;&lt;li&gt;Add an InfoPathExtractionRules reference to the test project.  (You can download a dll for InfoPathExtractionRules from the Releases tab of this project.  Or you can download the source code for those rules on the Source Code tab.)&lt;/li&gt;&lt;li&gt;From the fiddler capture, find the GET request for /_layouts/FormServer.aspx &lt;span class="unresolved"&gt;Cannot resolve link: &lt;/span&gt;[image:fiddler invocation selected.jpg]&lt;/li&gt;&lt;li&gt;Add that request to the web test &lt;span class="unresolved"&gt;Cannot resolve link: &lt;/span&gt;[image:create invocation request.jpg]&lt;/li&gt;&lt;li&gt;Find the postbacks which are POST requests for /_layouts/Postback.FormServer.aspx or /_layouts/FormServer.aspx &lt;span class="unresolved"&gt;Cannot resolve link: &lt;/span&gt;[image:fiddler postback selected.jpg]&lt;/li&gt;&lt;li&gt;Add those postback requests to the web test as web service requests.  Be sure to copy the postback body.  The eventlog string should end with a single space.  Double check that the event log you copied to the webtest ends with a single space as this is a common mistake. &lt;span class="unresolved"&gt;Cannot resolve link: &lt;/span&gt;[image:create postback request.jpg]&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Add Extraction Rules to the invocation request
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find the first request for /_layouts/FormServer.aspx&lt;/li&gt;&lt;li&gt;Add ExtractEditingSessionId, ExtractSolutionId, and ExtractInitialCanary extraction rules&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Substitute context variables in the postback bodys
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find the postback requests&lt;/li&gt;&lt;li&gt;In its string body, find the event log&lt;/li&gt;&lt;ol&gt;
&lt;li&gt;For partial postbacks, the event log will be the only data in the string body&lt;/li&gt;&lt;li&gt;For full page postbacks, the text __EventLog should precede the section containing the event log&lt;/li&gt;
&lt;/ol&gt;&lt;li&gt;Edit the EventLogInfo of the postback body as follows:&lt;/li&gt;&lt;ol&gt;
&lt;li&gt;Replace the 3rd item with {{editingSessionId}}&lt;/li&gt;&lt;li&gt;Replace the 4th item with {{solutionId}}&lt;/li&gt;&lt;li&gt;Replace the 19th item with {{canary}}&lt;/li&gt;
&lt;/ol&gt;
&lt;/ol&gt;&lt;span class="unresolved"&gt;Cannot resolve link: &lt;/span&gt;[image:postback substitute.jpg]&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Add an Extraction Rule to the postback requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find the postback requests&lt;/li&gt;&lt;li&gt;Add ExtractPostbackCanary extraction rule to each of these requests&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;Once you have followed these steps, your web test should resemble the following picture.&lt;br /&gt;&lt;span class="unresolved"&gt;Cannot resolve link: &lt;/span&gt;[image:complete webtest.jpg]&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
IpfsWebtestAutoFixer Tool
&lt;/h2&gt;&lt;a href="http://www.codeplex.com/ipfswebtest/Wiki/View.aspx?title=IpfsWebtestAutoFixer&amp;amp;referringTitle=Using%20the%20Individual%20Extraction%20Rules"&gt;IpfsWebtestAutoFixer&lt;/a&gt; is tool which makes creating an InfoPath web test much easier. It automatically adds the appropriate extraction rules to the invocation request and postback requests. It also automatically substitutes context parameters in postback bodys.&lt;br /&gt;
&lt;/div&gt;</description><author>JBooze</author><pubDate>Thu, 24 Jul 2008 20:39:45 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Using the Individual Extraction Rules 20080724083945P</guid></item><item><title>Updated Wiki: Home</title><link>http://www.codeplex.com/ipfswebtest/Wiki/View.aspx?title=Home&amp;version=18</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
Writing a Visual Studio Web Test for InfoPath Forms Services 2007
&lt;/h1&gt;To write a Visual Studio web test for InfoPath Forms Services (IPFS), you must first understand some of IPFS’s architecture.  Before continuing, read the &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772323.aspx" class="externalLink"&gt;Forms Services Architecture article&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; on MSDN.  Pay close attention to the “Runtime Architecture” and “Rendering and Query Parameters” sections.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
InfoPath Forms Services HTTP Traffic
&lt;/h2&gt;When using an InfoPath form in the browser, a conversation between the browser and server occurs over HTTP.  This conversation consists of two kinds of transactions: Invocation and Postback.  Invocation occurs once when first opening the form.  After the form has been invoked, one or more postbacks to the server can occur.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32094" alt="IPFS HTTP traffic.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Invocation
&lt;/h2&gt;Invocation is the first transaction that occurs.  It loads all the resources that allow you to edit the form in the browser.  Invocation is started by making a GET request to FormServer.aspx.  (See How to: &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772417.aspx" class="externalLink"&gt;Use Query Parameters to Invoke Browser-Enabled InfoPath Forms&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; for more information on the format of this request).  The response includes the HTML of the form and some javascript for the form.  This request also causes requests for other dependent resources.  One of these dependent resources is core.js, which defines the core logic for form editing in the browser.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32095" alt="IPFS invocation.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Current Form Data
&lt;/h2&gt;In the browser, there is javascript running which defines several pieces of data.  In particular, there is an array named g_objCurrentFormData.  Data in this array will later be used to create a postback request.  There are three pieces of dynamic data that will be important when writing the web test: &lt;br /&gt;&lt;table&gt;
&lt;tr&gt;
&lt;th&gt; Data &lt;/th&gt;&lt;th&gt; Index of g_objCurrentFormData &lt;/th&gt;&lt;th&gt; Description &lt;/th&gt;&lt;th&gt; When does it change? &lt;/th&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Editing Session Id &lt;/td&gt;&lt;td&gt; 3 &lt;/td&gt;&lt;td&gt; Identifies your session with the server &lt;/td&gt;&lt;td&gt; When invoking a form &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Solution Id &lt;/td&gt;&lt;td&gt; 4 &lt;/td&gt;&lt;td&gt; Uniquely identifies the form template &lt;/td&gt;&lt;td&gt; When the form template has been updated &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Canary &lt;/td&gt;&lt;td&gt; 25 &lt;/td&gt;&lt;td&gt; Used for security mitigation &lt;/td&gt;&lt;td&gt; With every request/postback &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;(The indicies above assume you have installed Service Pack 1 on your server.  If you are using a pre-SP1 version the Canary will be at index 24.)&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Postback
&lt;/h2&gt;While you are interacting with a form in the browser, you may perform various actions such as typing in a text box or clicking a button.  These actions are recorded in an event log, using javascript.  When the form is submitted, or when logic must be performed on the server, the browser sends the event log to the server.  The server plays back the actions in the event log to recreate the state of the form.   Finally, the updated state of the form is returned to the browser and the browser refreshes its view of the data.  This transaction is known as a postback.  InfoPath has two types of postbacks - partial postback and full page postback.  A partial postback is a more efficent transaction because less data is transmitted.  However, some actions like view switching must use a full page postback.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Partial Postback
&lt;/h2&gt;When a partial postback occurs, the event log is sent to the server using a POST request to Postback.FormServer.aspx.  The body of the POST request contains the event log.  The response from the server contains javascript to evaluate on the browser, which updates its view of the data.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32096" alt="IPFS postback.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Full Page Postback
&lt;/h2&gt;When a full page postback occurs, the event log, along with some other data, is sent to the server using a POST request to FormServer.aspx.  The response from the server contains HTML and javascript to render the updated view of the data.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=33309" alt="IPFS full page postback.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Event Log
&lt;/h2&gt;The event log follows a specific format which is described below in &lt;a href="http://en.wikipedia.org/wiki/Backus-Naur_form" class="externalLink"&gt;BNF&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.  Note that the location of spaces is important.&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLog&amp;gt; ::= &amp;lt;EventLogInfo&amp;gt; ” “ &amp;lt;Events&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLogInfo&amp;gt; ::= &amp;lt;Data0&amp;gt; “;” &amp;lt;PostbackCounter&amp;gt; “;” &amp;lt;EditingSessionId&amp;gt; “;” &amp;lt;SolutionId&amp;gt; “;” &amp;lt;Data4&amp;gt; “;” &amp;lt;Data5&amp;gt; “;” &amp;lt;Data6&amp;gt; “;” &amp;lt;Data7&amp;gt; “;” &amp;lt;Data8&amp;gt; “;” &amp;lt;Data9&amp;gt; “;” &amp;lt;Data10&amp;gt; “;” &amp;lt;Data11&amp;gt; “;” &amp;lt;Data12&amp;gt; “;” &amp;lt;Data13&amp;gt; “;” &amp;lt;Data14&amp;gt; “;” &amp;lt;Data15&amp;gt; “;” &amp;lt;Data16&amp;gt; “;” &amp;lt;Data17&amp;gt; “;” &amp;lt;Canary&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;Events&amp;gt; ::= &amp;lt;Events&amp;gt; “ “ &amp;lt;Event&amp;gt; | &amp;lt;Event&amp;gt; “ “&lt;br /&gt; &lt;br /&gt;The event log consists of two main parts: EventLogInfo and Events.  EventLogInfo is simply a list of items separated by semicolons.  Events is a list of items separated by spaces.  Each item of Events represents an action that occurred while interacting with the form.&lt;br /&gt;As you can see, the three important pieces of information from g_objCurrentFormData are used in EventLogInfo.&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Editing Session Id is at index 2&lt;/li&gt;&lt;li&gt;Solution Id is at index 3&lt;/li&gt;&lt;li&gt;Canary is at index 18&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;There is another piece of EventLogInfo to point out.  At index 1 is the PostbackCounter.  This is an integer that starts at 0 and increments with each postback.&lt;br /&gt; &lt;br /&gt;An example event log follows.&lt;br /&gt;&lt;b&gt;Editing Session Id&lt;/b&gt; is bolded&lt;br /&gt;&lt;i&gt;Solution Id&lt;/i&gt; is italicized&lt;br /&gt;&lt;u&gt;Canary&lt;/u&gt; is underlined&lt;br /&gt; &lt;br /&gt;8;0;&lt;b&gt;3a41917c-bc1d-409b-904a-32fb82ce565b&lt;/b&gt;;&lt;i&gt;I:5fdfe5d2-fe2b-446f-9c70-504a30b3b40f:9285a025-812e-4c2f-a194-39edbec6c50a:633415556920000000&lt;/i&gt;;0;;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2F;http%3A%2F%2Fmyserver;http%3A%2F%2Fmyserver%2Fexample%2FForms%2FAllItems.aspx;1;1;0;10;0;633415558731245000;;&lt;u&gt;xKQi13p2GSqnFUzaSU7oMSRrhdC5spPCSnMbGWAd/kp95egDGTpq2vhVf/vz4ASFTrsYvuWQIj4G68gTruRruQ==|633415558731244855&lt;/u&gt; 0;V1_I1_T1;0;Type%20some%20text 14;;false;false &lt;br /&gt; &lt;br /&gt;&lt;h1&gt;
Putting the Pieces together in Visual Studio
&lt;/h1&gt;Now that we have a general idea how IPFS generates HTTP traffic, we can write a web test in Visual Studio.  Let’s recap the relevant IPFS architecture information:&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;IPFS has two main transactions when interacting with a form: Invocation and Postback&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are dynamic.  They will need to be extracted from responses.&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are used in the postback request.  Their values will need to be substituted in the postback body.&lt;/li&gt;&lt;li&gt;Editing Session Id and Solution Id do not change between postbacks.  They will only need to be extracted for the invocation request.&lt;/li&gt;&lt;li&gt;Canary changes after every postback.  It needs to be extracted for every request.&lt;/li&gt;
&lt;/ul&gt;We have all the required knowledge; we just need to put the pieces together.  The basic steps to write a web test for IPFS are:&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Use &lt;a href="http://www.fiddlertool.com/fiddler/" class="externalLink"&gt;Fiddler&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; to capture HTTP requests&lt;/li&gt;&lt;li&gt;Use the captured information to define requests in a web test&lt;/li&gt;&lt;li&gt;Add Extraction Rules to the invocation request&lt;/li&gt;&lt;li&gt;Substitute context variables in the postback bodys&lt;/li&gt;&lt;li&gt;Add an Extraction Rule to the postback requests&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use Fiddler to capture HTTP requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start &lt;a href="http://www.fiddlertool.com/fiddler/" class="externalLink"&gt;Fiddler&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32084" alt="start fiddler.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Start capturing&lt;/li&gt;&lt;li&gt;Open an InfoPath form in a web browser &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32091" alt="open form.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Perform the actions you want to happen in your test &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32092" alt="perform actions in browser.jpg" /&gt;&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use the captured information to define requests in a web test
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start Visual Studio&lt;/li&gt;&lt;li&gt;Create a new web test&lt;/li&gt;&lt;li&gt;Add an InfoPathExtractionRules reference to the test project.  (You can download a dll for InfoPathExtractionRules from the Releases tab of this project.  Or you can download the source code for those rules on the Source Code tab.)&lt;/li&gt;&lt;li&gt;From the fiddler capture, find the GET request for /_layouts/FormServer.aspx &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32089" alt="fiddler invocation selected.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Add that request to the web test &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32087" alt="create invocation request.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Find the postbacks which are POST requests for /_layouts/Postback.FormServer.aspx or /_layouts/FormServer.aspx &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32090" alt="fiddler postback selected.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Add those postback requests to the web test as web service requests.  Be sure to copy the postback body.  The eventlog string should end with a single space.  Double check that the event log you copied to the webtest ends with a single space as this is a common mistake. &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32088" alt="create postback request.jpg" /&gt;&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Add Extraction Rules to the invocation request
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find the first request for /_layouts/FormServer.aspx&lt;/li&gt;&lt;li&gt;Add ExtractEditingSessionId, ExtractSolutionId, and ExtractInitialCanary extraction rules&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Substitute context variables in the postback bodys
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find the postback requests&lt;/li&gt;&lt;li&gt;In its string body, find the event log&lt;/li&gt;&lt;ol&gt;
&lt;li&gt;For partial postbacks, the event log will be the only data in the string body&lt;/li&gt;&lt;li&gt;For full page postbacks, the text __EventLog should precede the section containing the event log&lt;/li&gt;
&lt;/ol&gt;&lt;li&gt;Edit the EventLogInfo of the postback body as follows:&lt;/li&gt;&lt;ol&gt;
&lt;li&gt;Replace the 3rd item with {{editingSessionId}}&lt;/li&gt;&lt;li&gt;Replace the 4th item with {{solutionId}}&lt;/li&gt;&lt;li&gt;Replace the 19th item with {{canary}}&lt;/li&gt;
&lt;/ol&gt;
&lt;/ol&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32093" alt="postback substitute.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Add an Extraction Rule to the postback requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find the postback requests&lt;/li&gt;&lt;li&gt;Add ExtractPostbackCanary extraction rule to each of these requests&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;Once you have followed these steps, your web test should resemble the following picture.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32086" alt="complete webtest.jpg" /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
IpfsWebtestAutoFixer Tool
&lt;/h2&gt;&lt;a href="http://www.codeplex.com/ipfswebtest/Wiki/View.aspx?title=IpfsWebtestAutoFixer&amp;amp;referringTitle=Home"&gt;IpfsWebtestAutoFixer&lt;/a&gt; is tool which makes creating an InfoPath web test much easier. It automatically adds the appropriate extraction rules to the invocation request and postback requests. It also automatically substitutes context parameters in postback bodys.&lt;br /&gt; &lt;br /&gt;&lt;a href="http://www.codeplex.com/ipfswebtest/Wiki/View.aspx?title=Using%20the%20Individual%20Extraction%20Rules&amp;amp;referringTitle=Home"&gt;Using the Individual Extraction Rules&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;</description><author>JBooze</author><pubDate>Thu, 24 Jul 2008 20:39:20 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20080724083920P</guid></item><item><title>UPDATED WIKI: IpfsWebtestAutoFixer</title><link>http://www.codeplex.com/ipfswebtest/Wiki/View.aspx?title=IpfsWebtestAutoFixer&amp;version=2</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
Using the IpfsWebtestAutoFixer Tool
&lt;/h1&gt; &lt;br /&gt;IpfsWebtestAutoFixer is a console application that can be run on a webtest saved from Fiddler. It automatically adds the appropriate extraction rules to the invocation request and postback requests. It also automatically substitutes context parameters in postback bodys. This tool requires that a version of Visual Studio 2008 with webtesting capabilities is installed on your machine.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Steps to write an InfoPath web test with the IpfsWebtestAutoFixer Tool
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Use Fiddler to capture HTTP requests&lt;/li&gt;&lt;li&gt;Save the session as Visual Studio Web Test&lt;/li&gt;&lt;li&gt;Use IpfsWebtestAutoFixer tool on the .webtest file&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use Fiddler to capture HTTP requests
&lt;/h2&gt;Use the same process described on the &lt;a href="http://www.codeplex.com/ipfswebtest/Wiki/View.aspx?title=Home&amp;amp;referringTitle=IpfsWebtestAutoFixer"&gt;Home&lt;/a&gt; page.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Save the session as Visual Studio web test
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Select the requests you want in your webtest&lt;/li&gt;&lt;li&gt;File | Save | Session(s) | as Visual Studio Web Test...&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use IpfsWebtestAutoFixer tool on the .webtest file
&lt;/h2&gt;The syntax is as follows:&lt;br /&gt;&lt;span class="codeInline"&gt; IpfsWebtestAutoFixer.exe [webTest] [fixedWebTest] [invocationPath] &lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;table&gt;
&lt;tr&gt;
&lt;th&gt; Arguments &lt;/th&gt;&lt;th&gt; Description &lt;/th&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; webTest &lt;/td&gt;&lt;td&gt; Path to the web test file to fix up. In this example, the web test that was saved from Fiddler. &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; fixedWebTest &lt;/td&gt;&lt;td&gt; File path for the fixed up web test to save.  Overwrites an existing file or creates a new file. &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; invocationPath &lt;/td&gt;&lt;td&gt; Optional.  String used to identify the invocation request of an InfoPath form.  A request matches if its URL contains invocationPath.  The default value is &amp;quot;/_layouts/FormServer.aspx&amp;quot;  You will need to use this argument when the InfoPath form is in an XmlFormView control. &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt; &lt;br /&gt;A file selection dialog for webTest and fixedWebTest will appear if no arguments are given.  However, the only way to use the invocationPath option is by using its command line argument.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Examples
&lt;/h2&gt;A session of fiddler was saved to webTestSavedFromFiddler.webtest.  Fix the webtest and save it to myFixedWebTest.webtest.&lt;br /&gt;&lt;span class="codeInline"&gt; IpfsWebtestAutoFixer.exe webTestSavedFromFiddler.webtest myFixedWebTest.webtest &lt;/span&gt;&lt;br /&gt; &lt;br /&gt;A session of fiddler was saved to webTestSavedFromFiddler.webtest.  Fix the webtest and save it to myFixedWebTest.webtest.  The InfoPath form was in an XmlFormView control which was on the page MyPageWithFormViewControl.aspx.&lt;br /&gt;&lt;span class="codeInline"&gt; IpfsWebtestAutoFixer.exe webTestSavedFromFiddler.webtest myFixedWebTest.webtest MyPageWithFormViewControl.aspx &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;</description><author>JBooze</author><pubDate>Wed, 04 Jun 2008 18:22:06 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: IpfsWebtestAutoFixer 20080604062206P</guid></item><item><title>UPDATED WIKI: IpfsWebtestAutoFixer</title><link>http://www.codeplex.com/ipfswebtest/Wiki/View.aspx?title=IpfsWebtestAutoFixer&amp;version=1</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
Using the IpfsWebtestAutoFixer Tool
&lt;/h1&gt; &lt;br /&gt;IpfsWebtestAutoFixer is a console application that can be run on a webtest saved from Fiddler. It automatically adds the appropriate extraction rules to the invocation request and postback requests. It also automatically substitutes context parameters in postback bodys. This tool requires that a version of Visual Studio 2008 with webtesting capabilities is installed on your machine.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Steps to write an InfoPath web test with the IpfsWebtestAutoFixer Tool
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Use Fiddler to capture HTTP requests&lt;/li&gt;&lt;li&gt;Save the session as Visual Studio Web Test&lt;/li&gt;&lt;li&gt;Use IpfsWebtestAutoFixer tool on the .webtest file&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use Fiddler to capture HTTP requests
&lt;/h2&gt;Use the same process described on the &lt;a href="http://www.codeplex.com/ipfswebtest/Wiki/View.aspx?title=Home&amp;amp;referringTitle=IpfsWebtestAutoFixer"&gt;Home&lt;/a&gt; page.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Save the session as Visual Studio web test
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Select the requests you want in your webtest&lt;/li&gt;&lt;li&gt;File | Save | Session(s) | as Visual Studio Web Test...&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use IpfsWebtestAutoFixer tool on the .webtest file
&lt;/h2&gt;The syntax is as follows:&lt;br /&gt;&lt;span class="codeInline"&gt; IpfsWebtestAutoFixer.exe [webTest] [fixedWebTest] [invocationPath] &lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;table&gt;
&lt;tr&gt;
&lt;th&gt; Arguments &lt;/th&gt;&lt;th&gt; Description &lt;/th&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; webTest &lt;/td&gt;&lt;td&gt; Path to the web test file to fix up. In this example, the web test that was saved from Fiddler. &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; fixedWebTest &lt;/td&gt;&lt;td&gt; File path for the fixed up web test to save.  Overwrites an existing file or creates a new file. &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; invocationPath &lt;/td&gt;&lt;td&gt; Optional.  String used to identify the invocation request of an InfoPath form.  A request matches if its URL contains invocationPath.  The default value is &amp;quot;/_layouts/FormServer.aspx&amp;quot;  You will need to use this option when the InfoPath form is in an XmlFormView control. &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt; &lt;br /&gt;A file selection dialog for webTest and fixedWebTest will appear if no arguments are given.  However, the only way to use the invocationPath option is by using its command line argument.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Examples
&lt;/h2&gt;A session of fiddler was saved to webTestSavedFromFiddler.webtest.  Fix the webtest and save it to myFixedWebTest.webtest.&lt;br /&gt;&lt;span class="codeInline"&gt; IpfsWebtestAutoFixer.exe webTestSavedFromFiddler.webtest myFixedWebTest.webtest &lt;/span&gt;&lt;br /&gt; &lt;br /&gt;A session of fiddler was saved to webTestSavedFromFiddler.webtest.  Fix the webtest and save it to myFixedWebTest.webtest.  The InfoPath form was in an XmlFormView control which was on the page MyPageWithFormViewControl.aspx.&lt;br /&gt;&lt;span class="codeInline"&gt; IpfsWebtestAutoFixer.exe webTestSavedFromFiddler.webtest myFixedWebTest.webtest MyPageWithFormViewControl.aspx &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;</description><author>JBooze</author><pubDate>Wed, 04 Jun 2008 18:15:23 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: IpfsWebtestAutoFixer 20080604061523P</guid></item><item><title>UPDATED WIKI: Home</title><link>http://www.codeplex.com/ipfswebtest/Wiki/View.aspx?title=Home&amp;version=17</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
Writing a Visual Studio Web Test for InfoPath Forms Services 2007
&lt;/h1&gt;To write a Visual Studio web test for InfoPath Forms Services (IPFS), you must first understand some of IPFS’s architecture.  Before continuing, read the &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772323.aspx" class="externalLink"&gt;Forms Services Architecture article&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; on MSDN.  Pay close attention to the “Runtime Architecture” and “Rendering and Query Parameters” sections.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
InfoPath Forms Services HTTP Traffic
&lt;/h2&gt;When using an InfoPath form in the browser, a conversation between the browser and server occurs over HTTP.  This conversation consists of two kinds of transactions: Invocation and Postback.  Invocation occurs once when first opening the form.  After the form has been invoked, one or more postbacks to the server can occur.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32094" alt="IPFS HTTP traffic.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Invocation
&lt;/h2&gt;Invocation is the first transaction that occurs.  It loads all the resources that allow you to edit the form in the browser.  Invocation is started by making a GET request to FormServer.aspx.  (See How to: &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772417.aspx" class="externalLink"&gt;Use Query Parameters to Invoke Browser-Enabled InfoPath Forms&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; for more information on the format of this request).  The response includes the HTML of the form and some javascript for the form.  This request also causes requests for other dependent resources.  One of these dependent resources is core.js, which defines the core logic for form editing in the browser.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32095" alt="IPFS invocation.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Current Form Data
&lt;/h2&gt;In the browser, there is javascript running which defines several pieces of data.  In particular, there is an array named g_objCurrentFormData.  Data in this array will later be used to create a postback request.  There are three pieces of dynamic data that will be important when writing the web test: &lt;br /&gt;&lt;table&gt;
&lt;tr&gt;
&lt;th&gt; Data &lt;/th&gt;&lt;th&gt; Index of g_objCurrentFormData &lt;/th&gt;&lt;th&gt; Description &lt;/th&gt;&lt;th&gt; When does it change? &lt;/th&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Editing Session Id &lt;/td&gt;&lt;td&gt; 3 &lt;/td&gt;&lt;td&gt; Identifies your session with the server &lt;/td&gt;&lt;td&gt; When invoking a form &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Solution Id &lt;/td&gt;&lt;td&gt; 4 &lt;/td&gt;&lt;td&gt; Uniquely identifies the form template &lt;/td&gt;&lt;td&gt; When the form template has been updated &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Canary &lt;/td&gt;&lt;td&gt; 25 &lt;/td&gt;&lt;td&gt; Used for security mitigation &lt;/td&gt;&lt;td&gt; With every request/postback &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;(The indicies above assume you have installed Service Pack 1 on your server.  If you are using a pre-SP1 version the Canary will be at index 24.)&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Postback
&lt;/h2&gt;While you are interacting with a form in the browser, you may perform various actions such as typing in a text box or clicking a button.  These actions are recorded in an event log, using javascript.  When the form is submitted, or when logic must be performed on the server, the browser sends the event log to the server.  The server plays back the actions in the event log to recreate the state of the form.   Finally, the updated state of the form is returned to the browser and the browser refreshes its view of the data.  This transaction is known as a postback.  InfoPath has two types of postbacks - partial postback and full page postback.  A partial postback is a more efficent transaction because less data is transmitted.  However, some actions like view switching must use a full page postback.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Partial Postback
&lt;/h2&gt;When a partial postback occurs, the event log is sent to the server using a POST request to Postback.FormServer.aspx.  The body of the POST request contains the event log.  The response from the server contains javascript to evaluate on the browser, which updates its view of the data.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32096" alt="IPFS postback.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Full Page Postback
&lt;/h2&gt;When a full page postback occurs, the event log, along with some other data, is sent to the server using a POST request to FormServer.aspx.  The response from the server contains HTML and javascript to render the updated view of the data.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=33309" alt="IPFS full page postback.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Event Log
&lt;/h2&gt;The event log follows a specific format which is described below in &lt;a href="http://en.wikipedia.org/wiki/Backus-Naur_form" class="externalLink"&gt;BNF&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.  Note that the location of spaces is important.&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLog&amp;gt; ::= &amp;lt;EventLogInfo&amp;gt; ” “ &amp;lt;Events&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLogInfo&amp;gt; ::= &amp;lt;Data0&amp;gt; “;” &amp;lt;PostbackCounter&amp;gt; “;” &amp;lt;EditingSessionId&amp;gt; “;” &amp;lt;SolutionId&amp;gt; “;” &amp;lt;Data4&amp;gt; “;” &amp;lt;Data5&amp;gt; “;” &amp;lt;Data6&amp;gt; “;” &amp;lt;Data7&amp;gt; “;” &amp;lt;Data8&amp;gt; “;” &amp;lt;Data9&amp;gt; “;” &amp;lt;Data10&amp;gt; “;” &amp;lt;Data11&amp;gt; “;” &amp;lt;Data12&amp;gt; “;” &amp;lt;Data13&amp;gt; “;” &amp;lt;Data14&amp;gt; “;” &amp;lt;Data15&amp;gt; “;” &amp;lt;Data16&amp;gt; “;” &amp;lt;Data17&amp;gt; “;” &amp;lt;Canary&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;Events&amp;gt; ::= &amp;lt;Events&amp;gt; “ “ &amp;lt;Event&amp;gt; | &amp;lt;Event&amp;gt; “ “&lt;br /&gt; &lt;br /&gt;The event log consists of two main parts: EventLogInfo and Events.  EventLogInfo is simply a list of items separated by semicolons.  Events is a list of items separated by spaces.  Each item of Events represents an action that occurred while interacting with the form.&lt;br /&gt;As you can see, the three important pieces of information from g_objCurrentFormData are used in EventLogInfo.&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Editing Session Id is at index 2&lt;/li&gt;&lt;li&gt;Solution Id is at index 3&lt;/li&gt;&lt;li&gt;Canary is at index 18&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;There is another piece of EventLogInfo to point out.  At index 1 is the PostbackCounter.  This is an integer that starts at 0 and increments with each postback.&lt;br /&gt; &lt;br /&gt;An example event log follows.&lt;br /&gt;&lt;b&gt;Editing Session Id&lt;/b&gt; is bolded&lt;br /&gt;&lt;i&gt;Solution Id&lt;/i&gt; is italicized&lt;br /&gt;&lt;u&gt;Canary&lt;/u&gt; is underlined&lt;br /&gt; &lt;br /&gt;8;0;&lt;b&gt;3a41917c-bc1d-409b-904a-32fb82ce565b&lt;/b&gt;;&lt;i&gt;I:5fdfe5d2-fe2b-446f-9c70-504a30b3b40f:9285a025-812e-4c2f-a194-39edbec6c50a:633415556920000000&lt;/i&gt;;0;;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2F;http%3A%2F%2Fmyserver;http%3A%2F%2Fmyserver%2Fexample%2FForms%2FAllItems.aspx;1;1;0;10;0;633415558731245000;;&lt;u&gt;xKQi13p2GSqnFUzaSU7oMSRrhdC5spPCSnMbGWAd/kp95egDGTpq2vhVf/vz4ASFTrsYvuWQIj4G68gTruRruQ==|633415558731244855&lt;/u&gt; 0;V1_I1_T1;0;Type%20some%20text 14;;false;false &lt;br /&gt; &lt;br /&gt;&lt;h1&gt;
Putting the Pieces together in Visual Studio
&lt;/h1&gt;Now that we have a general idea how IPFS generates HTTP traffic, we can write a web test in Visual Studio.  Let’s recap the relevant IPFS architecture information:&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;IPFS has two main transactions when interacting with a form: Invocation and Postback&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are dynamic.  They will need to be extracted from responses.&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are used in the postback request.  Their values will need to be substituted in the postback body.&lt;/li&gt;&lt;li&gt;Editing Session Id and Solution Id do not change between postbacks.  They will only need to be extracted for the invocation request.&lt;/li&gt;&lt;li&gt;Canary changes after every postback.  It needs to be extracted for every request.&lt;/li&gt;
&lt;/ul&gt;We have all the required knowledge; we just need to put the pieces together.  The basic steps to write a web test for IPFS are:&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Use &lt;a href="http://www.fiddlertool.com/fiddler/" class="externalLink"&gt;Fiddler&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; to capture HTTP requests&lt;/li&gt;&lt;li&gt;Use the captured information to define requests in a web test&lt;/li&gt;&lt;li&gt;Add Extraction Rules to the invocation request&lt;/li&gt;&lt;li&gt;Substitute context variables in the postback bodys&lt;/li&gt;&lt;li&gt;Add an Extraction Rule to the postback requests&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use Fiddler to capture HTTP requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start &lt;a href="http://www.fiddlertool.com/fiddler/" class="externalLink"&gt;Fiddler&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32084" alt="start fiddler.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Start capturing&lt;/li&gt;&lt;li&gt;Open an InfoPath form in a web browser &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32091" alt="open form.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Perform the actions you want to happen in your test &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32092" alt="perform actions in browser.jpg" /&gt;&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use the captured information to define requests in a web test
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start Visual Studio&lt;/li&gt;&lt;li&gt;Create a new web test&lt;/li&gt;&lt;li&gt;Add an InfoPathExtractionRules reference to the test project.  (You can download a dll for InfoPathExtractionRules from the Releases tab of this project.  Or you can download the source code for those rules on the Source Code tab.)&lt;/li&gt;&lt;li&gt;From the fiddler capture, find the GET request for /_layouts/FormServer.aspx &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32089" alt="fiddler invocation selected.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Add that request to the web test &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32087" alt="create invocation request.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Find the postbacks which are POST requests for /_layouts/Postback.FormServer.aspx or /_layouts/FormServer.aspx &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32090" alt="fiddler postback selected.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Add those postback requests to the web test as web service requests.  Be sure to copy the postback body.  The eventlog string should end with a single space.  Double check that the event log you copied to the webtest ends with a single space as this is a common mistake. &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32088" alt="create postback request.jpg" /&gt;&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Add Extraction Rules to the invocation request
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find the first request for /_layouts/FormServer.aspx&lt;/li&gt;&lt;li&gt;Add ExtractEditingSessionId, ExtractSolutionId, and ExtractInitialCanary extraction rules&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Substitute context variables in the postback bodys
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find the postback requests&lt;/li&gt;&lt;li&gt;In its string body, find the event log&lt;/li&gt;&lt;ol&gt;
&lt;li&gt;For partial postbacks, the event log will be the only data in the string body&lt;/li&gt;&lt;li&gt;For full page postbacks, the text __EventLog should precede the section containing the event log&lt;/li&gt;
&lt;/ol&gt;&lt;li&gt;Edit the EventLogInfo of the postback body as follows:&lt;/li&gt;&lt;ol&gt;
&lt;li&gt;Replace the 3rd item with {{editingSessionId}}&lt;/li&gt;&lt;li&gt;Replace the 4th item with {{solutionId}}&lt;/li&gt;&lt;li&gt;Replace the 19th item with {{canary}}&lt;/li&gt;
&lt;/ol&gt;
&lt;/ol&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32093" alt="postback substitute.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Add an Extraction Rule to the postback requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find the postback requests&lt;/li&gt;&lt;li&gt;Add ExtractPostbackCanary extraction rule to each of these requests&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;Once you have followed these steps, your web test should resemble the following picture.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32086" alt="complete webtest.jpg" /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
IpfsWebtestAutoFixer Tool
&lt;/h2&gt;&lt;a href="http://www.codeplex.com/ipfswebtest/Wiki/View.aspx?title=IpfsWebtestAutoFixer&amp;amp;referringTitle=Home"&gt;IpfsWebtestAutoFixer&lt;/a&gt; is tool which makes creating an InfoPath web test much easier. It automatically adds the appropriate extraction rules to the invocation request and postback requests. It also automatically substitutes context parameters in postback bodys.&lt;br /&gt;
&lt;/div&gt;</description><author>JBooze</author><pubDate>Wed, 04 Jun 2008 16:40:31 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20080604044031P</guid></item><item><title>UPDATED WIKI: Home</title><link>http://www.codeplex.com/ipfswebtest/Wiki/View.aspx?title=Home&amp;version=16</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
Writing a Visual Studio Web Test for InfoPath Forms Services 2007
&lt;/h1&gt;To write a Visual Studio web test for InfoPath Forms Services (IPFS), you must first understand some of IPFS’s architecture.  Before continuing, read the &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772323.aspx" class="externalLink"&gt;Forms Services Architecture article&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; on MSDN.  Pay close attention to the “Runtime Architecture” and “Rendering and Query Parameters” sections.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
InfoPath Forms Services HTTP Traffic
&lt;/h2&gt;When using an InfoPath form in the browser, a conversation between the browser and server occurs over HTTP.  This conversation consists of two kinds of transactions: Invocation and Postback.  Invocation occurs once when first opening the form.  After the form has been invoked, one or more postbacks to the server can occur.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32094" alt="IPFS HTTP traffic.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Invocation
&lt;/h2&gt;Invocation is the first transaction that occurs.  It loads all the resources that allow you to edit the form in the browser.  Invocation is started by making a GET request to FormServer.aspx.  (See How to: &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772417.aspx" class="externalLink"&gt;Use Query Parameters to Invoke Browser-Enabled InfoPath Forms&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; for more information on the format of this request).  The response includes the HTML of the form and some javascript for the form.  This request also causes requests for other dependent resources.  One of these dependent resources is core.js, which defines the core logic for form editing in the browser.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32095" alt="IPFS invocation.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Current Form Data
&lt;/h2&gt;In the browser, there is javascript running which defines several pieces of data.  In particular, there is an array named g_objCurrentFormData.  Data in this array will later be used to create a postback request.  There are three pieces of dynamic data that will be important when writing the web test: &lt;br /&gt;&lt;table&gt;
&lt;tr&gt;
&lt;th&gt; Data &lt;/th&gt;&lt;th&gt; Index of g_objCurrentFormData &lt;/th&gt;&lt;th&gt; Description &lt;/th&gt;&lt;th&gt; When does it change? &lt;/th&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Editing Session Id &lt;/td&gt;&lt;td&gt; 3 &lt;/td&gt;&lt;td&gt; Identifies your session with the server &lt;/td&gt;&lt;td&gt; When invoking a form &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Solution Id &lt;/td&gt;&lt;td&gt; 4 &lt;/td&gt;&lt;td&gt; Uniquely identifies the form template &lt;/td&gt;&lt;td&gt; When the form template has been updated &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Canary &lt;/td&gt;&lt;td&gt; 25 &lt;/td&gt;&lt;td&gt; Used for security mitigation &lt;/td&gt;&lt;td&gt; With every request/postback &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;(The indicies above assume you have installed Service Pack 1 on your server.  If you are using a pre-SP1 version the Canary will be at index 24.)&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Postback
&lt;/h2&gt;While you are interacting with a form in the browser, you may perform various actions such as typing in a text box or clicking a button.  These actions are recorded in an event log, using javascript.  When the form is submitted, or when logic must be performed on the server, the browser sends the event log to the server.  The server plays back the actions in the event log to recreate the state of the form.   Finally, the updated state of the form is returned to the browser and the browser refreshes its view of the data.  This transaction is known as a postback.  InfoPath has two types of postbacks - partial postback and full page postback.  A partial postback is a more efficent transaction because less data is transmitted.  However, some actions like view switching must use a full page postback.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Partial Postback
&lt;/h2&gt;When a partial postback occurs, the event log is sent to the server using a POST request to Postback.FormServer.aspx.  The body of the POST request contains the event log.  The response from the server contains javascript to evaluate on the browser, which updates its view of the data.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32096" alt="IPFS postback.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Full Page Postback
&lt;/h2&gt;When a full page postback occurs, the event log, along with some other data, is sent to the server using a POST request to FormServer.aspx.  The response from the server contains HTML and javascript to render the updated view of the data.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=33309" alt="IPFS full page postback.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Event Log
&lt;/h2&gt;The event log follows a specific format which is described below in &lt;a href="http://en.wikipedia.org/wiki/Backus-Naur_form" class="externalLink"&gt;BNF&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.  Note that the location of spaces is important.&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLog&amp;gt; ::= &amp;lt;EventLogInfo&amp;gt; ” “ &amp;lt;Events&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLogInfo&amp;gt; ::= &amp;lt;Data0&amp;gt; “;” &amp;lt;PostbackCounter&amp;gt; “;” &amp;lt;EditingSessionId&amp;gt; “;” &amp;lt;SolutionId&amp;gt; “;” &amp;lt;Data4&amp;gt; “;” &amp;lt;Data5&amp;gt; “;” &amp;lt;Data6&amp;gt; “;” &amp;lt;Data7&amp;gt; “;” &amp;lt;Data8&amp;gt; “;” &amp;lt;Data9&amp;gt; “;” &amp;lt;Data10&amp;gt; “;” &amp;lt;Data11&amp;gt; “;” &amp;lt;Data12&amp;gt; “;” &amp;lt;Data13&amp;gt; “;” &amp;lt;Data14&amp;gt; “;” &amp;lt;Data15&amp;gt; “;” &amp;lt;Data16&amp;gt; “;” &amp;lt;Data17&amp;gt; “;” &amp;lt;Canary&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;Events&amp;gt; ::= &amp;lt;Events&amp;gt; “ “ &amp;lt;Event&amp;gt; | &amp;lt;Event&amp;gt; “ “&lt;br /&gt; &lt;br /&gt;The event log consists of two main parts: EventLogInfo and Events.  EventLogInfo is simply a list of items separated by semicolons.  Events is a list of items separated by spaces.  Each item of Events represents an action that occurred while interacting with the form.&lt;br /&gt;As you can see, the three important pieces of information from g_objCurrentFormData are used in EventLogInfo.&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Editing Session Id is at index 2&lt;/li&gt;&lt;li&gt;Solution Id is at index 3&lt;/li&gt;&lt;li&gt;Canary is at index 18&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;There is another piece of EventLogInfo to point out.  At index 1 is the PostbackCounter.  This is an integer that starts at 0 and increments with each postback.&lt;br /&gt; &lt;br /&gt;An example event log follows.&lt;br /&gt;&lt;b&gt;Editing Session Id&lt;/b&gt; is bolded&lt;br /&gt;&lt;i&gt;Solution Id&lt;/i&gt; is italicized&lt;br /&gt;&lt;u&gt;Canary&lt;/u&gt; is underlined&lt;br /&gt; &lt;br /&gt;8;0;&lt;b&gt;3a41917c-bc1d-409b-904a-32fb82ce565b&lt;/b&gt;;&lt;i&gt;I:5fdfe5d2-fe2b-446f-9c70-504a30b3b40f:9285a025-812e-4c2f-a194-39edbec6c50a:633415556920000000&lt;/i&gt;;0;;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2F;http%3A%2F%2Fmyserver;http%3A%2F%2Fmyserver%2Fexample%2FForms%2FAllItems.aspx;1;1;0;10;0;633415558731245000;;&lt;u&gt;xKQi13p2GSqnFUzaSU7oMSRrhdC5spPCSnMbGWAd/kp95egDGTpq2vhVf/vz4ASFTrsYvuWQIj4G68gTruRruQ==|633415558731244855&lt;/u&gt; 0;V1_I1_T1;0;Type%20some%20text 14;;false;false &lt;br /&gt; &lt;br /&gt;&lt;h1&gt;
Putting the Pieces together in Visual Studio
&lt;/h1&gt;Now that we have a general idea how IPFS generates HTTP traffic, we can write a web test in Visual Studio.  Let’s recap the relevant IPFS architecture information:&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;IPFS has two main transactions when interacting with a form: Invocation and Postback&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are dynamic.  They will need to be extracted from responses.&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are used in the postback request.  Their values will need to be substituted in the postback body.&lt;/li&gt;&lt;li&gt;Editing Session Id and Solution Id do not change between postbacks.  They will only need to be extracted for the invocation request.&lt;/li&gt;&lt;li&gt;Canary changes after every postback.  It needs to be extracted for every request.&lt;/li&gt;
&lt;/ul&gt;We have all the required knowledge; we just need to put the pieces together.  The basic steps to write a web test for IPFS are:&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Use &lt;a href="http://www.fiddlertool.com/fiddler/" class="externalLink"&gt;Fiddler&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; to capture HTTP requests&lt;/li&gt;&lt;li&gt;Use the captured information to define requests in a web test&lt;/li&gt;&lt;li&gt;Add Extraction Rules to the invocation request&lt;/li&gt;&lt;li&gt;Substitute context variables in the postback bodys&lt;/li&gt;&lt;li&gt;Add an Extraction Rule to the postback requests&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use Fiddler to capture HTTP requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start &lt;a href="http://www.fiddlertool.com/fiddler/" class="externalLink"&gt;Fiddler&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32084" alt="start fiddler.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Start capturing&lt;/li&gt;&lt;li&gt;Open an InfoPath form in a web browser &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32091" alt="open form.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Perform the actions you want to happen in your test &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32092" alt="perform actions in browser.jpg" /&gt;&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use the captured information to define requests in a web test
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start Visual Studio&lt;/li&gt;&lt;li&gt;Create a new web test&lt;/li&gt;&lt;li&gt;Add an InfoPathExtractionRules reference to the test project.  (You can download a dll for InfoPathExtractionRules from the Releases tab of this project.  Or you can download the source code for those rules on the Source Code tab.)&lt;/li&gt;&lt;li&gt;From the fiddler capture, find the GET request for /_layouts/FormServer.aspx &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32089" alt="fiddler invocation selected.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Add that request to the web test &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32087" alt="create invocation request.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Find the postbacks which are POST requests for /_layouts/Postback.FormServer.aspx or /_layouts/FormServer.aspx &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32090" alt="fiddler postback selected.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Add those postback requests to the web test as web service requests.  Be sure to copy the postback body.  The eventlog string should end with a single space.  Double check that the event log you copied to the webtest ends with a single space as this is a common mistake. &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32088" alt="create postback request.jpg" /&gt;&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Add Extraction Rules to the invocation request
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find the first request for /_layouts/FormServer.aspx&lt;/li&gt;&lt;li&gt;Add ExtractEditingSessionId, ExtractSolutionId, and ExtractInitialCanary extraction rules&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Substitute context variables in the postback bodys
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find the postback requests&lt;/li&gt;&lt;li&gt;In its string body, find the event log&lt;/li&gt;&lt;ol&gt;
&lt;li&gt;For partial postbacks, the event log will be the only data in the string body&lt;/li&gt;&lt;li&gt;For full page postbacks, the text __EventLog should precede the section containing the event log&lt;/li&gt;
&lt;/ol&gt;&lt;li&gt;Edit the EventLogInfo of the postback body as follows:&lt;/li&gt;&lt;ol&gt;
&lt;li&gt;Replace the 3rd item with {{editingSessionId}}&lt;/li&gt;&lt;li&gt;Replace the 4th item with {{solutionId}}&lt;/li&gt;&lt;li&gt;Replace the 19th item with {{canary}}&lt;/li&gt;
&lt;/ol&gt;
&lt;/ol&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32093" alt="postback substitute.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Add an Extraction Rule to the postback requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find the postback requests&lt;/li&gt;&lt;li&gt;Add ExtractPostbackCanary extraction rule to each of these requests&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;Once you have followed these steps, your web test should resemble the following picture.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32086" alt="complete webtest.jpg" /&gt;&lt;br /&gt;
&lt;/div&gt;</description><author>JBooze</author><pubDate>Fri, 16 May 2008 23:50:54 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20080516115054P</guid></item><item><title>UPDATED WIKI: Home</title><link>http://www.codeplex.com/ipfswebtest/Wiki/View.aspx?title=Home&amp;version=15</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
Writing a Visual Studio Web Test for InfoPath Forms Services 2007
&lt;/h1&gt;To write a Visual Studio web test for InfoPath Forms Services (IPFS), you must first understand some of IPFS’s architecture.  Before continuing, read the &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772323.aspx" class="externalLink"&gt;Forms Services Architecture article&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; on MSDN.  Pay close attention to the “Runtime Architecture” and “Rendering and Query Parameters” sections.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
InfoPath Forms Services HTTP Traffic
&lt;/h2&gt;When using an InfoPath form in the browser, a conversation between the browser and server occurs over HTTP.  This conversation consists of two kinds of transactions: Invocation and Postback.  Invocation occurs once when first opening the form.  After the form has been invoked, one or more postbacks to the server can occur.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32094" alt="IPFS HTTP traffic.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Invocation
&lt;/h2&gt;Invocation is the first transaction that occurs.  It loads all the resources that allow you to edit the form in the browser.  Invocation is started by making a GET request to FormServer.aspx.  (See How to: &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772417.aspx" class="externalLink"&gt;Use Query Parameters to Invoke Browser-Enabled InfoPath Forms&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; for more information on the format of this request).  The response includes the HTML of the form and some javascript for the form.  This request also causes requests for other dependent resources.  One of these dependent resources is core.js, which defines the core logic for form editing in the browser.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32095" alt="IPFS invocation.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Current Form Data
&lt;/h2&gt;In the browser, there is javascript running which defines several pieces of data.  In particular, there is an array named g_objCurrentFormData.  Data in this array will later be used to create a postback request.  There are three pieces of dynamic data that will be important when writing the web test: &lt;br /&gt;&lt;table&gt;
&lt;tr&gt;
&lt;th&gt; Data &lt;/th&gt;&lt;th&gt; Index of g_objCurrentFormData &lt;/th&gt;&lt;th&gt; Description &lt;/th&gt;&lt;th&gt; When does it change? &lt;/th&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Editing Session Id &lt;/td&gt;&lt;td&gt; 3 &lt;/td&gt;&lt;td&gt; Identifies your session with the server &lt;/td&gt;&lt;td&gt; When invoking a form &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Solution Id &lt;/td&gt;&lt;td&gt; 4 &lt;/td&gt;&lt;td&gt; Uniquely identifies the form template &lt;/td&gt;&lt;td&gt; When the form template has been updated &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Canary &lt;/td&gt;&lt;td&gt; 25 &lt;/td&gt;&lt;td&gt; Used for security mitigation &lt;/td&gt;&lt;td&gt; With every request/postback &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;(The indicies above assume you have installed Service Pack 1.  If you are using a pre-SP1 version the Canary will be at index 24.  This project currently has a bug because of this difference and only works with SP1.)&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Postback
&lt;/h2&gt;While you are interacting with a form in the browser, you may perform various actions such as typing in a text box or clicking a button.  These actions are recorded in an event log, using javascript.  When the form is submitted, or when logic must be performed on the server, the browser sends the event log to the server.  The server plays back the actions in the event log to recreate the state of the form.   Finally, the updated state of the form is returned to the browser and the browser refreshes its view of the data.  This transaction is known as a postback.  InfoPath has two types of postbacks - partial postback and full page postback.  A partial postback is a more efficent transaction because less data is transmitted.  However, some actions like view switching must use a full page postback.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Partial Postback
&lt;/h2&gt;When a partial postback occurs, the event log is sent to the server using a POST request to Postback.FormServer.aspx.  The body of the POST request contains the event log.  The response from the server contains javascript to evaluate on the browser, which updates its view of the data.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32096" alt="IPFS postback.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Full Page Postback
&lt;/h2&gt;When a full page postback occurs, the event log, along with some other data, is sent to the server using a POST request to FormServer.aspx.  The response from the server contains HTML and javascript to render the updated view of the data.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=33309" alt="IPFS full page postback.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Event Log
&lt;/h2&gt;The event log follows a specific format which is described below in &lt;a href="http://en.wikipedia.org/wiki/Backus-Naur_form" class="externalLink"&gt;BNF&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.  Note that the location of spaces is important.&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLog&amp;gt; ::= &amp;lt;EventLogInfo&amp;gt; ” “ &amp;lt;Events&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLogInfo&amp;gt; ::= &amp;lt;Data0&amp;gt; “;” &amp;lt;PostbackCounter&amp;gt; “;” &amp;lt;EditingSessionId&amp;gt; “;” &amp;lt;SolutionId&amp;gt; “;” &amp;lt;Data4&amp;gt; “;” &amp;lt;Data5&amp;gt; “;” &amp;lt;Data6&amp;gt; “;” &amp;lt;Data7&amp;gt; “;” &amp;lt;Data8&amp;gt; “;” &amp;lt;Data9&amp;gt; “;” &amp;lt;Data10&amp;gt; “;” &amp;lt;Data11&amp;gt; “;” &amp;lt;Data12&amp;gt; “;” &amp;lt;Data13&amp;gt; “;” &amp;lt;Data14&amp;gt; “;” &amp;lt;Data15&amp;gt; “;” &amp;lt;Data16&amp;gt; “;” &amp;lt;Data17&amp;gt; “;” &amp;lt;Canary&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;Events&amp;gt; ::= &amp;lt;Events&amp;gt; “ “ &amp;lt;Event&amp;gt; | &amp;lt;Event&amp;gt; “ “&lt;br /&gt; &lt;br /&gt;The event log consists of two main parts: EventLogInfo and Events.  EventLogInfo is simply a list of items separated by semicolons.  Events is a list of items separated by spaces.  Each item of Events represents an action that occurred while interacting with the form.&lt;br /&gt;As you can see, the three important pieces of information from g_objCurrentFormData are used in EventLogInfo.&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Editing Session Id is at index 2&lt;/li&gt;&lt;li&gt;Solution Id is at index 3&lt;/li&gt;&lt;li&gt;Canary is at index 18&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;There is another piece of EventLogInfo to point out.  At index 1 is the PostbackCounter.  This is an integer that starts at 0 and increments with each postback.&lt;br /&gt; &lt;br /&gt;An example event log follows.&lt;br /&gt;&lt;b&gt;Editing Session Id&lt;/b&gt; is bolded&lt;br /&gt;&lt;i&gt;Solution Id&lt;/i&gt; is italicized&lt;br /&gt;&lt;u&gt;Canary&lt;/u&gt; is underlined&lt;br /&gt; &lt;br /&gt;8;0;&lt;b&gt;3a41917c-bc1d-409b-904a-32fb82ce565b&lt;/b&gt;;&lt;i&gt;I:5fdfe5d2-fe2b-446f-9c70-504a30b3b40f:9285a025-812e-4c2f-a194-39edbec6c50a:633415556920000000&lt;/i&gt;;0;;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2F;http%3A%2F%2Fmyserver;http%3A%2F%2Fmyserver%2Fexample%2FForms%2FAllItems.aspx;1;1;0;10;0;633415558731245000;;&lt;u&gt;xKQi13p2GSqnFUzaSU7oMSRrhdC5spPCSnMbGWAd/kp95egDGTpq2vhVf/vz4ASFTrsYvuWQIj4G68gTruRruQ==|633415558731244855&lt;/u&gt; 0;V1_I1_T1;0;Type%20some%20text 14;;false;false &lt;br /&gt; &lt;br /&gt;&lt;h1&gt;
Putting the Pieces together in Visual Studio
&lt;/h1&gt;Now that we have a general idea how IPFS generates HTTP traffic, we can write a web test in Visual Studio.  Let’s recap the relevant IPFS architecture information:&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;IPFS has two main transactions when interacting with a form: Invocation and Postback&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are dynamic.  They will need to be extracted from responses.&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are used in the postback request.  Their values will need to be substituted in the postback body.&lt;/li&gt;&lt;li&gt;Editing Session Id and Solution Id do not change between postbacks.  They will only need to be extracted for the invocation request.&lt;/li&gt;&lt;li&gt;Canary changes after every postback.  It needs to be extracted for every request.&lt;/li&gt;
&lt;/ul&gt;We have all the required knowledge; we just need to put the pieces together.  The basic steps to write a web test for IPFS are:&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Use &lt;a href="http://www.fiddlertool.com/fiddler/" class="externalLink"&gt;Fiddler&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; to capture HTTP requests&lt;/li&gt;&lt;li&gt;Use the captured information to define requests in a web test&lt;/li&gt;&lt;li&gt;Add Extraction Rules to the invocation request&lt;/li&gt;&lt;li&gt;Substitute context variables in the postback bodys&lt;/li&gt;&lt;li&gt;Add an Extraction Rule to the postback requests&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use Fiddler to capture HTTP requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start &lt;a href="http://www.fiddlertool.com/fiddler/" class="externalLink"&gt;Fiddler&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32084" alt="start fiddler.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Start capturing&lt;/li&gt;&lt;li&gt;Open an InfoPath form in a web browser &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32091" alt="open form.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Perform the actions you want to happen in your test &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32092" alt="perform actions in browser.jpg" /&gt;&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use the captured information to define requests in a web test
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start Visual Studio&lt;/li&gt;&lt;li&gt;Create a new web test&lt;/li&gt;&lt;li&gt;Add an InfoPathExtractionRules reference to the test project.  (You can download a dll for InfoPathExtractionRules from the Releases tab of this project.  Or you can download the source code for those rules on the Source Code tab.)&lt;/li&gt;&lt;li&gt;From the fiddler capture, find the GET request for /_layouts/FormServer.aspx &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32089" alt="fiddler invocation selected.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Add that request to the web test &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32087" alt="create invocation request.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Find the postbacks which are POST requests for /_layouts/Postback.FormServer.aspx or /_layouts/FormServer.aspx &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32090" alt="fiddler postback selected.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Add those postback requests to the web test as web service requests.  Be sure to copy the postback body.  The eventlog string should end with a single space.  Double check that the event log you copied to the webtest ends with a single space as this is a common mistake. &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32088" alt="create postback request.jpg" /&gt;&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Add Extraction Rules to the invocation request
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find the first request for /_layouts/FormServer.aspx&lt;/li&gt;&lt;li&gt;Add ExtractEditingSessionId, ExtractSolutionId, and ExtractInitialCanary extraction rules&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Substitute context variables in the postback bodys
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find the postback requests&lt;/li&gt;&lt;li&gt;In its string body, find the event log&lt;/li&gt;&lt;ol&gt;
&lt;li&gt;For partial postbacks, the event log will be the only data in the string body&lt;/li&gt;&lt;li&gt;For full page postbacks, the text __EventLog should precede the section containing the event log&lt;/li&gt;
&lt;/ol&gt;&lt;li&gt;Edit the EventLogInfo of the postback body as follows:&lt;/li&gt;&lt;ol&gt;
&lt;li&gt;Replace the 3rd item with {{editingSessionId}}&lt;/li&gt;&lt;li&gt;Replace the 4th item with {{solutionId}}&lt;/li&gt;&lt;li&gt;Replace the 19th item with {{canary}}&lt;/li&gt;
&lt;/ol&gt;
&lt;/ol&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32093" alt="postback substitute.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Add an Extraction Rule to the postback requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find the postback requests&lt;/li&gt;&lt;li&gt;Add ExtractPostbackCanary extraction rule to each of these requests&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;Once you have followed these steps, your web test should resemble the following picture.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32086" alt="complete webtest.jpg" /&gt;&lt;br /&gt;
&lt;/div&gt;</description><author>JBooze</author><pubDate>Wed, 14 May 2008 22:51:41 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20080514105141P</guid></item><item><title>UPDATED WIKI: Home</title><link>http://www.codeplex.com/ipfswebtest/Wiki/View.aspx?title=Home&amp;version=14</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
Writing a Visual Studio Web Test for InfoPath Forms Services 2007
&lt;/h1&gt;To write a Visual Studio web test for InfoPath Forms Services (IPFS), you must first understand some of IPFS’s architecture.  Before continuing, read the &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772323.aspx" class="externalLink"&gt;Forms Services Architecture article&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; on MSDN.  Pay close attention to the “Runtime Architecture” and “Rendering and Query Parameters” sections.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
InfoPath Forms Services HTTP Traffic
&lt;/h2&gt;When using an InfoPath form in the browser, a conversation between the browser and server occurs over HTTP.  This conversation consists of two kinds of transactions: Invocation and Postback.  Invocation occurs once when first opening the form.  After the form has been invoked, one or more postbacks to the server can occur.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32094" alt="IPFS HTTP traffic.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Invocation
&lt;/h2&gt;Invocation is the first transaction that occurs.  It loads all the resources that allow you to edit the form in the browser.  Invocation is started by making a GET request to FormServer.aspx.  (See How to: &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772417.aspx" class="externalLink"&gt;Use Query Parameters to Invoke Browser-Enabled InfoPath Forms&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; for more information on the format of this request).  The response includes the HTML of the form and some javascript for the form.  This request also causes requests for other dependent resources.  One of these dependent resources is core.js, which defines the core logic for form editing in the browser.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32095" alt="IPFS invocation.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Current Form Data
&lt;/h2&gt;In the browser, there is javascript running which defines several pieces of data.  In particular, there is an array named g_objCurrentFormData.  Data in this array will later be used to create a postback request.  There are three pieces of dynamic data that will be important when writing the web test: &lt;br /&gt;&lt;table&gt;
&lt;tr&gt;
&lt;th&gt; Data &lt;/th&gt;&lt;th&gt; Index of g_objCurrentFormData &lt;/th&gt;&lt;th&gt; Description &lt;/th&gt;&lt;th&gt; When does it change? &lt;/th&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Editing Session Id &lt;/td&gt;&lt;td&gt; 3 &lt;/td&gt;&lt;td&gt; Identifies your session with the server &lt;/td&gt;&lt;td&gt; When invoking a form &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Solution Id &lt;/td&gt;&lt;td&gt; 4 &lt;/td&gt;&lt;td&gt; Uniquely identifies the form template &lt;/td&gt;&lt;td&gt; When the form template has been updated &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Canary &lt;/td&gt;&lt;td&gt; 25 &lt;/td&gt;&lt;td&gt; Used for security mitigation &lt;/td&gt;&lt;td&gt; With every request/postback &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt; &lt;br /&gt;&lt;h2&gt;
Postback
&lt;/h2&gt;While you are interacting with a form in the browser, you may perform various actions such as typing in a text box or clicking a button.  These actions are recorded in an event log, using javascript.  When the form is submitted, or when logic must be performed on the server, the browser sends the event log to the server.  The server plays back the actions in the event log to recreate the state of the form.   Finally, the updated state of the form is returned to the browser and the browser refreshes its view of the data.  This transaction is known as a postback.  InfoPath has two types of postbacks - partial postback and full page postback.  A partial postback is a more efficent transaction because less data is transmitted.  However, some actions like view switching must use a full page postback.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Partial Postback
&lt;/h2&gt;When a partial postback occurs, the event log is sent to the server using a POST request to Postback.FormServer.aspx.  The body of the POST request contains the event log.  The response from the server contains javascript to evaluate on the browser, which updates its view of the data.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32096" alt="IPFS postback.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Full Page Postback
&lt;/h2&gt;When a full page postback occurs, the event log, along with some other data, is sent to the server using a POST request to FormServer.aspx.  The response from the server contains HTML and javascript to render the updated view of the data.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=33309" alt="IPFS full page postback.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Event Log
&lt;/h2&gt;The event log follows a specific format which is described below in &lt;a href="http://en.wikipedia.org/wiki/Backus-Naur_form" class="externalLink"&gt;BNF&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.  Note that the location of spaces is important.&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLog&amp;gt; ::= &amp;lt;EventLogInfo&amp;gt; ” “ &amp;lt;Events&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLogInfo&amp;gt; ::= &amp;lt;Data0&amp;gt; “;” &amp;lt;PostbackCounter&amp;gt; “;” &amp;lt;EditingSessionId&amp;gt; “;” &amp;lt;SolutionId&amp;gt; “;” &amp;lt;Data4&amp;gt; “;” &amp;lt;Data5&amp;gt; “;” &amp;lt;Data6&amp;gt; “;” &amp;lt;Data7&amp;gt; “;” &amp;lt;Data8&amp;gt; “;” &amp;lt;Data9&amp;gt; “;” &amp;lt;Data10&amp;gt; “;” &amp;lt;Data11&amp;gt; “;” &amp;lt;Data12&amp;gt; “;” &amp;lt;Data13&amp;gt; “;” &amp;lt;Data14&amp;gt; “;” &amp;lt;Data15&amp;gt; “;” &amp;lt;Data16&amp;gt; “;” &amp;lt;Data17&amp;gt; “;” &amp;lt;Canary&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;Events&amp;gt; ::= &amp;lt;Events&amp;gt; “ “ &amp;lt;Event&amp;gt; | &amp;lt;Event&amp;gt; “ “&lt;br /&gt; &lt;br /&gt;The event log consists of two main parts: EventLogInfo and Events.  EventLogInfo is simply a list of items separated by semicolons.  Events is a list of items separated by spaces.  Each item of Events represents an action that occurred while interacting with the form.&lt;br /&gt;As you can see, the three important pieces of information from g_objCurrentFormData are used in EventLogInfo.&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Editing Session Id is at index 2&lt;/li&gt;&lt;li&gt;Solution Id is at index 3&lt;/li&gt;&lt;li&gt;Canary is at index 18&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;There is another piece of EventLogInfo to point out.  At index 1 is the PostbackCounter.  This is an integer that starts at 0 and increments with each postback.&lt;br /&gt; &lt;br /&gt;An example event log follows.&lt;br /&gt;&lt;b&gt;Editing Session Id&lt;/b&gt; is bolded&lt;br /&gt;&lt;i&gt;Solution Id&lt;/i&gt; is italicized&lt;br /&gt;&lt;u&gt;Canary&lt;/u&gt; is underlined&lt;br /&gt; &lt;br /&gt;8;0;&lt;b&gt;3a41917c-bc1d-409b-904a-32fb82ce565b&lt;/b&gt;;&lt;i&gt;I:5fdfe5d2-fe2b-446f-9c70-504a30b3b40f:9285a025-812e-4c2f-a194-39edbec6c50a:633415556920000000&lt;/i&gt;;0;;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2F;http%3A%2F%2Fmyserver;http%3A%2F%2Fmyserver%2Fexample%2FForms%2FAllItems.aspx;1;1;0;10;0;633415558731245000;;&lt;u&gt;xKQi13p2GSqnFUzaSU7oMSRrhdC5spPCSnMbGWAd/kp95egDGTpq2vhVf/vz4ASFTrsYvuWQIj4G68gTruRruQ==|633415558731244855&lt;/u&gt; 0;V1_I1_T1;0;Type%20some%20text 14;;false;false &lt;br /&gt; &lt;br /&gt;&lt;h1&gt;
Putting the Pieces together in Visual Studio
&lt;/h1&gt;Now that we have a general idea how IPFS generates HTTP traffic, we can write a web test in Visual Studio.  Let’s recap the relevant IPFS architecture information:&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;IPFS has two main transactions when interacting with a form: Invocation and Postback&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are dynamic.  They will need to be extracted from responses.&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are used in the postback request.  Their values will need to be substituted in the postback body.&lt;/li&gt;&lt;li&gt;Editing Session Id and Solution Id do not change between postbacks.  They will only need to be extracted for the invocation request.&lt;/li&gt;&lt;li&gt;Canary changes after every postback.  It needs to be extracted for every request.&lt;/li&gt;
&lt;/ul&gt;We have all the required knowledge; we just need to put the pieces together.  The basic steps to write a web test for IPFS are:&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Use &lt;a href="http://www.fiddlertool.com/fiddler/" class="externalLink"&gt;Fiddler&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; to capture HTTP requests&lt;/li&gt;&lt;li&gt;Use the captured information to define requests in a web test&lt;/li&gt;&lt;li&gt;Add Extraction Rules to the invocation request&lt;/li&gt;&lt;li&gt;Substitute context variables in the postback bodys&lt;/li&gt;&lt;li&gt;Add an Extraction Rule to the postback requests&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use Fiddler to capture HTTP requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start &lt;a href="http://www.fiddlertool.com/fiddler/" class="externalLink"&gt;Fiddler&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32084" alt="start fiddler.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Start capturing&lt;/li&gt;&lt;li&gt;Open an InfoPath form in a web browser &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32091" alt="open form.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Perform the actions you want to happen in your test &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32092" alt="perform actions in browser.jpg" /&gt;&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use the captured information to define requests in a web test
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start Visual Studio&lt;/li&gt;&lt;li&gt;Create a new web test&lt;/li&gt;&lt;li&gt;Add an InfoPathExtractionRules reference to the test project.  (You can download a dll for InfoPathExtractionRules from the Releases tab of this project.  Or you can download the source code for those rules on the Source Code tab.)&lt;/li&gt;&lt;li&gt;From the fiddler capture, find the GET request for /_layouts/FormServer.aspx &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32089" alt="fiddler invocation selected.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Add that request to the web test &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32087" alt="create invocation request.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Find the postbacks which are POST requests for /_layouts/Postback.FormServer.aspx or /_layouts/FormServer.aspx &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32090" alt="fiddler postback selected.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Add those postback requests to the web test as web service requests.  Be sure to copy the postback body.  The eventlog string should end with a single space.  Double check that the event log you copied to the webtest ends with a single space as this is a common mistake. &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32088" alt="create postback request.jpg" /&gt;&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Add Extraction Rules to the invocation request
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find the first request for /_layouts/FormServer.aspx&lt;/li&gt;&lt;li&gt;Add ExtractEditingSessionId, ExtractSolutionId, and ExtractInitialCanary extraction rules&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Substitute context variables in the postback bodys
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find the postback requests&lt;/li&gt;&lt;li&gt;In its string body, find the event log&lt;/li&gt;&lt;ol&gt;
&lt;li&gt;For partial postbacks, the event log will be the only data in the string body&lt;/li&gt;&lt;li&gt;For full page postbacks, the text __EventLog should precede the section containing the event log&lt;/li&gt;
&lt;/ol&gt;&lt;li&gt;Edit the EventLogInfo of the postback body as follows:&lt;/li&gt;&lt;ol&gt;
&lt;li&gt;Replace the 3rd item with {{editingSessionId}}&lt;/li&gt;&lt;li&gt;Replace the 4th item with {{solutionId}}&lt;/li&gt;&lt;li&gt;Replace the 19th item with {{canary}}&lt;/li&gt;
&lt;/ol&gt;
&lt;/ol&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32093" alt="postback substitute.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Add an Extraction Rule to the postback requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find the postback requests&lt;/li&gt;&lt;li&gt;Add ExtractPostbackCanary extraction rule to each of these requests&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;Once you have followed these steps, your web test should resemble the following picture.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32086" alt="complete webtest.jpg" /&gt;&lt;br /&gt;
&lt;/div&gt;</description><author>JBooze</author><pubDate>Wed, 14 May 2008 15:53:23 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20080514035323P</guid></item><item><title>UPDATED WIKI: Home</title><link>http://www.codeplex.com/ipfswebtest/Wiki/View.aspx?title=Home&amp;version=13</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
Writing a Visual Studio Web Test for InfoPath Forms Services 2007
&lt;/h1&gt;To write a Visual Studio web test for InfoPath Forms Services (IPFS), you must first understand some of IPFS’s architecture.  Before continuing, read the &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772323.aspx" class="externalLink"&gt;Forms Services Architecture article&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; on MSDN.  Pay close attention to the “Runtime Architecture” and “Rendering and Query Parameters” sections.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
InfoPath Forms Services HTTP Traffic
&lt;/h2&gt;When using an InfoPath form in the browser, a conversation between the browser and server occurs over HTTP.  This conversation consists of two kinds of transactions: Invocation and Postback.  Invocation occurs once when first opening the form.  After the form has been invoked, one or more postbacks to the server can occur.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32094" alt="IPFS HTTP traffic.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Invocation
&lt;/h2&gt;Invocation is the first transaction that occurs.  It loads all the resources that allow you to edit the form in the browser.  Invocation is started by making a GET request to FormServer.aspx.  (See How to: &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772417.aspx" class="externalLink"&gt;Use Query Parameters to Invoke Browser-Enabled InfoPath Forms&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; for more information on the format of this request).  The response includes the HTML of the form and some javascript for the form.  This request also causes requests for other dependent resources.  One of these dependent resources is core.js, which defines the core logic for form editing in the browser.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32095" alt="IPFS invocation.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Current Form Data
&lt;/h2&gt;In the browser, there is javascript running which defines several pieces of data.  In particular, there is an array named g_objCurrentFormData.  Data in this array will later be used to create a postback request.  There are three pieces of dynamic data that will be important when writing the web test: &lt;br /&gt;&lt;table&gt;
&lt;tr&gt;
&lt;th&gt; Data &lt;/th&gt;&lt;th&gt; Index of g_objCurrentFormData &lt;/th&gt;&lt;th&gt; Description &lt;/th&gt;&lt;th&gt; When does it change? &lt;/th&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Editing Session Id &lt;/td&gt;&lt;td&gt; 3 &lt;/td&gt;&lt;td&gt; Identifies your session with the server &lt;/td&gt;&lt;td&gt; When invoking a form &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Solution Id &lt;/td&gt;&lt;td&gt; 4 &lt;/td&gt;&lt;td&gt; Uniquely identifies the form template &lt;/td&gt;&lt;td&gt; When the form template has been updated &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Canary &lt;/td&gt;&lt;td&gt; 25 &lt;/td&gt;&lt;td&gt; Used for security mitigation &lt;/td&gt;&lt;td&gt; With every request/postback &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt; &lt;br /&gt;&lt;h2&gt;
Postback
&lt;/h2&gt;While you are interacting with a form in the browser, you may perform various actions such as typing in a text box or clicking a button.  These actions are recorded in an event log, using javascript.  When the form is submitted, or when logic must be performed on the server, the browser sends the event log to the server.  The server plays back the actions in the event log to recreate the state of the form.   Finally, the updated state of the form is returned to the browser and the browser refreshes its view of the data.  This transaction is known as a postback.  InfoPath has two types of postbacks - partial postback and full page postback.  A partial postback is a more efficent transaction because less data is transmitted.  However, some actions like view switching must use a full page postback.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Partial Postback
&lt;/h2&gt;When a partial postback occurs, the event log is sent to the server using a POST request to Postback.FormServer.aspx.  The body of the POST request contains the event log.  The response from the server contains javascript to evaluate on the browser, which updates its view of the data.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32096" alt="IPFS postback.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Full Page Postback
&lt;/h2&gt;When a full page postback occurs, the event log, along with some other data, is sent to the server using a POST request to FormServer.aspx.  The response from the server contains HTML and javascript to render the updated view of the data.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=33309" alt="IPFS full page postback.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Event Log
&lt;/h2&gt;The event log follows a specific format which is described below in &lt;a href="http://en.wikipedia.org/wiki/Backus-Naur_form" class="externalLink"&gt;BNF&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.  Note that the location of spaces is important.&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLog&amp;gt; ::= &amp;lt;EventLogInfo&amp;gt; ” “ &amp;lt;Events&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLogInfo&amp;gt; ::= &amp;lt;Data0&amp;gt; “;” &amp;lt;PostbackCounter&amp;gt; “;” &amp;lt;EditingSessionId&amp;gt; “;” &amp;lt;SolutionId&amp;gt; “;” &amp;lt;Data4&amp;gt; “;” &amp;lt;Data5&amp;gt; “;” &amp;lt;Data6&amp;gt; “;” &amp;lt;Data7&amp;gt; “;” &amp;lt;Data8&amp;gt; “;” &amp;lt;Data9&amp;gt; “;” &amp;lt;Data10&amp;gt; “;” &amp;lt;Data11&amp;gt; “;” &amp;lt;Data12&amp;gt; “;” &amp;lt;Data13&amp;gt; “;” &amp;lt;Data14&amp;gt; “;” &amp;lt;Data15&amp;gt; “;” &amp;lt;Data16&amp;gt; “;” &amp;lt;Data17&amp;gt; “;” &amp;lt;Canary&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;Events&amp;gt; ::= &amp;lt;Events&amp;gt; “ “ &amp;lt;Event&amp;gt; | &amp;lt;Event&amp;gt; “ “&lt;br /&gt; &lt;br /&gt;The event log consists of two main parts: EventLogInfo and Events.  EventLogInfo is simply a list of items separated by semicolons.  Events is a list of items separated by spaces.  Each item of Events represents an action that occurred while interacting with the form.&lt;br /&gt;As you can see, the three important pieces of information from g_objCurrentFormData are used in EventLogInfo.&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Editing Session Id is at index 2&lt;/li&gt;&lt;li&gt;Solution Id is at index 3&lt;/li&gt;&lt;li&gt;Canary is at index 18&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;There is another piece of EventLogInfo to point out.  At index 1 is the PostbackCounter.  This is an integer that starts at 0 and increments with each postback.&lt;br /&gt; &lt;br /&gt;An example event log follows.&lt;br /&gt;&lt;b&gt;Editing Session Id&lt;/b&gt; is bolded&lt;br /&gt;&lt;i&gt;Solution Id&lt;/i&gt; is italicized&lt;br /&gt;&lt;u&gt;Canary&lt;/u&gt; is underlined&lt;br /&gt; &lt;br /&gt;8;0;&lt;b&gt;3a41917c-bc1d-409b-904a-32fb82ce565b&lt;/b&gt;;&lt;i&gt;I:5fdfe5d2-fe2b-446f-9c70-504a30b3b40f:9285a025-812e-4c2f-a194-39edbec6c50a:633415556920000000&lt;/i&gt;;0;;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2F;http%3A%2F%2Fmyserver;http%3A%2F%2Fmyserver%2Fexample%2FForms%2FAllItems.aspx;1;1;0;10;0;633415558731245000;;&lt;u&gt;xKQi13p2GSqnFUzaSU7oMSRrhdC5spPCSnMbGWAd/kp95egDGTpq2vhVf/vz4ASFTrsYvuWQIj4G68gTruRruQ==|633415558731244855&lt;/u&gt; 0;V1_I1_T1;0;Type%20some%20text 14;;false;false &lt;br /&gt; &lt;br /&gt;&lt;h1&gt;
Putting the Pieces together in Visual Studio
&lt;/h1&gt;Now that we have a general idea how IPFS generates HTTP traffic, we can write a web test in Visual Studio.  Let’s recap the relevant IPFS architecture information:&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;IPFS has two main transactions when interacting with a form: Invocation and Postback&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are dynamic.  They will need to be extracted from responses.&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are used in the postback request.  Their values will need to be substituted in the postback body.&lt;/li&gt;&lt;li&gt;Editing Session Id and Solution Id do not change between postbacks.  They will only need to be extracted for the invocation request.&lt;/li&gt;&lt;li&gt;Canary changes after every postback.  It needs to be extracted for every request.&lt;/li&gt;
&lt;/ul&gt;We have all the required knowledge; we just need to put the pieces together.  The basic steps to write a web test for IPFS are:&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Use &lt;a href="http://www.fiddlertool.com/fiddler/" class="externalLink"&gt;Fiddler&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; to capture HTTP requests&lt;/li&gt;&lt;li&gt;Use the captured information to define requests in a web test&lt;/li&gt;&lt;li&gt;Add Extraction Rules to the invocation request&lt;/li&gt;&lt;li&gt;Substitute context variables in the postback bodys&lt;/li&gt;&lt;li&gt;Add an Extraction Rule to the postback requests&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use Fiddler to capture HTTP requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start &lt;a href="http://www.fiddlertool.com/fiddler/" class="externalLink"&gt;Fiddler&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32084" alt="start fiddler.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Start capturing&lt;/li&gt;&lt;li&gt;Open an InfoPath form in a web browser &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32091" alt="open form.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Perform the actions you want to happen in your test &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32092" alt="perform actions in browser.jpg" /&gt;&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use the captured information to define requests in a web test
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start Visual Studio&lt;/li&gt;&lt;li&gt;Create a new web test&lt;/li&gt;&lt;li&gt;Add an InfoPathExtractionRules reference to the test project.  (You can download a dll for InfoPathExtractionRules from the Releases tab of this project.  Or you can download the source code for those rules on the Source Code tab.)&lt;/li&gt;&lt;li&gt;From the fiddler capture, find the GET request for /_layouts/FormServer.aspx &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32089" alt="fiddler invocation selected.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Add that request to the web test &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32087" alt="create invocation request.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Find the postbacks which are POST requests for /_layouts/Postback.FormServer.aspx or /_layouts/FormServer.aspx &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32090" alt="fiddler postback selected.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Add those requests to the web test.  Be sure to copy the postback body.  Note that these will be web service requests. &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32088" alt="create postback request.jpg" /&gt;&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Add Extraction Rules to the invocation request
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find the first request for /_layouts/FormServer.aspx&lt;/li&gt;&lt;li&gt;Add ExtractEditingSessionId, ExtractSolutionId, and ExtractInitialCanary extraction rules&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Substitute context variables in the postback bodys
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find the postback requests&lt;/li&gt;&lt;li&gt;In its string body, find the event log&lt;/li&gt;&lt;ol&gt;
&lt;li&gt;For partial postbacks, the event log will be the only data in the string body&lt;/li&gt;&lt;li&gt;For full page postbacks, the text __EventLog should precede the section containing the event log&lt;/li&gt;
&lt;/ol&gt;&lt;li&gt;Edit the EventLogInfo of the postback body as follows:&lt;/li&gt;&lt;ol&gt;
&lt;li&gt;Replace the 3rd item with {{editingSessionId}}&lt;/li&gt;&lt;li&gt;Replace the 4th item with {{solutionId}}&lt;/li&gt;&lt;li&gt;Replace the 19th item with {{canary}}&lt;/li&gt;
&lt;/ol&gt;
&lt;/ol&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32093" alt="postback substitute.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Add an Extraction Rule to the postback requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find the postback requests&lt;/li&gt;&lt;li&gt;Add ExtractPostbackCanary extraction rule to each of these requests&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;Once you have followed these steps, your web test should resemble the following picture.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32086" alt="complete webtest.jpg" /&gt;&lt;br /&gt;
&lt;/div&gt;</description><author>JBooze</author><pubDate>Tue, 29 Apr 2008 01:07:39 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20080429010739A</guid></item><item><title>UPDATED WIKI: Home</title><link>http://www.codeplex.com/ipfswebtest/Wiki/View.aspx?title=Home&amp;version=12</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
Writing a Visual Studio Web Test for InfoPath Forms Services 2007
&lt;/h1&gt;To write a Visual Studio web test for InfoPath Forms Services (IPFS), you must first understand some of IPFS’s architecture.  Before continuing, read the &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772323.aspx" class="externalLink"&gt;Forms Services Architecture article&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; on MSDN.  Pay close attention to the “Runtime Architecture” and “Rendering and Query Parameters” sections.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
InfoPath Forms Services HTTP Traffic
&lt;/h2&gt;When using an InfoPath form in the browser, a conversation between the browser and server occurs over HTTP.  This conversation consists of two kinds of transactions: Invocation and Postback.  Invocation occurs once when first opening the form.  After the form has been invoked, one or more postbacks to the server can occur.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32094" alt="IPFS HTTP traffic.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Invocation
&lt;/h2&gt;Invocation is the first transaction that occurs.  It loads all the resources that allow you to edit the form in the browser.  Invocation is started by making a GET request to FormServer.aspx.  (See How to: &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772417.aspx" class="externalLink"&gt;Use Query Parameters to Invoke Browser-Enabled InfoPath Forms&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; for more information on the format of this request).  The response includes the HTML of the form and some javascript for the form.  This request also causes requests for other dependent resources.  One of these dependent resources is core.js, which defines the core logic for form editing in the browser.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32095" alt="IPFS invocation.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Current Form Data
&lt;/h2&gt;In the browser, there is javascript running which defines several pieces of data.  In particular, there is an array named g_objCurrentFormData.  Data in this array will later be used to create a postback request.  There are three pieces of dynamic data that will be important when writing the web test: &lt;br /&gt;&lt;table&gt;
&lt;tr&gt;
&lt;th&gt; Data &lt;/th&gt;&lt;th&gt; Index of g_objCurrentFormData &lt;/th&gt;&lt;th&gt; Description &lt;/th&gt;&lt;th&gt; When does it change? &lt;/th&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Editing Session Id &lt;/td&gt;&lt;td&gt; 3 &lt;/td&gt;&lt;td&gt; Identifies your session with the server &lt;/td&gt;&lt;td&gt; When invoking a form &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Solution Id &lt;/td&gt;&lt;td&gt; 4 &lt;/td&gt;&lt;td&gt; Uniquely identifies the form template &lt;/td&gt;&lt;td&gt; When the form template has been updated &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Canary &lt;/td&gt;&lt;td&gt; 25 &lt;/td&gt;&lt;td&gt; Used for security mitigation &lt;/td&gt;&lt;td&gt; With every request/postback &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt; &lt;br /&gt;&lt;h2&gt;
Postback
&lt;/h2&gt;While you are interacting with a form in the browser, you may perform various actions such as typing in a text box or clicking a button.  These actions are recorded in an event log, using javascript.  When the form is submitted, or when logic must be performed on the server, the browser sends the event log to the server.  The server plays back the actions in the event log to recreate the state of the form.   Finally, the updated state of the form is returned to the browser and the browser refreshes its view of the data.  This transaction is known as a postback.  InfoPath has two types of postbacks - partial postback and full page postback.  &lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Partial Postback
&lt;/h2&gt;When a partial postback occurs, the event log is sent to the server using a POST request to Postback.FormServer.aspx.  The body of the POST request contains the event log.  The response from the server contains javascript to evaluate on the browser, which updates its view of the data.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32096" alt="IPFS postback.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Full Page Postback
&lt;/h2&gt;When a full page postback occurs, the event log, along with some other data, is sent to the server using a POST request to FormServer.aspx.  The response from the server contains HTML and javascript to render the updated view of the data.  &lt;b&gt;This project does not have support for full page postbacks, yet.&lt;/b&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Event Log
&lt;/h2&gt;The event log follows a specific format which is described below in &lt;a href="http://en.wikipedia.org/wiki/Backus-Naur_form" class="externalLink"&gt;BNF&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.  Note that the location of spaces is important.&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLog&amp;gt; ::= &amp;lt;EventLogInfo&amp;gt; ” “ &amp;lt;Events&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLogInfo&amp;gt; ::= &amp;lt;Data0&amp;gt; “;” &amp;lt;PostbackCounter&amp;gt; “;” &amp;lt;EditingSessionId&amp;gt; “;” &amp;lt;SolutionId&amp;gt; “;” &amp;lt;Data4&amp;gt; “;” &amp;lt;Data5&amp;gt; “;” &amp;lt;Data6&amp;gt; “;” &amp;lt;Data7&amp;gt; “;” &amp;lt;Data8&amp;gt; “;” &amp;lt;Data9&amp;gt; “;” &amp;lt;Data10&amp;gt; “;” &amp;lt;Data11&amp;gt; “;” &amp;lt;Data12&amp;gt; “;” &amp;lt;Data13&amp;gt; “;” &amp;lt;Data14&amp;gt; “;” &amp;lt;Data15&amp;gt; “;” &amp;lt;Data16&amp;gt; “;” &amp;lt;Data17&amp;gt; “;” &amp;lt;Canary&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;Events&amp;gt; ::= &amp;lt;Events&amp;gt; “ “ &amp;lt;Event&amp;gt; | &amp;lt;Event&amp;gt; “ “&lt;br /&gt; &lt;br /&gt;The event log consists of two main parts: EventLogInfo and Events.  EventLogInfo is simply a list of items separated by semicolons.  Events is a list of items separated by spaces.  Each item of Events represents an action that occurred while interacting with the form.&lt;br /&gt;As you can see, the three important pieces of information from g_objCurrentFormData are used in EventLogInfo.&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Editing Session Id is at index 2&lt;/li&gt;&lt;li&gt;Solution Id is at index 3&lt;/li&gt;&lt;li&gt;Canary is at index 18&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;There is another piece of EventLogInfo to point out.  At index 1 is the PostbackCounter.  This is an integer that starts at 0 and increments with each postback.&lt;br /&gt; &lt;br /&gt;An example event log follows.&lt;br /&gt;&lt;b&gt;Editing Session Id&lt;/b&gt; is bolded&lt;br /&gt;&lt;i&gt;Solution Id&lt;/i&gt; is italicized&lt;br /&gt;&lt;u&gt;Canary&lt;/u&gt; is underlined&lt;br /&gt; &lt;br /&gt;8;0;&lt;b&gt;3a41917c-bc1d-409b-904a-32fb82ce565b&lt;/b&gt;;&lt;i&gt;I:5fdfe5d2-fe2b-446f-9c70-504a30b3b40f:9285a025-812e-4c2f-a194-39edbec6c50a:633415556920000000&lt;/i&gt;;0;;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2F;http%3A%2F%2Fmyserver;http%3A%2F%2Fmyserver%2Fexample%2FForms%2FAllItems.aspx;1;1;0;10;0;633415558731245000;;&lt;u&gt;xKQi13p2GSqnFUzaSU7oMSRrhdC5spPCSnMbGWAd/kp95egDGTpq2vhVf/vz4ASFTrsYvuWQIj4G68gTruRruQ==|633415558731244855&lt;/u&gt; 0;V1_I1_T1;0;Type%20some%20text 14;;false;false &lt;br /&gt; &lt;br /&gt;&lt;h1&gt;
Putting the Pieces together in Visual Studio
&lt;/h1&gt;Now that we have a general idea how IPFS generates HTTP traffic, we can write a web test in Visual Studio.  Let’s recap the relevant IPFS architecture information:&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;IPFS has two main transactions when interacting with a form: Invocation and Postback&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are dynamic.  They will need to be extracted from responses.&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are used in the postback request.  Their values will need to be substituted in the postback body.&lt;/li&gt;&lt;li&gt;Editing Session Id and Solution Id do not change between postbacks.  They will only need to be extracted for the invocation request.&lt;/li&gt;&lt;li&gt;Canary changes after every postback.  It needs to be extracted for every request.&lt;/li&gt;
&lt;/ul&gt;We have all the required knowledge; we just need to put the pieces together.  The basic steps to write a web test for IPFS are:&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Use &lt;a href="http://www.fiddlertool.com/fiddler/" class="externalLink"&gt;Fiddler&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; to capture HTTP requests&lt;/li&gt;&lt;li&gt;Use the captured information to define requests in a web test&lt;/li&gt;&lt;li&gt;Add Extraction Rules to the invocation request&lt;/li&gt;&lt;li&gt;Substitute context variables in the postback bodys&lt;/li&gt;&lt;li&gt;Add an Extraction Rule to the postback requests&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use Fiddler to capture HTTP requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start &lt;a href="http://www.fiddlertool.com/fiddler/" class="externalLink"&gt;Fiddler&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32084" alt="start fiddler.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Start capturing&lt;/li&gt;&lt;li&gt;Open an InfoPath form in a web browser &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32091" alt="open form.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Perform the actions you want to happen in your test &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32092" alt="perform actions in browser.jpg" /&gt;&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use the captured information to define requests in a web test
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start Visual Studio&lt;/li&gt;&lt;li&gt;Create a new web test&lt;/li&gt;&lt;li&gt;Add an InfoPathExtractionRules reference to the test project.  (You can download a dll for InfoPathExtractionRules from the Releases tab of this project.  Or you can download the source code for those rules on the Source Code tab.)&lt;/li&gt;&lt;li&gt;From the fiddler capture, find the request for /_layouts/FormServer.aspx &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32089" alt="fiddler invocation selected.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Add that request to the web test &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32087" alt="create invocation request.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Find requests for /_layouts/Postback.FormServer.aspx &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32090" alt="fiddler postback selected.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Add those requests to the web test.  Be sure to copy the postback body.  Note that these will be web service requests. &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32088" alt="create postback request.jpg" /&gt;&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Add Extraction Rules to the invocation request
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find the request for /_layouts/FormServer.aspx&lt;/li&gt;&lt;li&gt;Add ExtractEditingSessionId, ExtractSolutionId, and ExtractInitialCanary extraction rules&lt;/li&gt;&lt;li&gt;Substitute context variables in the postback body&lt;/li&gt;&lt;li&gt;In the web test, find requests for /_layouts/Postback.FormServer.aspx&lt;/li&gt;&lt;li&gt;Edit the EventLogInfo of the postback body as follows:&lt;/li&gt;&lt;ol&gt;
&lt;li&gt;Replace the 3rd item with {{editingSessionId}}&lt;/li&gt;&lt;li&gt;Replace the 4th item with {{solutionId}}&lt;/li&gt;&lt;li&gt;Replace the 19th item with {{canary}}&lt;/li&gt;
&lt;/ol&gt;
&lt;/ol&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32093" alt="postback substitute.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Add an Extraction Rule to the postback requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find requests for /_layouts/Postback.FormServer.aspx&lt;/li&gt;&lt;li&gt;Add ExtractPostbackCanary extraction rule to each of these requests&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;Once you have followed these steps, your web test should resemble the following picture.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32086" alt="complete webtest.jpg" /&gt;&lt;br /&gt;
&lt;/div&gt;</description><author>JBooze</author><pubDate>Fri, 25 Apr 2008 18:06:49 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20080425060649P</guid></item><item><title>UPDATED WIKI: Home</title><link>http://www.codeplex.com/ipfswebtest/Wiki/View.aspx?title=Home&amp;version=11</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
Writing a Visual Studio Web Test for InfoPath Forms Services 2007
&lt;/h1&gt;To write a Visual Studio web test for InfoPath Forms Services (IPFS), you must first understand some of IPFS’s architecture.  Before continuing, read the &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772323.aspx" class="externalLink"&gt;Forms Services Architecture article&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; on MSDN.  Pay close attention to the “Runtime Architecture” and “Rendering and Query Parameters” sections.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
InfoPath Forms Services HTTP Traffic
&lt;/h2&gt;When using an InfoPath form in the browser, a conversation between the browser and server occurs over HTTP.  This conversation consists of two kinds of transactions: Invocation and Postback.  Invocation occurs once when first opening the form.  After the form has been invoked, one or more postbacks to the server can occur.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32094" alt="IPFS HTTP traffic.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Invocation
&lt;/h2&gt;Invocation is the first transaction that occurs.  It loads all the resources that allow you to edit the form in the browser.  Invocation is started by making a GET request to FormServer.aspx.  (See How to: &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772417.aspx" class="externalLink"&gt;Use Query Parameters to Invoke Browser-Enabled InfoPath Forms&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; for more information on the format of this request).  The response includes the HTML of the form and some javascript for the form.  This request also causes requests for other dependent resources.  One of these dependent resources is core.js, which defines the core logic for form editing in the browser.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32095" alt="IPFS invocation.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Current Form Data
&lt;/h2&gt;In the browser, there is javascript running which defines several pieces of data.  In particular, there is an array named g_objCurrentFormData.  Data in this array will later be used to create a postback request.  There are three pieces of dynamic data that will be important when writing the web test: &lt;br /&gt;&lt;table&gt;
&lt;tr&gt;
&lt;th&gt; Data &lt;/th&gt;&lt;th&gt; Index of g_objCurrentFormData &lt;/th&gt;&lt;th&gt; Description &lt;/th&gt;&lt;th&gt; When does it change? &lt;/th&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Editing Session Id &lt;/td&gt;&lt;td&gt; 3 &lt;/td&gt;&lt;td&gt; Identifies your session with the server &lt;/td&gt;&lt;td&gt; When invoking a form &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Solution Id &lt;/td&gt;&lt;td&gt; 4 &lt;/td&gt;&lt;td&gt; Uniquely identifies the form template &lt;/td&gt;&lt;td&gt; When the form template has been updated &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Canary &lt;/td&gt;&lt;td&gt; 25 &lt;/td&gt;&lt;td&gt; Used for security mitigation &lt;/td&gt;&lt;td&gt; With every request/postback &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt; &lt;br /&gt;&lt;h2&gt;
Postback
&lt;/h2&gt;While you are interacting with a form in the browser, you may perform various actions such as typing in a text box or clicking a button.  These actions are recorded in an event log, using javascript.  When the form is submitted, or when logic must be performed on the server, the browser sends the event log to the server.  The server plays back the actions in the event log to recreate the state of the form.   Finally, the updated state of the form is returned to the browser and the browser refreshes its view of the data.  This transaction is known as a postback.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32096" alt="IPFS postback.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Event Log
&lt;/h2&gt;When a postback occurs, the event log is sent to the server using a POST request to Postback.FormServices.aspx.  The body of the POST request contains the event log.  The response from the server contains javascript to evaluate on the browser, which updates its view of the data.&lt;br /&gt; &lt;br /&gt;The event log follows a specific format which is described below in &lt;a href="http://en.wikipedia.org/wiki/Backus-Naur_form" class="externalLink"&gt;BNF&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.  Note that the location of spaces is important.&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLog&amp;gt; ::= &amp;lt;EventLogInfo&amp;gt; ” “ &amp;lt;Events&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLogInfo&amp;gt; ::= &amp;lt;Data0&amp;gt; “;” &amp;lt;Data1&amp;gt; “;” &amp;lt;EditingSessionId&amp;gt; “;” &amp;lt;SolutionId&amp;gt; “;” &amp;lt;Data4&amp;gt; “;” &amp;lt;Data5&amp;gt; “;” &amp;lt;Data6&amp;gt; “;” &amp;lt;Data7&amp;gt; “;” &amp;lt;Data8&amp;gt; “;” &amp;lt;Data9&amp;gt; “;” &amp;lt;Data10&amp;gt; “;” &amp;lt;Data11&amp;gt; “;” &amp;lt;Data12&amp;gt; “;” &amp;lt;Data13&amp;gt; “;” &amp;lt;Data14&amp;gt; “;” &amp;lt;Data15&amp;gt; “;” &amp;lt;Data16&amp;gt; “;” &amp;lt;Data17&amp;gt; “;” &amp;lt;Canary&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;Events&amp;gt; ::= &amp;lt;Events&amp;gt; “ “ &amp;lt;Event&amp;gt; | &amp;lt;Event&amp;gt; “ “&lt;br /&gt; &lt;br /&gt;The event log consists of two main parts: EventLogInfo and Events.  EventLogInfo is simply a list of items separated by semicolons.  Events is a list of items separated by spaces.  Each item of Events represents an action that occurred while interacting with the form.&lt;br /&gt;As you can see, the three important pieces of information from g_objCurrentFormData are used in EventLogInfo.&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Editing Session Id is at index 2&lt;/li&gt;&lt;li&gt;Solution Id is at index 3&lt;/li&gt;&lt;li&gt;Canary is at index 18&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;An example event log follows.&lt;br /&gt;&lt;b&gt;Editing Session Id&lt;/b&gt; is bolded&lt;br /&gt;&lt;i&gt;Solution Id&lt;/i&gt; is italicized&lt;br /&gt;&lt;u&gt;Canary&lt;/u&gt; is underlined&lt;br /&gt; &lt;br /&gt;8;0;&lt;b&gt;3a41917c-bc1d-409b-904a-32fb82ce565b&lt;/b&gt;;&lt;i&gt;I:5fdfe5d2-fe2b-446f-9c70-504a30b3b40f:9285a025-812e-4c2f-a194-39edbec6c50a:633415556920000000&lt;/i&gt;;0;;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2F;http%3A%2F%2Fmyserver;http%3A%2F%2Fmyserver%2Fexample%2FForms%2FAllItems.aspx;1;1;0;10;0;633415558731245000;;&lt;u&gt;xKQi13p2GSqnFUzaSU7oMSRrhdC5spPCSnMbGWAd/kp95egDGTpq2vhVf/vz4ASFTrsYvuWQIj4G68gTruRruQ==|633415558731244855&lt;/u&gt; 0;V1_I1_T1;0;Type%20some%20text 14;;false;false &lt;br /&gt; &lt;br /&gt;&lt;h1&gt;
Putting the Pieces together in Visual Studio
&lt;/h1&gt;Now that we have a general idea how IPFS generates HTTP traffic, we can write a web test in Visual Studio.  Let’s recap the relevant IPFS architecture information:&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;IPFS has two main transactions when interacting with a form: Invocation and Postback&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are dynamic.  They will need to be extracted from responses.&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are used in the postback request.  Their values will need to be substituted in the postback body.&lt;/li&gt;&lt;li&gt;Editing Session Id and Solution Id do not change between postbacks.  They will only need to be extracted for the invocation request.&lt;/li&gt;&lt;li&gt;Canary changes after every postback.  It needs to be extracted for every request.&lt;/li&gt;
&lt;/ul&gt;We have all the required knowledge; we just need to put the pieces together.  The basic steps to write a web test for IPFS are:&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Use &lt;a href="http://www.fiddlertool.com/fiddler/" class="externalLink"&gt;Fiddler&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; to capture HTTP requests&lt;/li&gt;&lt;li&gt;Use the captured information to define requests in a web test&lt;/li&gt;&lt;li&gt;Add Extraction Rules to the invocation request&lt;/li&gt;&lt;li&gt;Substitute context variables in the postback bodys&lt;/li&gt;&lt;li&gt;Add an Extraction Rule to the postback requests&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use Fiddler to capture HTTP requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start &lt;a href="http://www.fiddlertool.com/fiddler/" class="externalLink"&gt;Fiddler&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32084" alt="start fiddler.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Start capturing&lt;/li&gt;&lt;li&gt;Open an InfoPath form in a web browser &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32091" alt="open form.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Perform the actions you want to happen in your test &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32092" alt="perform actions in browser.jpg" /&gt;&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use the captured information to define requests in a web test
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start Visual Studio&lt;/li&gt;&lt;li&gt;Create a new web test&lt;/li&gt;&lt;li&gt;Add an InfoPathExtractionRules reference to the test project.  (You can download a dll for InfoPathExtractionRules from the Releases tab of this project.  Or you can download the source code for those rules on the Source Code tab.)&lt;/li&gt;&lt;li&gt;From the fiddler capture, find the request for /_layouts/FormServer.aspx &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32089" alt="fiddler invocation selected.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Add that request to the web test &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32087" alt="create invocation request.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Find requests for /_layouts/Postback.FormServer.aspx &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32090" alt="fiddler postback selected.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Add those requests to the web test.  Be sure to copy the postback body.  Note that these will be web service requests. &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32088" alt="create postback request.jpg" /&gt;&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Add Extraction Rules to the invocation request
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find the request for /_layouts/FormServer.aspx&lt;/li&gt;&lt;li&gt;Add ExtractEditingSessionId, ExtractSolutionId, and ExtractInitialCanary extraction rules&lt;/li&gt;&lt;li&gt;Substitute context variables in the postback body&lt;/li&gt;&lt;li&gt;In the web test, find requests for /_layouts/Postback.FormServer.aspx&lt;/li&gt;&lt;li&gt;Edit the EventLogInfo of the postback body as follows:&lt;/li&gt;&lt;ol&gt;
&lt;li&gt;Replace the 3rd item with {{editingSessionId}}&lt;/li&gt;&lt;li&gt;Replace the 4th item with {{solutionId}}&lt;/li&gt;&lt;li&gt;Replace the 19th item with {{canary}}&lt;/li&gt;
&lt;/ol&gt;
&lt;/ol&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32093" alt="postback substitute.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Add an Extraction Rule to the postback requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find requests for /_layouts/Postback.FormServer.aspx&lt;/li&gt;&lt;li&gt;Add ExtractPostbackCanary extraction rule to each of these requests&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;Once you have followed these steps, your web test should resemble the following picture.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32086" alt="complete webtest.jpg" /&gt;&lt;br /&gt;
&lt;/div&gt;</description><author>JBooze</author><pubDate>Thu, 24 Apr 2008 21:27:55 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20080424092755P</guid></item><item><title>UPDATED WIKI: Home</title><link>http://www.codeplex.com/ipfswebtest/Wiki/View.aspx?title=Home&amp;version=10</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
Writing a Visual Studio Web Test for InfoPath Forms Services 2007
&lt;/h1&gt;To write a Visual Studio web test for InfoPath Forms Services (IPFS), you must first understand some of IPFS’s architecture.  Before continuing, read the &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772323.aspx" class="externalLink"&gt;Forms Services Architecture article&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; on MSDN.  Pay close attention to the “Runtime Architecture” and “Rendering and Query Parameters” sections.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
InfoPath Forms Services HTTP Traffic
&lt;/h2&gt;When using an InfoPath form in the browser, a conversation between the browser and server occurs over HTTP.  This conversation consists of two kinds of transactions: Invocation and Postback.  Invocation occurs once when first opening the form.  After the form has been invoked, one or more postbacks to the server can occur.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32094" alt="IPFS HTTP traffic.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Invocation
&lt;/h2&gt;Invocation is the first transaction that occurs.  It loads all the resources that allow you to edit the form in the browser.  Invocation is started by making a GET request to FormServer.aspx.  (See How to: &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772417.aspx" class="externalLink"&gt;Use Query Parameters to Invoke Browser-Enabled InfoPath Forms&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; for more information on the format of this request).  The response includes the HTML of the form and some javascript for the form.  This request also causes requests for other dependent resources.  One of these dependent resources is core.js, which defines the core logic for form editing in the browser.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32095" alt="IPFS invocation.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Current Form Data
&lt;/h2&gt;In the browser, there is javascript running which defines several pieces of data.  In particular, there is an array named g_objCurrentFormData.  Data in this array will later be used to create a postback request.  There are three pieces of dynamic data that will be important when writing the web test: &lt;br /&gt;&lt;table&gt;
&lt;tr&gt;
&lt;th&gt; Data &lt;/th&gt;&lt;th&gt; Index of g_objCurrentFormData &lt;/th&gt;&lt;th&gt; Description &lt;/th&gt;&lt;th&gt; When does it change? &lt;/th&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Editing Session Id &lt;/td&gt;&lt;td&gt; 3 &lt;/td&gt;&lt;td&gt; Identifies your session with the server &lt;/td&gt;&lt;td&gt; When invoking a form &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Solution Id &lt;/td&gt;&lt;td&gt; 4 &lt;/td&gt;&lt;td&gt; Uniquely identifies the form template &lt;/td&gt;&lt;td&gt; When the form template has been updated &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Canary &lt;/td&gt;&lt;td&gt; 25 &lt;/td&gt;&lt;td&gt; Used for security mitigation &lt;/td&gt;&lt;td&gt; With every request/postback &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt; &lt;br /&gt;&lt;h2&gt;
Postback
&lt;/h2&gt;While you are interacting with a form in the browser, you may perform various actions such as typing in a text box or clicking a button.  These actions are recorded in an event log, using javascript.  When the form is submitted, or when logic must be performed on the server, the browser sends the event log to the server.  The server plays back the actions in the event log to recreate the state of the form.   Finally, the updated state of the form is returned to the browser and the browser refreshes its view of the data.  This transaction is known as a postback.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32096" alt="IPFS postback.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Event Log
&lt;/h2&gt;When a postback occurs, the event log is sent to the server using a POST request to Postback.FormServices.aspx.  The body of the POST request contains the event log.  The response from the server contains javascript to evaluate on the browser, which updates its view of the data.&lt;br /&gt; &lt;br /&gt;The event log follows a specific format which is described below in &lt;a href="http://en.wikipedia.org/wiki/Backus-Naur_form" class="externalLink"&gt;BNF&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.  Note that the location of spaces is important.&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLog&amp;gt; ::= &amp;lt;EventLogInfo&amp;gt; ” “ &amp;lt;Events&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLogInfo&amp;gt; ::= &amp;lt;Data0&amp;gt; “;” &amp;lt;Data1&amp;gt; “;” &amp;lt;EditingSessionId&amp;gt; “;” &amp;lt;SolutionId&amp;gt; “;” &amp;lt;Data4&amp;gt; “;” &amp;lt;Data5&amp;gt; “;” &amp;lt;Data6&amp;gt; “;” &amp;lt;Data7&amp;gt; “;” &amp;lt;Data8&amp;gt; “;” &amp;lt;Data9&amp;gt; “;” &amp;lt;Data10&amp;gt; “;” &amp;lt;Data11&amp;gt; “;” &amp;lt;Data12&amp;gt; “;” &amp;lt;Data13&amp;gt; “;” &amp;lt;Data14&amp;gt; “;” &amp;lt;Data15&amp;gt; “;” &amp;lt;Data16&amp;gt; “;” &amp;lt;Data17&amp;gt; “;” &amp;lt;Canary&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;Events&amp;gt; ::= &amp;lt;Events&amp;gt; “ “ &amp;lt;Event&amp;gt; | &amp;lt;Event&amp;gt; “ “&lt;br /&gt; &lt;br /&gt;The event log consists of two main parts: EventLogInfo and Events.  EventLogInfo is simply a list of items separated by semicolons.  Events is a list of items separated by spaces.  Each item of Events represents an action that occurred while interacting with the form.&lt;br /&gt;As you can see, the three important pieces of information from g_objCurrentFormData are used in EventLogInfo.&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Editing Session Id is at index 2&lt;/li&gt;&lt;li&gt;Solution Id is at index 3&lt;/li&gt;&lt;li&gt;Canary is at index 18&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;An example event log follows.&lt;br /&gt;&lt;b&gt;Editing Session Id&lt;/b&gt; is bolded&lt;br /&gt;&lt;i&gt;Solution Id&lt;/i&gt; is italicized&lt;br /&gt;&lt;u&gt;Canary&lt;/u&gt; is underlined&lt;br /&gt; &lt;br /&gt;8;0;&lt;b&gt;3a41917c-bc1d-409b-904a-32fb82ce565b&lt;/b&gt;;&lt;i&gt;I:5fdfe5d2-fe2b-446f-9c70-504a30b3b40f:9285a025-812e-4c2f-a194-39edbec6c50a:633415556920000000&lt;/i&gt;;0;;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2F;http%3A%2F%2Fmyserver;http%3A%2F%2Fmyserver%2Fexample%2FForms%2FAllItems.aspx;1;1;0;10;0;633415558731245000;;&lt;u&gt;xKQi13p2GSqnFUzaSU7oMSRrhdC5spPCSnMbGWAd/kp95egDGTpq2vhVf/vz4ASFTrsYvuWQIj4G68gTruRruQ==|633415558731244855&lt;/u&gt; 0;V1_I1_T1;0;Type%20some%20text 14;;false;false &lt;br /&gt; &lt;br /&gt;&lt;h1&gt;
Putting the Pieces together in Visual Studio
&lt;/h1&gt;Now that we have a general idea how IPFS generates HTTP traffic, we can write a web test in Visual Studio.  Let’s recap the relevant IPFS architecture information:&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;IPFS has two main transactions when interacting with a form: Invocation and Postback&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are dynamic.  They will need to be extracted from responses.&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are used in the postback request.  Their values will need to be substituted in the postback body.&lt;/li&gt;&lt;li&gt;Editing Session Id and Solution Id do not change between postbacks.  They will only need to be extracted for the invocation request.&lt;/li&gt;&lt;li&gt;Canary changes after every postback.  It needs to be extracted for every request.&lt;/li&gt;
&lt;/ul&gt;We have all the required knowledge; we just need to put the pieces together.  The basic steps to write a web test for IPFS are:&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Use &lt;a href="http://www.fiddlertool.com/fiddler/" class="externalLink"&gt;Fiddler&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; to capture HTTP requests&lt;/li&gt;&lt;li&gt;Use the captured information to define requests in a web test&lt;/li&gt;&lt;li&gt;Add Extraction Rules to the invocation request&lt;/li&gt;&lt;li&gt;Substitute context variables in the postback bodys&lt;/li&gt;&lt;li&gt;Add an Extraction Rule to the postback requests&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use Fiddler to capture HTTP requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start &lt;a href="http://www.fiddlertool.com/fiddler/" class="externalLink"&gt;Fiddler&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32084" alt="start fiddler.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Start capturing&lt;/li&gt;&lt;li&gt;Open an InfoPath form in a web browser &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32091" alt="open form.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Perform the actions you want to happen in your test &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32092" alt="perform actions in browser.jpg" /&gt;&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use the captured information to define requests in a web test
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start Visual Studio&lt;/li&gt;&lt;li&gt;Create a new web test&lt;/li&gt;&lt;li&gt;Add an InfoPathExtractionRules reference to the test project&lt;/li&gt;&lt;li&gt;From the fiddler capture, find the request for /_layouts/FormServer.aspx &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32089" alt="fiddler invocation selected.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Add that request to the web test &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32087" alt="create invocation request.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Find requests for /_layouts/Postback.FormServer.aspx &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32090" alt="fiddler postback selected.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Add those requests to the web test.  Be sure to copy the postback body.  Note that these will be web service requests. &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32088" alt="create postback request.jpg" /&gt;&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Add Extraction Rules to the invocation request
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find the request for /_layouts/FormServer.aspx&lt;/li&gt;&lt;li&gt;Add ExtractEditingSessionId, ExtractSolutionId, and ExtractInitialCanary extraction rules&lt;/li&gt;&lt;li&gt;Substitute context variables in the postback body&lt;/li&gt;&lt;li&gt;In the web test, find requests for /_layouts/Postback.FormServer.aspx&lt;/li&gt;&lt;li&gt;Edit the EventLogInfo of the postback body as follows:&lt;/li&gt;&lt;ol&gt;
&lt;li&gt;Replace the 3rd item with {{editingSessionId}}&lt;/li&gt;&lt;li&gt;Replace the 4th item with {{solutionId}}&lt;/li&gt;&lt;li&gt;Replace the 19th item with {{canary}}&lt;/li&gt;
&lt;/ol&gt;
&lt;/ol&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32093" alt="postback substitute.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Add an Extraction Rule to the postback requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find requests for /_layouts/Postback.FormServer.aspx&lt;/li&gt;&lt;li&gt;Add ExtractPostbackCanary extraction rule to each of these requests&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;Once you have followed these steps, your web test should resemble the following picture.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32086" alt="complete webtest.jpg" /&gt;&lt;br /&gt;
&lt;/div&gt;</description><author>JBooze</author><pubDate>Wed, 23 Apr 2008 04:55:12 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20080423045512A</guid></item><item><title>UPDATED WIKI: Home</title><link>http://www.codeplex.com/ipfswebtest/Wiki/View.aspx?title=Home&amp;version=9</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
Writing a Visual Studio Web Test for InfoPath Forms Services 2007
&lt;/h1&gt;To write a Visual Studio web test for InfoPath Forms Services (IPFS), you must first understand some of IPFS’s architecture.  Before continuing, read the &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772323.aspx" class="externalLink"&gt;Forms Services Architecture article&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; on MSDN.  Pay close attention to the “Runtime Architecture” and “Rendering and Query Parameters” sections.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
InfoPath Forms Services HTTP Traffic
&lt;/h2&gt;When using an InfoPath form in the browser, a conversation between the browser and server occurs over HTTP.  This conversation consists of two kinds of transactions: Invocation and Postback.  Invocation occurs once when first opening the form.  After the form has been invoked, one or more postbacks to the server can occur.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32094" alt="IPFS HTTP traffic.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Invocation
&lt;/h2&gt;Invocation is the first transaction that occurs.  It loads all the resources that allow you to edit the form in the browser.  Invocation is started by making a GET request to FormServer.aspx.  (See How to: &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772417.aspx" class="externalLink"&gt;Use Query Parameters to Invoke Browser-Enabled InfoPath Forms&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; for more information on the format of this request).  The response includes the HTML of the form and some javascript for the form.  This request also causes requests for other dependent resources.  One of these dependent resources is core.js, which defines the core logic for form editing in the browser.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32095" alt="IPFS invocation.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Current Form Data
&lt;/h2&gt;In the browser, there is javascript running which defines several pieces of data.  In particular, there is an array named g_objCurrentFormData.  Data in this array will later be used to create a postback request.  There are three pieces of dynamic data that will be important when writing the web test: &lt;br /&gt;&lt;table&gt;
&lt;tr&gt;
&lt;th&gt; Data &lt;/th&gt;&lt;th&gt; Index of g_objCurrentFormData &lt;/th&gt;&lt;th&gt; Description &lt;/th&gt;&lt;th&gt; When does it change? &lt;/th&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Editing Session Id &lt;/td&gt;&lt;td&gt; 3 &lt;/td&gt;&lt;td&gt; Identifies your session with the server &lt;/td&gt;&lt;td&gt; When invoking a form &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Solution Id &lt;/td&gt;&lt;td&gt; 4 &lt;/td&gt;&lt;td&gt; Uniquely identifies the form template &lt;/td&gt;&lt;td&gt; When the form template has been updated &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Canary &lt;/td&gt;&lt;td&gt; 25 &lt;/td&gt;&lt;td&gt; Used for security mitigation &lt;/td&gt;&lt;td&gt; With every request/postback &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt; &lt;br /&gt;&lt;h2&gt;
Postback
&lt;/h2&gt;While you are interacting with a form in the browser, you may perform various actions such as typing in a text box or clicking a button.  These actions are recorded in an event log, using javascript.  When the form is submitted, or when logic must be performed on the server, the browser sends the event log to the server.  The server plays back the actions in the event log to recreate the state of the form.   Finally, the updated state of the form is returned to the browser and the browser refreshes its view of the data.  This transaction is known as a postback.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32096" alt="IPFS postback.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Event Log
&lt;/h2&gt;When a postback occurs, the event log is sent to the server using a POST request to Postback.FormServices.aspx.  The body of the POST request contains the event log.  The response from the server contains javascript to evaluate on the browser, which updates its view of the data.&lt;br /&gt; &lt;br /&gt;The event log follows a specific format which is described below in &lt;a href="http://en.wikipedia.org/wiki/Backus-Naur_form" class="externalLink"&gt;BNF&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.  Note that the location of spaces is important.&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLog&amp;gt; ::= &amp;lt;EventLogInfo&amp;gt; ” “ &amp;lt;Events&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLogInfo&amp;gt; ::= &amp;lt;Data0&amp;gt; “;” &amp;lt;Data1&amp;gt; “;” &amp;lt;EditingSessionId&amp;gt; “;” &amp;lt;SolutionId&amp;gt; “;” &amp;lt;Data4&amp;gt; “;” &amp;lt;Data5&amp;gt; “;” &amp;lt;Data6&amp;gt; “;” &amp;lt;Data7&amp;gt; “;” &amp;lt;Data8&amp;gt; “;” &amp;lt;Data9&amp;gt; “;” &amp;lt;Data10&amp;gt; “;” &amp;lt;Data11&amp;gt; “;” &amp;lt;Data12&amp;gt; “;” &amp;lt;Data13&amp;gt; “;” &amp;lt;Data14&amp;gt; “;” &amp;lt;Data15&amp;gt; “;” &amp;lt;Data16&amp;gt; “;” &amp;lt;Data17&amp;gt; “;” &amp;lt;Canary&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;Events&amp;gt; ::= &amp;lt;Events&amp;gt; “ “ &amp;lt;Event&amp;gt; | &amp;lt;Event&amp;gt; “ “&lt;br /&gt; &lt;br /&gt;The event log consists of two main parts: EventLogInfo and Events.  EventLogInfo is simply a list of items separated by semicolons.  Events is a list of items separated by spaces.  Each item of Events represents an action that occurred while interacting with the form.&lt;br /&gt;As you can see, the three important pieces of information from g_objCurrentFormData are used in EventLogInfo.&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Editing Session Id is at index 2&lt;/li&gt;&lt;li&gt;Solution Id is at index 3&lt;/li&gt;&lt;li&gt;Canary is at index 18&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;An example event log follows.&lt;br /&gt;&lt;b&gt;Editing Session Id&lt;/b&gt; is bolded&lt;br /&gt;&lt;i&gt;Solution Id&lt;/i&gt; is italicized&lt;br /&gt;&lt;u&gt;Canary&lt;/u&gt; is underlined&lt;br /&gt; &lt;br /&gt;8;0;&lt;b&gt;3a41917c-bc1d-409b-904a-32fb82ce565b&lt;/b&gt;;&lt;i&gt;I:5fdfe5d2-fe2b-446f-9c70-504a30b3b40f:9285a025-812e-4c2f-a194-39edbec6c50a:633415556920000000&lt;/i&gt;;0;;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2F;http%3A%2F%2Fmyserver;http%3A%2F%2Fmyserver%2Fexample%2FForms%2FAllItems.aspx;1;1;0;10;0;633415558731245000;;&lt;u&gt;xKQi13p2GSqnFUzaSU7oMSRrhdC5spPCSnMbGWAd/kp95egDGTpq2vhVf/vz4ASFTrsYvuWQIj4G68gTruRruQ==|633415558731244855&lt;/u&gt; 0;V1_I1_T1;0;Type%20some%20text 14;;false;false &lt;br /&gt; &lt;br /&gt;&lt;h1&gt;
Putting the Pieces together in Visual Studio
&lt;/h1&gt;Now that we have a general idea how IPFS generates HTTP traffic, we can write a web test in Visual Studio.  Let’s recap the relevant IPFS architecture information:&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;IPFS has two main transactions when interacting with a form: Invocation and Postback&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are dynamic.  They will need to be extracted from responses.&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are used in the postback request.  Their values will need to be substituted in the postback body.&lt;/li&gt;&lt;li&gt;Editing Session Id and Solution Id do not change between postbacks.  They will only need to be extracted for the invocation request.&lt;/li&gt;&lt;li&gt;Canary changes after every postback.  It needs to be extracted for every request.&lt;/li&gt;
&lt;/ul&gt;We have all the required knowledge; we just need to put the pieces together.  The basic steps to write a web test for IPFS are:&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Use Fiddler to capture HTTP requests&lt;/li&gt;&lt;li&gt;Use the captured information to define requests in a web test&lt;/li&gt;&lt;li&gt;Add Extraction Rules to the invocation request&lt;/li&gt;&lt;li&gt;Substitute context variables in the postback bodys&lt;/li&gt;&lt;li&gt;Add an Extraction Rule to the postback requests&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use Fiddler to capture HTTP requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start Fiddler &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32084" alt="start fiddler.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Start capturing&lt;/li&gt;&lt;li&gt;Open an InfoPath form in a web browser &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32091" alt="open form.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Perform the actions you want to happen in your test &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32092" alt="perform actions in browser.jpg" /&gt;&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use the captured information to define requests in a web test
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start Visual Studio&lt;/li&gt;&lt;li&gt;Create a new web test&lt;/li&gt;&lt;li&gt;Add an InfoPathExtractionRules reference to the test project&lt;/li&gt;&lt;li&gt;From the fiddler capture, find the request for /_layouts/FormServer.aspx &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32089" alt="fiddler invocation selected.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Add that request to the web test &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32087" alt="create invocation request.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Find requests for /_layouts/Postback.FormServer.aspx &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32090" alt="fiddler postback selected.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Add those requests to the web test.  Be sure to copy the postback body.  Note that these will be web service requests. &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32088" alt="create postback request.jpg" /&gt;&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Add Extraction Rules to the invocation request
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find the request for /_layouts/FormServer.aspx&lt;/li&gt;&lt;li&gt;Add ExtractEditingSessionId, ExtractSolutionId, and ExtractInitialCanary extraction rules&lt;/li&gt;&lt;li&gt;Substitute context variables in the postback body&lt;/li&gt;&lt;li&gt;In the web test, find requests for /_layouts/Postback.FormServer.aspx&lt;/li&gt;&lt;li&gt;Edit the EventLogInfo of the postback body as follows:&lt;/li&gt;&lt;ol&gt;
&lt;li&gt;Replace the 3rd item with {{editingSessionId}}&lt;/li&gt;&lt;li&gt;Replace the 4th item with {{solutionId}}&lt;/li&gt;&lt;li&gt;Replace the 19th item with {{canary}}&lt;/li&gt;
&lt;/ol&gt;
&lt;/ol&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32093" alt="postback substitute.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Add an Extraction Rule to the postback requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find requests for /_layouts/Postback.FormServer.aspx&lt;/li&gt;&lt;li&gt;Add ExtractPostbackCanary extraction rule to each of these requests&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;Once you have followed these steps, your web test should resemble the following picture.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32086" alt="complete webtest.jpg" /&gt;&lt;br /&gt;
&lt;/div&gt;</description><author>JBooze</author><pubDate>Wed, 23 Apr 2008 04:44:37 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20080423044437A</guid></item><item><title>UPDATED WIKI: Home</title><link>http://www.codeplex.com/ipfswebtest/Wiki/View.aspx?title=Home&amp;version=8</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
Writing a Visual Studio Web Test for InfoPath Forms Services 2007
&lt;/h1&gt;To write a Visual Studio web test for InfoPath Forms Services (IPFS), you must first understand some of IPFS’s architecture.  Before continuing, read the &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772323.aspx" class="externalLink"&gt;Forms Services Architecture article&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; on MSDN.  Pay close attention to the “Runtime Architecture” and “Rendering and Query Parameters” sections.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
InfoPath Forms Services HTTP Traffic
&lt;/h2&gt;When using an InfoPath form in the browser, a conversation between the browser and server occurs over HTTP.  This conversation consists of two kinds of transactions: Invocation and Postback.  Invocation occurs once when first opening the form.  After the form has been invoked, one or more postbacks to the server can occur.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32094" alt="IPFS HTTP traffic.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Invocation
&lt;/h2&gt;Invocation is the first transaction that occurs.  It loads all the resources that allow you to edit the form in the browser.  Invocation is started by making a GET request to FormServer.aspx.  (See How to: &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772417.aspx" class="externalLink"&gt;Use Query Parameters to Invoke Browser-Enabled InfoPath Forms&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; for more information on the format of this request).  The response includes the HTML of the form and some javascript for the form.  This request also causes requests for other dependent resources.  One of these dependent resources is core.js, which defines the core logic for form editing in the browser.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32095" alt="IPFS invocation.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Current Form Data
&lt;/h2&gt;In the browser, there is javascript running which defines several pieces of data.  In particular, there is an array named g_objCurrentFormData.  Data in this array will later be used to create a postback request.  There are three pieces of dynamic data that will be important when writing the web test: &lt;br /&gt;&lt;table&gt;
&lt;tr&gt;
&lt;th&gt; Data &lt;/th&gt;&lt;th&gt; Index of g_objCurrentFormData &lt;/th&gt;&lt;th&gt; Description &lt;/th&gt;&lt;th&gt; When does it change? &lt;/th&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Editing Session Id &lt;/td&gt;&lt;td&gt; 3 &lt;/td&gt;&lt;td&gt; Identifies your session with the server &lt;/td&gt;&lt;td&gt; When invoking a form &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Solution Id &lt;/td&gt;&lt;td&gt; 4 &lt;/td&gt;&lt;td&gt; Uniquely identifies the form template &lt;/td&gt;&lt;td&gt; When the form template has been updated &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Canary &lt;/td&gt;&lt;td&gt; 25 &lt;/td&gt;&lt;td&gt; Used for security mitigation &lt;/td&gt;&lt;td&gt; With every request/postback &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt; &lt;br /&gt;&lt;h2&gt;
Postback
&lt;/h2&gt;While you are interacting with a form in the browser, you may perform various actions such as typing in a text box or clicking a button.  These actions are recorded in an event log, using javascript.  When the form is submitted, or when logic must be performed on the server, the browser sends the event log to the server.  The server plays back the actions in the event log to recreate the state of the form.   Finally, the updated state of the form is returned to the browser and the browser refreshes its view of the data.  This transaction is known as a postback.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32096" alt="IPFS postback.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Event Log
&lt;/h2&gt;When a postback occurs, the event log is sent to the server using a POST request to Postback.FormServices.aspx.  The body of the POST request contains the event log.  The response from the server contains javascript to evaluate on the browser, which updates its view of the data.&lt;br /&gt; &lt;br /&gt;The event log follows a specific format which is described below in &lt;a href="http://en.wikipedia.org/wiki/Backus-Naur_form" class="externalLink"&gt;BNF&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.  Note that the location of spaces is important.&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLog&amp;gt; ::= &amp;lt;EventLogInfo&amp;gt; ” “ &amp;lt;Events&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLogInfo&amp;gt; ::= &amp;lt;Data0&amp;gt; “;” &amp;lt;Data1&amp;gt; “;” &amp;lt;EditingSessionId&amp;gt; “;” &amp;lt;SolutionId&amp;gt; “;” &amp;lt;Data4&amp;gt; “;” &amp;lt;Data5&amp;gt; “;” &amp;lt;Data6&amp;gt; “;” &amp;lt;Data7&amp;gt; “;” &amp;lt;Data8&amp;gt; “;” &amp;lt;Data9&amp;gt; “;” &amp;lt;Data10&amp;gt; “;” &amp;lt;Data11&amp;gt; “;” &amp;lt;Data12&amp;gt; “;” &amp;lt;Data13&amp;gt; “;” &amp;lt;Data14&amp;gt; “;” &amp;lt;Data15&amp;gt; “;” &amp;lt;Data16&amp;gt; “;” &amp;lt;Data17&amp;gt; “;” &amp;lt;Canary&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;Events&amp;gt; ::= &amp;lt;Events&amp;gt; “ “ &amp;lt;Event&amp;gt; | &amp;lt;Event&amp;gt; “ “&lt;br /&gt; &lt;br /&gt;The event log consists of two main parts: EventLogInfo and Events.  EventLogInfo is simply a list of items separated by semicolons.  Events is a list of items separated by spaces.  Each item of Events represents an action that occurred while interacting with the form.&lt;br /&gt;As you can see, the three important pieces of information from g_objCurrentFormData are used in EventLogInfo.&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Editing Session Id is at index 2&lt;/li&gt;&lt;li&gt;Solution Id is at index 3&lt;/li&gt;&lt;li&gt;Canary is at index 18&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;An example event log follows.&lt;br /&gt;&lt;b&gt;Editing Session Id&lt;/b&gt; is bolded&lt;br /&gt;&lt;i&gt;Solution Id&lt;/i&gt; is italicized&lt;br /&gt;&lt;u&gt;Canary&lt;/u&gt; is underlined&lt;br /&gt; &lt;br /&gt;8;0;&lt;b&gt;3a41917c-bc1d-409b-904a-32fb82ce565b&lt;/b&gt;;&lt;i&gt;I:5fdfe5d2-fe2b-446f-9c70-504a30b3b40f:9285a025-812e-4c2f-a194-39edbec6c50a:633415556920000000&lt;/i&gt;;0;;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2F;http%3A%2F%2Fmyserver;http%3A%2F%2Fmyserver%2Fexample%2FForms%2FAllItems.aspx;1;1;0;10;0;633415558731245000;;&lt;u&gt;xKQi13p2GSqnFUzaSU7oMSRrhdC5spPCSnMbGWAd/kp95egDGTpq2vhVf/vz4ASFTrsYvuWQIj4G68gTruRruQ==|633415558731244855&lt;/u&gt; 0;V1_I1_T1;0;Type%20some%20text 14;;false;false &lt;br /&gt; &lt;br /&gt;&lt;h1&gt;
Putting the Pieces together in Visual Studio
&lt;/h1&gt;Now that we have a general idea how IPFS generates HTTP traffic, we can write a web test in Visual Studio.  Let’s recap the relevant IPFS architecture information:&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;IPFS has two main transactions when interacting with a form: Invocation and Postback&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are dynamic.  They will need to be extracted from responses.&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are used in the postback request.  Their values will need to be substituted in the postback body.&lt;/li&gt;&lt;li&gt;Editing Session Id and Solution Id do not change between postbacks.  They will only need to be extracted for the invocation request.&lt;/li&gt;&lt;li&gt;Canary changes after every postback.  It needs to be extracted for every request.&lt;/li&gt;
&lt;/ul&gt;We have all the required knowledge; we just need to put the pieces together.  The basic steps to write a web test for IPFS are:&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Use Fiddler to capture HTTP requests&lt;/li&gt;&lt;li&gt;Use the captured information to define requests in a web test&lt;/li&gt;&lt;li&gt;Add Extraction Rules to the invocation request&lt;/li&gt;&lt;li&gt;Substitute context variables in the postback bodys&lt;/li&gt;&lt;li&gt;Add an Extraction Rule to the postback requests&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use Fiddler to capture HTTP requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start Fiddler &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32084" alt="start fiddler.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Start capturing&lt;/li&gt;&lt;li&gt;Open an InfoPath form in a web browser &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32091" alt="open form.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Perform the actions you want to happen in your test &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32092" alt="perform actions in browser.jpg" /&gt;&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use the captured information to define requests in a web test
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start Visual Studio&lt;/li&gt;&lt;li&gt;Create a new web test&lt;/li&gt;&lt;li&gt;Add an InfoPathExtractionRules reference to the test project&lt;/li&gt;&lt;li&gt;From the fiddler capture, find the request for /_layouts/FormServer.aspx &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32090" alt="fiddler postback selected.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Add that request to the web test &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32087" alt="create invocation request.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Find requests for /_layouts/Postback.FormServer.aspx &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32090" alt="fiddler postback selected.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Add those requests to the web test.  Be sure to copy the postback body.  Note that these will be web service requests. &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32088" alt="create postback request.jpg" /&gt;&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Add Extraction Rules to the invocation request
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find the request for /_layouts/FormServer.aspx&lt;/li&gt;&lt;li&gt;Add ExtractEditingSessionId, ExtractSolutionId, and ExtractInitialCanary extraction rules&lt;/li&gt;&lt;li&gt;Substitute context variables in the postback body&lt;/li&gt;&lt;li&gt;In the web test, find requests for /_layouts/Postback.FormServer.aspx&lt;/li&gt;&lt;li&gt;Edit the EventLogInfo of the postback body as follows:&lt;/li&gt;&lt;ol&gt;
&lt;li&gt;Replace the 3rd item with {{editingSessionId}}&lt;/li&gt;&lt;li&gt;Replace the 4th item with {{solutionId}}&lt;/li&gt;&lt;li&gt;Replace the 19th item with {{canary}}&lt;/li&gt;
&lt;/ol&gt;
&lt;/ol&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32093" alt="postback substitute.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Add an Extraction Rule to the postback requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find requests for /_layouts/Postback.FormServer.aspx&lt;/li&gt;&lt;li&gt;Add ExtractPostbackCanary extraction rule to each of these requests&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;Once you have followed these steps, your web test should resemble the following picture.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32086" alt="complete webtest.jpg" /&gt;&lt;br /&gt;
&lt;/div&gt;</description><author>JBooze</author><pubDate>Wed, 23 Apr 2008 04:30:15 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20080423043015A</guid></item><item><title>UPDATED WIKI: Home</title><link>http://www.codeplex.com/ipfswebtest/Wiki/View.aspx?title=Home&amp;version=7</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
Writing a Visual Studio Web Test for InfoPath Forms Services 2007
&lt;/h1&gt;To write a Visual Studio web test for InfoPath Forms Services (IPFS), you must first understand some of IPFS’s architecture.  Before continuing, read the &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772323.aspx" class="externalLink"&gt;Forms Services Architecture article&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; on MSDN.  Pay close attention to the “Runtime Architecture” and “Rendering and Query Parameters” sections.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
InfoPath Forms Services HTTP Traffic
&lt;/h2&gt;When using an InfoPath form in the browser, a conversation between the browser and server occurs over HTTP.  This conversation consists of two kinds of transactions: Invocation and Postback.  Invocation occurs once when first opening the form.  After the form has been invoked, one or more postbacks to the server can occur.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32094" alt="IPFS HTTP traffic.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Invocation
&lt;/h2&gt;Invocation is the first transaction that occurs.  It loads all the resources that allow you to edit the form in the browser.  Invocation is started by making a GET request to FormServer.aspx.  (See How to: &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772417.aspx" class="externalLink"&gt;Use Query Parameters to Invoke Browser-Enabled InfoPath Forms&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; for more information on the format of this request).  The response includes the HTML of the form and some javascript for the form.  This request also causes requests for other dependent resources.  One of these dependent resources is core.js, which defines the core logic for form editing in the browser.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32095" alt="IPFS invocation.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Current Form Data
&lt;/h2&gt;In the browser, there is javascript running which defines several pieces of data.  In particular, there is an array named g_objCurrentFormData.  Data in this array will later be used to create a postback request.  There are three pieces of dynamic data that will be important when writing the web test: &lt;br /&gt;&lt;table&gt;
&lt;tr&gt;
&lt;th&gt; Data &lt;/th&gt;&lt;th&gt; Index of g_objCurrentFormData &lt;/th&gt;&lt;th&gt; Description &lt;/th&gt;&lt;th&gt; When does it change? &lt;/th&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Editing Session Id &lt;/td&gt;&lt;td&gt; 3 &lt;/td&gt;&lt;td&gt; Identifies your session with the server &lt;/td&gt;&lt;td&gt; When invoking a form &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Solution Id &lt;/td&gt;&lt;td&gt; 4 &lt;/td&gt;&lt;td&gt; Uniquely identifies the form template &lt;/td&gt;&lt;td&gt; When the form template has been updated &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Canary &lt;/td&gt;&lt;td&gt; 25 &lt;/td&gt;&lt;td&gt; Used for security mitigation &lt;/td&gt;&lt;td&gt; With every request/postback &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt; &lt;br /&gt;&lt;h2&gt;
Postback
&lt;/h2&gt;While you are interacting with a form in the browser, you may perform various actions such as typing in a text box or clicking a button.  These actions are recorded in an event log, using javascript.  When the form is submitted, or when logic must be performed on the server, the browser sends the event log to the server.  The server plays back the actions in the event log to recreate the state of the form.   Finally, the updated state of the form is returned to the browser and the browser refreshes its view of the data.  This transaction is known as a postback.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32096" alt="IPFS postback.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Event Log
&lt;/h2&gt;When a postback occurs, the event log is sent to the server using a POST request to Postback.FormServices.aspx.  The body of the POST request contains the event log.  The response from the server contains javascript to evaluate on the browser, which updates its view of the data.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32096" alt="IPFS postback.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;The event log follows a specific format which is described below in &lt;a href="http://en.wikipedia.org/wiki/Backus-Naur_form" class="externalLink"&gt;BNF&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.  Note that the location of spaces is important.&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLog&amp;gt; ::= &amp;lt;EventLogInfo&amp;gt; ” “ &amp;lt;Events&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLogInfo&amp;gt; ::= &amp;lt;Data0&amp;gt; “;” &amp;lt;Data1&amp;gt; “;” &amp;lt;EditingSessionId&amp;gt; “;” &amp;lt;SolutionId&amp;gt; “;” &amp;lt;Data4&amp;gt; “;” &amp;lt;Data5&amp;gt; “;” &amp;lt;Data6&amp;gt; “;” &amp;lt;Data7&amp;gt; “;” &amp;lt;Data8&amp;gt; “;” &amp;lt;Data9&amp;gt; “;” &amp;lt;Data10&amp;gt; “;” &amp;lt;Data11&amp;gt; “;” &amp;lt;Data12&amp;gt; “;” &amp;lt;Data13&amp;gt; “;” &amp;lt;Data14&amp;gt; “;” &amp;lt;Data15&amp;gt; “;” &amp;lt;Data16&amp;gt; “;” &amp;lt;Data17&amp;gt; “;” &amp;lt;Canary&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;Events&amp;gt; ::= &amp;lt;Events&amp;gt; “ “ &amp;lt;Event&amp;gt; | &amp;lt;Event&amp;gt; “ “&lt;br /&gt; &lt;br /&gt;The event log consists of two main parts: EventLogInfo and Events.  EventLogInfo is simply a list of items separated by semicolons.  Events is a list of items separated by spaces.  Each item of Events represents an action that occurred while interacting with the form.&lt;br /&gt;As you can see, the three important pieces of information from g_objCurrentFormData are used in EventLogInfo.&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Editing Session Id is at index 2&lt;/li&gt;&lt;li&gt;Solution Id is at index 3&lt;/li&gt;&lt;li&gt;Canary is at index 18&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;An example event log follows.&lt;br /&gt;&lt;b&gt;Editing Session Id&lt;/b&gt; is bolded&lt;br /&gt;&lt;i&gt;Solution Id&lt;/i&gt; is italicized&lt;br /&gt;&lt;u&gt;Canary&lt;/u&gt; is underlined&lt;br /&gt; &lt;br /&gt;8;0;&lt;b&gt;3a41917c-bc1d-409b-904a-32fb82ce565b&lt;/b&gt;;&lt;i&gt;I:5fdfe5d2-fe2b-446f-9c70-504a30b3b40f:9285a025-812e-4c2f-a194-39edbec6c50a:633415556920000000&lt;/i&gt;;0;;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2F;http%3A%2F%2Fmyserver;http%3A%2F%2Fmyserver%2Fexample%2FForms%2FAllItems.aspx;1;1;0;10;0;633415558731245000;;&lt;u&gt;xKQi13p2GSqnFUzaSU7oMSRrhdC5spPCSnMbGWAd/kp95egDGTpq2vhVf/vz4ASFTrsYvuWQIj4G68gTruRruQ==|633415558731244855&lt;/u&gt; 0;V1_I1_T1;0;Type%20some%20text 14;;false;false &lt;br /&gt; &lt;br /&gt;&lt;h1&gt;
Putting the Pieces together in Visual Studio
&lt;/h1&gt;Now that we have a general idea how IPFS generates HTTP traffic, we can write a web test in Visual Studio.  Let’s recap the relevant IPFS architecture information:&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;IPFS has two main transactions when interacting with a form: Invocation and Postback&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are dynamic.  They will need to be extracted from responses.&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are used in the postback request.  Their values will need to be substituted in the postback body.&lt;/li&gt;&lt;li&gt;Editing Session Id and Solution Id do not change between postbacks.  They will only need to be extracted for the invocation request.&lt;/li&gt;&lt;li&gt;Canary changes after every postback.  It needs to be extracted for every request.&lt;/li&gt;
&lt;/ul&gt;We have all the required knowledge; we just need to put the pieces together.  The basic steps to write a web test for IPFS are:&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Use Fiddler to capture HTTP requests&lt;/li&gt;&lt;li&gt;Use the captured information to define requests in a web test&lt;/li&gt;&lt;li&gt;Add Extraction Rules to the invocation request&lt;/li&gt;&lt;li&gt;Substitute context variables in the postback bodys&lt;/li&gt;&lt;li&gt;Add an Extraction Rule to the postback requests&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use Fiddler to capture HTTP requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start Fiddler &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32084" alt="start fiddler.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Start capturing&lt;/li&gt;&lt;li&gt;Open an InfoPath form in a web browser &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32091" alt="open form.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Perform the actions you want to happen in your test &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32092" alt="perform actions in browser.jpg" /&gt;&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use the captured information to define requests in a web test
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start Visual Studio&lt;/li&gt;&lt;li&gt;Create a new web test&lt;/li&gt;&lt;li&gt;Add an InfoPathExtractionRules reference to the test project&lt;/li&gt;&lt;li&gt;From the fiddler capture, find the request for /_layouts/FormServer.aspx &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32090" alt="fiddler postback selected.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Add that request to the web test &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32087" alt="create invocation request.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Find requests for /_layouts/Postback.FormServer.aspx &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32090" alt="fiddler postback selected.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Add those requests to the web test.  Be sure to copy the postback body.  Note that these will be web service requests. &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32088" alt="create postback request.jpg" /&gt;&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Add Extraction Rules to the invocation request
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find the request for /_layouts/FormServer.aspx&lt;/li&gt;&lt;li&gt;Add ExtractEditingSessionId, ExtractSolutionId, and ExtractInitialCanary extraction rules&lt;/li&gt;&lt;li&gt;Substitute context variables in the postback body&lt;/li&gt;&lt;li&gt;In the web test, find requests for /_layouts/Postback.FormServer.aspx&lt;/li&gt;&lt;li&gt;Edit the EventLogInfo of the postback body as follows:&lt;/li&gt;&lt;ol&gt;
&lt;li&gt;Replace the 3rd item with {{editingSessionId}}&lt;/li&gt;&lt;li&gt;Replace the 4th item with {{solutionId}}&lt;/li&gt;&lt;li&gt;Replace the 19th item with {{canary}}&lt;/li&gt;
&lt;/ol&gt;
&lt;/ol&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32093" alt="postback substitute.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Add an Extraction Rule to the postback requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find requests for /_layouts/Postback.FormServer.aspx&lt;/li&gt;&lt;li&gt;Add ExtractPostbackCanary extraction rule to each of these requests&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;Once you have followed these steps, your web test should resemble the following picture.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32086" alt="complete webtest.jpg" /&gt;&lt;br /&gt;
&lt;/div&gt;</description><author>JBooze</author><pubDate>Sat, 12 Apr 2008 02:15:36 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20080412021536A</guid></item><item><title>UPDATED WIKI: Home</title><link>http://www.codeplex.com/ipfswebtest/Wiki/View.aspx?title=Home&amp;version=6</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
Writing a Visual Studio Web Test for InfoPath Forms Services 2007
&lt;/h1&gt;To write a Visual Studio web test for InfoPath Forms Services (IPFS), you must first understand some of IPFS’s architecture.  Before continuing, read the &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772323.aspx" class="externalLink"&gt;Forms Services Architecture article&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; on MSDN.  Pay close attention to the “Runtime Architecture” and “Rendering and Query Parameters” sections.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
InfoPath Forms Services HTTP Traffic
&lt;/h2&gt;When using an InfoPath form in the browser, a conversation between the browser and server occurs over HTTP.  This conversation consists of two kinds of transactions: Invocation and Postback.  Invocation occurs once when first opening the form.  After the form has been invoked, one or more postbacks to the server can occur.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32094" alt="IPFS HTTP traffic.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Invocation
&lt;/h2&gt;Invocation is the first transaction that occurs.  It loads all the resources that allow you to edit the form in the browser.  Invocation is started by making a GET request to FormServer.aspx.  (See How to: &lt;a href="http://msdn2.microsoft.com/en-us/library/ms772417.aspx" class="externalLink"&gt;Use Query Parameters to Invoke Browser-Enabled InfoPath Forms&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; for more information on the format of this request).  The response includes the HTML of the form and some javascript for the form.  This request also causes requests for other dependent resources.  One of these dependent resources is core.js, which defines the core logic for form editing in the browser.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32095" alt="IPFS invocation.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Current Form Data
&lt;/h2&gt;In the browser, there is javascript running which defines several pieces of data.  In particular, there is an array named g_objCurrentFormData.  Data in this array will later be used to create a postback request.  There are three pieces of dynamic data that will be important when writing the web test: &lt;br /&gt;&lt;table&gt;
&lt;tr&gt;
&lt;th&gt; Data &lt;/th&gt;&lt;th&gt; Index of g_objCurrentFormData &lt;/th&gt;&lt;th&gt; Description &lt;/th&gt;&lt;th&gt; When does it change? &lt;/th&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Editing Session Id &lt;/td&gt;&lt;td&gt; 3 &lt;/td&gt;&lt;td&gt; Identifies your session with the server &lt;/td&gt;&lt;td&gt; When invoking a form &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Solution Id &lt;/td&gt;&lt;td&gt; 4 &lt;/td&gt;&lt;td&gt; Uniquely identifies the form template &lt;/td&gt;&lt;td&gt; When the form template has been updated &lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt; Canary &lt;/td&gt;&lt;td&gt; 25 &lt;/td&gt;&lt;td&gt; Used for security mitigation &lt;/td&gt;&lt;td&gt; With every request/postback &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt; &lt;br /&gt;&lt;h2&gt;
Postback
&lt;/h2&gt;While you are interacting with a form in the browser, you may perform various actions such as typing in a text box or clicking a button.  These actions are recorded in an event log, using javascript.  When the form is submitted, or when logic must be performed on the server, the browser sends the event log to the server.  The server plays back the actions in the event log to recreate the state of the form.   Finally, the updated state of the form is returned to the browser and the browser refreshes its view of the data.  This transaction is known as a postback.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32096" alt="IPFS postback.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Event Log
&lt;/h2&gt;When a postback occurs, the event log is sent to the server using a POST request to Postback.FormServices.aspx.  The body of the POST request contains the event log.  The response from the server contains javascript to evaluate on the browser, which updates its view of the data.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32096" alt="IPFS postback.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;The event log follows a specific format which is described below in &lt;a href="http://en.wikipedia.org/wiki/Backus-Naur_form" class="externalLink"&gt;BNF&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.  Note that the location of spaces is important.&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLog&amp;gt; ::= &amp;lt;EventLogInfo&amp;gt; ” “ &amp;lt;Events&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;EventLogInfo&amp;gt; ::= &amp;lt;Data0&amp;gt; “;” &amp;lt;Data1&amp;gt; “;” &amp;lt;EditingSessionId&amp;gt; “;” &amp;lt;SolutionId&amp;gt; “;” &amp;lt;Data4&amp;gt; “;” &amp;lt;Data5&amp;gt; “;” &amp;lt;Data6&amp;gt; “;” &amp;lt;Data7&amp;gt; “;” &amp;lt;Data8&amp;gt; “;” &amp;lt;Data9&amp;gt; “;” &amp;lt;Data10&amp;gt; “;” &amp;lt;Data11&amp;gt; “;” &amp;lt;Data12&amp;gt; “;” &amp;lt;Data13&amp;gt; “;” &amp;lt;Data14&amp;gt; “;” &amp;lt;Data15&amp;gt; “;” &amp;lt;Data16&amp;gt; “;” &amp;lt;Data17&amp;gt; “;” &amp;lt;Canary&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;Events&amp;gt; ::= &amp;lt;Events&amp;gt; “ “ &amp;lt;Event&amp;gt; | &amp;lt;Event&amp;gt; “ “&lt;br /&gt; &lt;br /&gt;The event log consists of two main parts: EventLogInfo and Events.  EventLogInfo is simply a list of items separated by semicolons.  Events is a list of items separated by spaces.  Each item of Events represents an action that occurred while interacting with the form.&lt;br /&gt;As you can see, the three important pieces of information from g_objCurrentFormData are used in EventLogInfo.&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Editing Session Id is at index 2&lt;/li&gt;&lt;li&gt;Solution Id is at index 3&lt;/li&gt;&lt;li&gt;Canary is at index 18&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;An example event log follows.&lt;br /&gt;&lt;b&gt;Editing Session Id&lt;/b&gt; is bolded&lt;br /&gt;&lt;i&gt;Solution Id&lt;/i&gt; is italicized&lt;br /&gt;&lt;u&gt;Canary&lt;/u&gt; is underlined&lt;br /&gt; &lt;br /&gt;8;0;&lt;b&gt;3a41917c-bc1d-409b-904a-32fb82ce565b&lt;/b&gt;;&lt;i&gt;I:5fdfe5d2-fe2b-446f-9c70-504a30b3b40f:9285a025-812e-4c2f-a194-39edbec6c50a:633415556920000000&lt;/i&gt;;0;;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2FForms%2Ftemplate.xsn;http%3A%2F%2Fmyserver%2Fexample%2F;http%3A%2F%2Fmyserver;http%3A%2F%2Fmyserver%2Fexample%2FForms%2FAllItems.aspx;1;1;0;10;0;633415558731245000;;&lt;u&gt;xKQi13p2GSqnFUzaSU7oMSRrhdC5spPCSnMbGWAd/kp95egDGTpq2vhVf/vz4ASFTrsYvuWQIj4G68gTruRruQ==|633415558731244855&lt;/u&gt; 0;V1_I1_T1;0;Type%20some%20text 14;;false;false &lt;br /&gt; &lt;br /&gt;&lt;h1&gt;
Putting the Pieces together in Visual Studio
&lt;/h1&gt;Now that we have a general idea how IPFS generates HTTP traffic, we can write a web test in Visual Studio.  Let’s recap the relevant IPFS architecture information:&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;IPFS has two main transactions when interacting with a form: Invocation and Postback&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are dynamic.  They will need to be extracted from responses.&lt;/li&gt;&lt;li&gt;Editing Session Id, Solution Id, and Canary are used in the postback request.  Their values will need to be substituted in the postback body.&lt;/li&gt;&lt;li&gt;Editing Session Id and Solution Id do not change between postbacks.  They will only need to be extracted for the invocation request.&lt;/li&gt;&lt;li&gt;Canary changes after every postback.  It needs to be extracted for every request.&lt;/li&gt;
&lt;/ul&gt;We have all the required knowledge; we just need to put the pieces together.  The basic steps to write a web test for IPFS are:&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Use Fiddler to capture HTTP requests&lt;/li&gt;&lt;li&gt;Use the captured information to define requests in a web test&lt;/li&gt;&lt;li&gt;Add Extraction Rules to the invocation request&lt;/li&gt;&lt;li&gt;Substitute context variables in the postback bodys&lt;/li&gt;&lt;li&gt;Add an Extraction Rule to the postback requests&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use Fiddler to capture HTTP requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start Fiddler &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32084" alt="start fiddler.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Start capturing&lt;/li&gt;&lt;li&gt;Open an InfoPath form in a web browser &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32091" alt="open form.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Perform the actions you want to happen in your test &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32092" alt="perform actions in browser.jpg" /&gt;&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Use the captured information to define requests in a web test
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Start Visual Studio&lt;/li&gt;&lt;li&gt;Create a new web test&lt;/li&gt;&lt;li&gt;Add an InfoPathExtractionRules reference to the test project&lt;/li&gt;&lt;li&gt;From the fiddler capture, find the request for /_layouts/FormServer.aspx &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32090" alt="fiddler postback selected.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Add that request to the web test &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32087" alt="create invocation request.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Find requests for /_layouts/Postback.FormServer.aspx &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32090" alt="fiddler postback selected.jpg" /&gt;&lt;/li&gt;&lt;li&gt;Add those requests to the web test.  Be sure to copy the postback body.  Note that these will be web service requests. &lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32088" alt="create postback request.jpg" /&gt;&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
Add Extraction Rules to the invocation request
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find the request for /_layouts/FormServer.aspx&lt;/li&gt;&lt;li&gt;Add ExtractEditingSessionId, ExtractSolutionId, and ExtractInitialCanary extraction rules&lt;/li&gt;&lt;li&gt;Substitute context variables in the postback body&lt;/li&gt;&lt;li&gt;In the web test, find requests for /_layouts/Postback.FormServer.aspx&lt;/li&gt;&lt;li&gt;Edit the EventLogInfo of the postback body as follows:&lt;/li&gt;&lt;ol&gt;
&lt;li&gt;Replace the 3rd item with &lt;span class="codeInline"&gt;editingSessionId&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Replace the 4th item with &lt;span class="codeInline"&gt;solutionId&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Replace the 19th item with &lt;span class="codeInline"&gt;canary&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/ol&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32093" alt="postback substitute.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Add an Extraction Rule to the postback requests
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;In the web test, find requests for /_layouts/Postback.FormServer.aspx&lt;/li&gt;&lt;li&gt;Add ExtractPostbackCanary extraction rule to each of these requests&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;Once you have followed these steps, your web test should resemble the following picture.&lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ipfswebtest&amp;amp;DownloadId=32086" alt="complete webtest.jpg" /&gt;&lt;br /&gt;
&lt;/div&gt;</description><author>JBooze</author><pubDate>Sat, 12 Apr 2008 01:47:45 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20080412014745A</guid></item></channel></rss>