Are you facing issues while trying to record and playback InfoPath forms using VSTS web test? I would like to share some the tricks and techniques we used while conducting performance testing for our applications which used browser enabled InfoPath forms extensively.

When we perform any action in the InfoPath form it is recorded in the form of an event log entry or string body 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. InfoPath forms have two types of postback – partial postback and full page postback. Partial postback transmits less data and is comparatively more efficient. Full page post back happens when there is a view switching. For more details refer to http://www.codeplex.com/ipfswebtest

 Let’s review one of our performance scripts to understand this post back. In this below example, on click of create button, a view switching happens and results in a full postback whereas when we try changing one of the attributes in the form (such as choosing some drop down data), a partial postback happens.

 

image

When a partial postback occurs, the event log is sent to the server using a POST request to Postback.FormServer.aspx and the requests are in the form of String Body. When a full page post back 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.

Let’s look at a typical request, captured during the VSTS recording:

8;0;506381d7-fa68-4ba8-8fa3-eaa136676275;02490e79-9ee0-4319-a860-d96c965b2ddb:ver:1.0.0.447;0;;urn%3Aschemas-microsoft-com%3Aoffice%3Ainfopath%3ATaskFormV1-3%3A-myXSD-2007-07-02T05-38-11;https%3A%2F%2Ftest.com%2F_layouts%2FFormServer.aspx%3FXsnLocation%3Durn%3Aschemas-microsoft-com%3Aoffice%3Ainfopath%3ATaskFormV1-3%3A-myXSD-2007-07-02T05-38-11;;https%3A%2F%2Ftest.com%2FDynamics%2FAxapta%2Fdownload4mbsite1;;1;0;0;162;1;633602516488353000;;oXXTzwbYir0m0iauGkpgL3FbLIGHYv2hti2/GZJlh4v1C46b61ESXg2cKfAbpk+n7PgD7ezwZ3bN3q9QZxgTuw==|633602516488353471 0;V1_I1_D15;;HandOff%20Approved%20and%20Translated%20files%20attached%3Ay

These looks complicated at first glance unless we go more into it and understand what each parameter corresponds to. Let’s categorize this way to simplify things:

<Parameter0> “;” <PostbackCounter> “;” <EditingSessionId> “;” <SolutionId> “;” <Parameter4> “;” <Parameter5> “;” <Parameter6> “;” <Parameter7> “;” <Parameter8> “;” <Parameter9> “;” <Parameter10> “;” <Parameter11> “;” <Parameter12> “;” <Parameter13> “;” <Parameter14> “;” <Parameter15> “;” <Parameter16> “;” <Parameter17> “;” <Canary>;<Parameter18>

When you do a playback of the above request it will fail as some of the parameters are dynamic. Now the challenge is to find which parameters are dynamic. We have a tool called Fiddler which can be used record the scenarios and compare the same with that of VSTS. Record the scenario in similar fashion using Fiddler .Try comparing same request from VSTS and fiddler

Request from VSTS:

8;0;3a2a936e-73c7-447f-9f7b-95b728068f46;b395b396-33ab-43ce-8325-3ec299f462d3:ver:1.0.0.3994;0;%2FDynamics%2FAxapta%2F2FBulk_PISite %2FInstanceu20Library%2FInstanceForm- Multi_instance12008-10-02T043732290.xml;;https%3A%2F%2Ftest.com%2FFormServerTemplates%2FArtDefn.xsn;;https%3A%2F%2Ftest.com%2FDynamics%2FAxapta%2FBulk_PISite;https%3A%2F%2Ftest.com%2FDynamics%2FAxapta%2F2FBulk_PISite %2FInstanceu20Library%2FForms%2FAllItems.aspx;0;1;0;162;1;633546595550842000;;JawjD/T9yExN3MFXdt28ubn2IyV9Sc6WJsgv4UxfyXg40EKStkMmWvFCYZBY0ZXpb0YwRV+8JGKxmTPzlFxVxw==|633546595550529792 1;btnpostIntiationUpdate;V1_I1_S1_I1;

Request from Fiddler:

8;0; dbfd9bc6-9a35-4342-9bf6-5926d9cfc565;337818e1-961a-4dde-b6d9-dee88bf242bf:ver:1.0.0.3994;0;%2FDynamics%2FAxapta%2F2FBulk_PISite %2FInstanceu20Library%2FInstanceForm-Multi_instance32008-10-16T003011850.xml;;https%3A%2F%2Ftest.com%2FFormServerTemplates%2FArtDefn.xsn;;https%3A%2F%2Ftest.com%2FDynamics%2FAxapta%2F2FBulk_PISite;https%3A%2F%2Ftest.com%2FDynamics%2FAxapta%2F2FBulk_PISite %2FInstanceu20Library%2FForms%2FAllItems.aspx;0;1;0;162;1;633546595550842000;; vFIuHMmlR+l9Oi1UOMQSwE+59BS+9v0w1b0xU2bf9TG1QkGyqjfYV3bn4xzXQLcmkiMx0WNy+VzyXmbPwc0tEA==|633564624538972226 1;btnpostIntiationUpdate;V1_I1_S1_I1;

As you can see, the highlighted sections (Editing Session id, Solution id, Canary value) differ from time to time. In simple terms, every time we record the same scenario we have different values in these places. This confirms what all the dynamic parameters are.