1
9
10 package main
11
12 import (
13 "bytes"
14 "fmt"
15 "github.com/clbanning/mxj"
16 "io"
17 )
18
19 func main() {
20
21 rdr := bytes.NewReader(data)
22 var m mxj.Map
23 var err error
24
25
26 for m, err = mxj.NewMapXmlSeqReader(rdr); m != nil || err != io.EOF; m, err = mxj.NewMapXmlSeqReader(rdr) {
27 if err != nil {
28 if err != mxj.NO_ROOT {
29 fmt.Println("NewMapXmlSeq err:", err)
30 fmt.Println("m:", m)
31 } else if m != nil {
32 x, _ := m.XmlSeqIndent("", " ")
33 fmt.Println(string(x))
34 }
35 continue
36 }
37
38
39
40 if err = copyCmts(m, "WebTest.Items"); err != nil {
41 fmt.Println("err:", err)
42 }
43 if err = copyCmts(m, "WebTest.Items.TransactionTimer.Items"); err != nil {
44 fmt.Println("err:", err)
45 }
46
47
48 b, err := m.XmlSeqIndent("", " ")
49 if err != nil {
50 fmt.Println("XmlIndent err:", err)
51 return
52 }
53 fmt.Println(string(b))
54 }
55 }
56
57
58 func copyCmts(m mxj.Map, path string) error {
59
60 vals, err := m.ValuesForPath(path)
61 if err != nil {
62 return fmt.Errorf("ValuesForPath err: %s", err.Error())
63 } else if len(vals) == 0 {
64 return fmt.Errorf("no vals for path: %s", path)
65 }
66
67 for _, v := range vals {
68 vm, ok := v.(map[string]interface{})
69 if !ok {
70 return fmt.Errorf("assertion failed")
71 }
72
73 c, ok := vm["Comment"]
74 if !ok {
75 continue
76 }
77
78
79 switch c.(type) {
80 case map[string]interface{}:
81 c = []interface{}{c}
82 }
83 cmt := c.([]interface{})
84
85 r, ok := vm["Request"]
86 if !ok {
87 continue
88 }
89
90
91 switch r.(type) {
92 case map[string]interface{}:
93 r = []interface{}{r}
94 }
95 req := r.([]interface{})
96
97
98
99
100
101
102
103 for _, v := range cmt {
104 vmap := v.(map[string]interface{})
105 seq := vmap["#seq"].(int)
106
107 acmt, _ := mxj.Map(vmap).ValueForPath("#attr.CommentText.#text")
108 if acmt == "" {
109 fmt.Println("no CommentText value in Comment attributes")
110 }
111
112
113 var r map[string]interface{}
114 for _, vv := range req {
115 rt := vv.(map[string]interface{})
116 if rt["#seq"].(int) == seq+1 {
117 r = rt
118 break
119 }
120 }
121 if r == nil {
122 continue
123 }
124 if err := mxj.Map(r).SetValueForPath(acmt, "#attr.ReportingName.#text"); err != nil {
125 fmt.Println("SetValueForPath err:", err)
126 break
127 }
128 }
129 }
130 return nil
131 }
132
133 var data = []byte(`
134 <?xml version="1.0" encoding="utf-8"?>
135 <WebTest Name="FirstAnonymousVisit" Id="ac766d08-f940-4b0a-b8f8-80675978894e" Owner="" Priority="0" Enabled="True" CssProjectStructure="" CssIteration="" Timeout="0" WorkItemIds="" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010" Description="" CredentialUserName="" CredentialPassword="" PreAuthenticate="True" Proxy="" StopOnError="False" RecordedResultFile="">
136 <Items>
137 <Comment CommentText="Visit Homepage and ensure new page setup is created" />
138 <Request Method="GET" Version="1.1" Url="{{Config.TestParameters.ServerURL}}/Default.aspx" ThinkTime="0" Timeout="300" ParseDependentRequests="False" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0.5" Encoding="utf-8" ExpectedHttpStatusCode="0" ExpectedResponseUrl="" ReportingName="">
139 <ValidationRules>
140 <ValidationRule Classname="Dropthings.Test.Rules.CookieValidationRule, Dropthings.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" DisplayName="Check Cookie From Response" Description="" Level="High" ExectuionOrder="BeforeDependents">
141 <RuleParameters>
142 <RuleParameter Name="StopOnError" Value="False" />
143 <RuleParameter Name="CookieValueToMatch" Value="" />
144 <RuleParameter Name="MatchValue" Value="False" />
145 <RuleParameter Name="Exists" Value="True" />
146 <RuleParameter Name="CookieName" Value="{{Config.TestParameters.AnonCookieName}}" />
147 <RuleParameter Name="IsPersistent" Value="True" />
148 <RuleParameter Name="Domain" Value="" />
149 <RuleParameter Name="Index" Value="0" />
150 </RuleParameters>
151 </ValidationRule>
152 <ValidationRule Classname="Dropthings.Test.Rules.CookieValidationRule, Dropthings.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" DisplayName="Check Cookie From Response" Description="" Level="High" ExectuionOrder="BeforeDependents">
153 <RuleParameters>
154 <RuleParameter Name="StopOnError" Value="False" />
155 <RuleParameter Name="CookieValueToMatch" Value="" />
156 <RuleParameter Name="MatchValue" Value="False" />
157 <RuleParameter Name="Exists" Value="False" />
158 <RuleParameter Name="CookieName" Value="{{Config.TestParameters.SessionCookieName}}" />
159 <RuleParameter Name="IsPersistent" Value="False" />
160 <RuleParameter Name="Domain" Value="" />
161 <RuleParameter Name="Index" Value="0" />
162 </RuleParameters>
163 </ValidationRule>
164 <ValidationRule Classname="Dropthings.Test.Rules.CacheHeaderValidation, Dropthings.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" DisplayName="Cache Header Validation" Description="" Level="High" ExectuionOrder="BeforeDependents">
165 <RuleParameters>
166 <RuleParameter Name="Enabled" Value="True" />
167 <RuleParameter Name="DifferenceThresholdSec" Value="0" />
168 <RuleParameter Name="CacheControlPrivate" Value="False" />
169 <RuleParameter Name="CacheControlPublic" Value="False" />
170 <RuleParameter Name="CacheControlNoCache" Value="True" />
171 <RuleParameter Name="ExpiresAfterSeconds" Value="0" />
172 <RuleParameter Name="StopOnError" Value="False" />
173 </RuleParameters>
174 </ValidationRule>
175 <ValidationRule Classname="Microsoft.VisualStudio.TestTools.WebTesting.Rules.ValidationRuleFindText, Microsoft.VisualStudio.QualityTools.WebTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" DisplayName="Find Text" Description="Verifies the existence of the specified text in the response." Level="High" ExectuionOrder="BeforeDependents">
176 <RuleParameters>
177 <RuleParameter Name="FindText" Value="How to of the Day" />
178 <RuleParameter Name="IgnoreCase" Value="False" />
179 <RuleParameter Name="UseRegularExpression" Value="False" />
180 <RuleParameter Name="PassIfTextFound" Value="True" />
181 </RuleParameters>
182 </ValidationRule>
183 <ValidationRule Classname="Microsoft.VisualStudio.TestTools.WebTesting.Rules.ValidationRuleFindText, Microsoft.VisualStudio.QualityTools.WebTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" DisplayName="Find Text" Description="Verifies the existence of the specified text in the response." Level="High" ExectuionOrder="BeforeDependents">
184 <RuleParameters>
185 <RuleParameter Name="FindText" Value="Weather" />
186 <RuleParameter Name="IgnoreCase" Value="False" />
187 <RuleParameter Name="UseRegularExpression" Value="False" />
188 <RuleParameter Name="PassIfTextFound" Value="True" />
189 </RuleParameters>
190 </ValidationRule>
191 <ValidationRule Classname="Microsoft.VisualStudio.TestTools.WebTesting.Rules.ValidationRuleFindText, Microsoft.VisualStudio.QualityTools.WebTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" DisplayName="Find Text" Description="Verifies the existence of the specified text in the response." Level="High" ExectuionOrder="BeforeDependents">
192 <RuleParameters>
193 <RuleParameter Name="FindText" Value="All rights reserved" />
194 <RuleParameter Name="IgnoreCase" Value="False" />
195 <RuleParameter Name="UseRegularExpression" Value="False" />
196 <RuleParameter Name="PassIfTextFound" Value="True" />
197 </RuleParameters>
198 </ValidationRule>
199 </ValidationRules>
200 </Request>
201 <TransactionTimer Name="Show Hide Widget List">
202 <Items>
203 <Comment CommentText="Show Widget List and expect Widget List to produce BBC Word widget link" />
204 <Request Method="GET" Version="1.1" Url="{{Config.TestParameters.ServerURL}}/Default.aspx" ThinkTime="0" Timeout="300" ParseDependentRequests="False" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0.5" Encoding="utf-8" ExpectedHttpStatusCode="0" ExpectedResponseUrl="" ReportingName="">
205 <ValidationRules>
206 <ValidationRule Classname="Microsoft.VisualStudio.TestTools.WebTesting.Rules.ValidationRuleFindText, Microsoft.VisualStudio.QualityTools.WebTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" DisplayName="Find Text" Description="Verifies the existence of the specified text in the response." Level="High" ExectuionOrder="BeforeDependents">
207 <RuleParameters>
208 <RuleParameter Name="FindText" Value="BBC World" />
209 <RuleParameter Name="IgnoreCase" Value="False" />
210 <RuleParameter Name="UseRegularExpression" Value="False" />
211 <RuleParameter Name="PassIfTextFound" Value="True" />
212 </RuleParameters>
213 </ValidationRule>
214 </ValidationRules>
215 <RequestPlugins>
216 <RequestPlugin Classname="Dropthings.Test.Plugin.AsyncPostbackRequestPlugin, Dropthings.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" DisplayName="AsyncPostbackRequestPlugin" Description="">
217 <RuleParameters>
218 <RuleParameter Name="ControlName" Value="TabControlPanel$ShowAddContentPanel" />
219 <RuleParameter Name="UpdatePanelName" Value="{{$UPDATEPANEL.OnPageMenuUpdatePanel.1}}" />
220 </RuleParameters>
221 </RequestPlugin>
222 </RequestPlugins>
223 </Request>
224 <Comment CommentText="Hide Widget List and expect the outpu does not have the BBC World Widget" />
225 <Request Method="GET" Version="1.1" Url="{{Config.TestParameters.ServerURL}}/Default.aspx" ThinkTime="0" Timeout="300" ParseDependentRequests="False" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0.5" Encoding="utf-8" ExpectedHttpStatusCode="0" ExpectedResponseUrl="" ReportingName="">
226 <ValidationRules>
227 <ValidationRule Classname="Microsoft.VisualStudio.TestTools.WebTesting.Rules.ValidationRuleFindText, Microsoft.VisualStudio.QualityTools.WebTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" DisplayName="Find Text" Description="Verifies the existence of the specified text in the response." Level="High" ExectuionOrder="BeforeDependents">
228 <RuleParameters>
229 <RuleParameter Name="FindText" Value="TabControlPanel$ShowAddContentPanel" />
230 <RuleParameter Name="IgnoreCase" Value="False" />
231 <RuleParameter Name="UseRegularExpression" Value="False" />
232 <RuleParameter Name="PassIfTextFound" Value="True" />
233 </RuleParameters>
234 </ValidationRule>
235 </ValidationRules>
236 <RequestPlugins>
237 <RequestPlugin Classname="Dropthings.Test.Plugin.AsyncPostbackRequestPlugin, Dropthings.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" DisplayName="AsyncPostbackRequestPlugin" Description="">
238 <RuleParameters>
239 <RuleParameter Name="ControlName" Value="TabControlPanel$HideAddContentPanel" />
240 <RuleParameter Name="UpdatePanelName" Value="{{$UPDATEPANEL.OnPageMenuUpdatePanel.1}}" />
241 </RuleParameters>
242 </RequestPlugin>
243 </RequestPlugins>
244 </Request>
245 </Items>
246 </TransactionTimer>
247 <Request Method="GET" Version="1.1" Url="{{Config.TestParameters.ServerURL}}/API/Proxy.svc/ajax/GetRss?url=%22http%3A%2F%2Ffeeds.feedburner.com%2FOmarAlZabirBlog%22&count=10&cacheDuration=10" ThinkTime="0" Timeout="300" ParseDependentRequests="True" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0" Encoding="utf-8" ExpectedHttpStatusCode="0" ExpectedResponseUrl="" ReportingName="">
248 <ValidationRules>
249 <ValidationRule Classname="Microsoft.VisualStudio.TestTools.WebTesting.Rules.ValidationRuleFindText, Microsoft.VisualStudio.QualityTools.WebTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" DisplayName="Find Text" Description="Verifies the existence of the specified text in the response." Level="High" ExectuionOrder="BeforeDependents">
250 <RuleParameters>
251 <RuleParameter Name="FindText" Value="{"d":[{"__type":"RssItem:#Dropthings.Web.Util"" />
252 <RuleParameter Name="IgnoreCase" Value="False" />
253 <RuleParameter Name="UseRegularExpression" Value="False" />
254 <RuleParameter Name="PassIfTextFound" Value="True" />
255 </RuleParameters>
256 </ValidationRule>
257 </ValidationRules>
258 </Request>
259 <Request Method="GET" Version="1.1" Url="{{Config.TestParameters.ServerURL}}/API/Proxy.svc/ajax/GetUrl?url=%22http%3A%2F%2Ffeeds.feedburner.com%2FOmarAlZabirBlog%22&cacheDuration=10" ThinkTime="0" Timeout="300" ParseDependentRequests="True" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0" Encoding="utf-8" ExpectedHttpStatusCode="0" ExpectedResponseUrl="" ReportingName="">
260 <ValidationRules>
261 <ValidationRule Classname="Microsoft.VisualStudio.TestTools.WebTesting.Rules.ValidationRuleFindText, Microsoft.VisualStudio.QualityTools.WebTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" DisplayName="Find Text" Description="Verifies the existence of the specified text in the response." Level="High" ExectuionOrder="BeforeDependents">
262 <RuleParameters>
263 <RuleParameter Name="FindText" Value="<channel>" />
264 <RuleParameter Name="IgnoreCase" Value="False" />
265 <RuleParameter Name="UseRegularExpression" Value="False" />
266 <RuleParameter Name="PassIfTextFound" Value="True" />
267 </RuleParameters>
268 </ValidationRule>
269 </ValidationRules>
270 </Request>
271 <TransactionTimer Name="Edit Collapse Expand Widget">
272 <Items>
273 <Comment CommentText="Click edit on first widget "How to of the Day" and expect URL textbox to be present with Feed Url" />
274 <Request Method="GET" Version="1.1" Url="{{Config.TestParameters.ServerURL}}/Default.aspx" ThinkTime="0" Timeout="300" ParseDependentRequests="False" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0.5" Encoding="utf-8" ExpectedHttpStatusCode="0" ExpectedResponseUrl="" ReportingName="">
275 <ValidationRules>
276 <ValidationRule Classname="Microsoft.VisualStudio.TestTools.WebTesting.Rules.ValidationRuleRequiredAttributeValue, Microsoft.VisualStudio.QualityTools.WebTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" DisplayName="Required Attribute Value" Description="Verifies the existence of a specified HTML tag that contains an attribute with a specified value." Level="High" ExectuionOrder="BeforeDependents">
277 <RuleParameters>
278 <RuleParameter Name="TagName" Value="input" />
279 <RuleParameter Name="AttributeName" Value="value" />
280 <RuleParameter Name="MatchAttributeName" Value="" />
281 <RuleParameter Name="MatchAttributeValue" Value="" />
282 <RuleParameter Name="ExpectedValue" Value="http://www.wikihow.com/feed.rss" />
283 <RuleParameter Name="IgnoreCase" Value="False" />
284 <RuleParameter Name="Index" Value="-1" />
285 </RuleParameters>
286 </ValidationRule>
287 </ValidationRules>
288 <ExtractionRules>
289 <ExtractionRule Classname="Dropthings.Test.Rules.ExtractFormElements, Dropthings.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" VariableName="" DisplayName="Extract Form Elements" Description="">
290 <RuleParameters>
291 <RuleParameter Name="ContextParameterName" Value="" />
292 </RuleParameters>
293 </ExtractionRule>
294 </ExtractionRules>
295 <RequestPlugins>
296 <RequestPlugin Classname="Dropthings.Test.Plugin.AsyncPostbackRequestPlugin, Dropthings.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" DisplayName="AsyncPostbackRequestPlugin" Description="">
297 <RuleParameters>
298 <RuleParameter Name="ControlName" Value="{{$POSTBACK.EditWidget.1}}" />
299 <RuleParameter Name="UpdatePanelName" Value="{{$UPDATEPANEL.WidgetHeaderUpdatePanel.1}}" />
300 </RuleParameters>
301 </RequestPlugin>
302 </RequestPlugins>
303 </Request>
304 <Comment CommentText="Change the Feed Count Dropdown list to 10 and expect 10 Feed Link controls are generated" />
305 <Request Method="POST" Version="1.1" Url="{{Config.TestParameters.ServerURL}}/Default.aspx" ThinkTime="0" Timeout="300" ParseDependentRequests="False" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0.5" Encoding="utf-8" ExpectedHttpStatusCode="0" ExpectedResponseUrl="" ReportingName="">
306 <ValidationRules>
307 <ValidationRule Classname="Microsoft.VisualStudio.TestTools.WebTesting.Rules.ValidationRuleFindText, Microsoft.VisualStudio.QualityTools.WebTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" DisplayName="Find Text" Description="Verifies the existence of the specified text in the response." Level="High" ExectuionOrder="BeforeDependents">
308 <RuleParameters>
309 <RuleParameter Name="FindText" Value="FeedList_ctl09_FeedLink" />
310 <RuleParameter Name="IgnoreCase" Value="False" />
311 <RuleParameter Name="UseRegularExpression" Value="False" />
312 <RuleParameter Name="PassIfTextFound" Value="True" />
313 </RuleParameters>
314 </ValidationRule>
315 </ValidationRules>
316 <RequestPlugins>
317 <RequestPlugin Classname="Dropthings.Test.Plugin.AsyncPostbackRequestPlugin, Dropthings.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" DisplayName="AsyncPostbackRequestPlugin" Description="">
318 <RuleParameters>
319 <RuleParameter Name="ControlName" Value="{{$POSTBACK.CancelEditWidget.1}}" />
320 <RuleParameter Name="UpdatePanelName" Value="{{$UPDATEPANEL.WidgetHeaderUpdatePanel.1}}" />
321 </RuleParameters>
322 </RequestPlugin>
323 </RequestPlugins>
324 <FormPostHttpBody>
325 <FormPostParameter Name="{{$INPUT.FeedUrl.1}}" Value="http://www.wikihow.com/feed.rss" RecordedValue="" CorrelationBinding="" UrlEncode="True" />
326 <FormPostParameter Name="{{$SELECT.FeedCountDropDownList.1}}" Value="10" RecordedValue="" CorrelationBinding="" UrlEncode="True" />
327 </FormPostHttpBody>
328 </Request>
329 <Comment CommentText="Delete the How to of the Day widget and expect it's not found from response" />
330 <Request Method="GET" Version="1.1" Url="{{Config.TestParameters.ServerURL}}/Default.aspx" ThinkTime="0" Timeout="300" ParseDependentRequests="False" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0.5" Encoding="utf-8" ExpectedHttpStatusCode="0" ExpectedResponseUrl="" ReportingName="">
331 <ValidationRules>
332 <ValidationRule Classname="Microsoft.VisualStudio.TestTools.WebTesting.Rules.ValidationRuleFindText, Microsoft.VisualStudio.QualityTools.WebTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" DisplayName="Find Text" Description="Verifies the existence of the specified text in the response." Level="High" ExectuionOrder="BeforeDependents">
333 <RuleParameters>
334 <RuleParameter Name="FindText" Value="How to of the Day" />
335 <RuleParameter Name="IgnoreCase" Value="False" />
336 <RuleParameter Name="UseRegularExpression" Value="False" />
337 <RuleParameter Name="PassIfTextFound" Value="False" />
338 </RuleParameters>
339 </ValidationRule>
340 </ValidationRules>
341 <RequestPlugins>
342 <RequestPlugin Classname="Dropthings.Test.Plugin.AsyncPostbackRequestPlugin, Dropthings.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" DisplayName="AsyncPostbackRequestPlugin" Description="">
343 <RuleParameters>
344 <RuleParameter Name="ControlName" Value="{{$POSTBACK.CloseWidget.1}}" />
345 <RuleParameter Name="UpdatePanelName" Value="{{$UPDATEPANEL.WidgetHeaderUpdatePanel.1}}" />
346 </RuleParameters>
347 </RequestPlugin>
348 </RequestPlugins>
349 </Request>
350 </Items>
351 </TransactionTimer>
352 <TransactionTimer Name="Add New Widget">
353 <Items>
354 <Comment CommentText="Show widget list and expect Digg to be there" />
355 <Request Method="GET" Version="1.1" Url="{{Config.TestParameters.ServerURL}}/Default.aspx" ThinkTime="0" Timeout="300" ParseDependentRequests="False" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0.5" Encoding="utf-8" ExpectedHttpStatusCode="0" ExpectedResponseUrl="" ReportingName="">
356 <ValidationRules>
357 <ValidationRule Classname="Microsoft.VisualStudio.TestTools.WebTesting.Rules.ValidationRuleFindText, Microsoft.VisualStudio.QualityTools.WebTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" DisplayName="Find Text" Description="Verifies the existence of the specified text in the response." Level="High" ExectuionOrder="BeforeDependents">
358 <RuleParameters>
359 <RuleParameter Name="FindText" Value="Digg" />
360 <RuleParameter Name="IgnoreCase" Value="False" />
361 <RuleParameter Name="UseRegularExpression" Value="False" />
362 <RuleParameter Name="PassIfTextFound" Value="True" />
363 </RuleParameters>
364 </ValidationRule>
365 </ValidationRules>
366 <RequestPlugins>
367 <RequestPlugin Classname="Dropthings.Test.Plugin.AsyncPostbackRequestPlugin, Dropthings.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" DisplayName="AsyncPostbackRequestPlugin" Description="">
368 <RuleParameters>
369 <RuleParameter Name="ControlName" Value="TabControlPanel$ShowAddContentPanel" />
370 <RuleParameter Name="UpdatePanelName" Value="{{$UPDATEPANEL.OnPageMenuUpdatePanel.1}}" />
371 </RuleParameters>
372 </RequestPlugin>
373 </RequestPlugins>
374 </Request>
375 <Comment CommentText="Add New Widget" />
376 <Request Method="GET" Version="1.1" Url="{{Config.TestParameters.ServerURL}}/Default.aspx" ThinkTime="0" Timeout="300" ParseDependentRequests="False" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0.5" Encoding="utf-8" ExpectedHttpStatusCode="0" ExpectedResponseUrl="" ReportingName="">
377 <ValidationRules>
378 <ValidationRule Classname="Microsoft.VisualStudio.TestTools.WebTesting.Rules.ValidationRuleFindText, Microsoft.VisualStudio.QualityTools.WebTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" DisplayName="Find Text" Description="Verifies the existence of the specified text in the response." Level="High" ExectuionOrder="BeforeDependents">
379 <RuleParameters>
380 <RuleParameter Name="FindText" Value="Digg" />
381 <RuleParameter Name="IgnoreCase" Value="False" />
382 <RuleParameter Name="UseRegularExpression" Value="False" />
383 <RuleParameter Name="PassIfTextFound" Value="True" />
384 </RuleParameters>
385 </ValidationRule>
386 </ValidationRules>
387 <RequestPlugins>
388 <RequestPlugin Classname="Dropthings.Test.Plugin.AsyncPostbackRequestPlugin, Dropthings.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" DisplayName="AsyncPostbackRequestPlugin" Description="">
389 <RuleParameters>
390 <RuleParameter Name="ControlName" Value="{{$POSTBACK.AddWidget.1}}" />
391 <RuleParameter Name="UpdatePanelName" Value="{{$UPDATEPANEL.OnPageMenuUpdatePanel.1}}" />
392 </RuleParameters>
393 </RequestPlugin>
394 </RequestPlugins>
395 </Request>
396 <Comment CommentText="Delete the newly added widget" />
397 <Request Method="GET" Version="1.1" Url="{{Config.TestParameters.ServerURL}}/Default.aspx" ThinkTime="0" Timeout="300" ParseDependentRequests="False" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0.5" Encoding="utf-8" ExpectedHttpStatusCode="0" ExpectedResponseUrl="" ReportingName="">
398 <ValidationRules>
399 <ValidationRule Classname="Microsoft.VisualStudio.TestTools.WebTesting.Rules.ValidationRuleFindText, Microsoft.VisualStudio.QualityTools.WebTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" DisplayName="Find Text" Description="Verifies the existence of the specified text in the response." Level="High" ExectuionOrder="BeforeDependents">
400 <RuleParameters>
401 <RuleParameter Name="FindText" Value="How to of the Day" />
402 <RuleParameter Name="IgnoreCase" Value="False" />
403 <RuleParameter Name="UseRegularExpression" Value="False" />
404 <RuleParameter Name="PassIfTextFound" Value="False" />
405 </RuleParameters>
406 </ValidationRule>
407 </ValidationRules>
408 <RequestPlugins>
409 <RequestPlugin Classname="Dropthings.Test.Plugin.AsyncPostbackRequestPlugin, Dropthings.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" DisplayName="AsyncPostbackRequestPlugin" Description="">
410 <RuleParameters>
411 <RuleParameter Name="ControlName" Value="{{$POSTBACK.CloseWidget.1}}" />
412 <RuleParameter Name="UpdatePanelName" Value="{{$UPDATEPANEL.WidgetHeaderUpdatePanel.1}}" />
413 </RuleParameters>
414 </RequestPlugin>
415 </RequestPlugins>
416 </Request>
417 </Items>
418 </TransactionTimer>
419 <Comment CommentText="Revisit and ensure the Digg widget exists and How to widget does not exist" />
420 <Request Method="GET" Version="1.1" Url="{{Config.TestParameters.ServerURL}}/Default.aspx" ThinkTime="0" Timeout="300" ParseDependentRequests="False" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0.5" Encoding="utf-8" ExpectedHttpStatusCode="0" ExpectedResponseUrl="" ReportingName="">
421 <ValidationRules>
422 <ValidationRule Classname="Dropthings.Test.Rules.CookieValidationRule, Dropthings.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" DisplayName="Check Cookie From Response" Description="" Level="High" ExectuionOrder="BeforeDependents">
423 <RuleParameters>
424 <RuleParameter Name="StopOnError" Value="False" />
425 <RuleParameter Name="CookieValueToMatch" Value="" />
426 <RuleParameter Name="MatchValue" Value="False" />
427 <RuleParameter Name="Exists" Value="False" />
428 <RuleParameter Name="CookieName" Value="{{Config.TestParameters.AnonCookieName}}" />
429 <RuleParameter Name="IsPersistent" Value="True" />
430 <RuleParameter Name="Domain" Value="" />
431 <RuleParameter Name="Index" Value="0" />
432 </RuleParameters>
433 </ValidationRule>
434 <ValidationRule Classname="Dropthings.Test.Rules.CookieValidationRule, Dropthings.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" DisplayName="Check Cookie From Response" Description="" Level="High" ExectuionOrder="BeforeDependents">
435 <RuleParameters>
436 <RuleParameter Name="StopOnError" Value="False" />
437 <RuleParameter Name="CookieValueToMatch" Value="" />
438 <RuleParameter Name="MatchValue" Value="False" />
439 <RuleParameter Name="Exists" Value="False" />
440 <RuleParameter Name="CookieName" Value="{{Config.TestParameters.SessionCookieName}}" />
441 <RuleParameter Name="IsPersistent" Value="False" />
442 <RuleParameter Name="Domain" Value="" />
443 <RuleParameter Name="Index" Value="0" />
444 </RuleParameters>
445 </ValidationRule>
446 <ValidationRule Classname="Dropthings.Test.Rules.CacheHeaderValidation, Dropthings.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" DisplayName="Cache Header Validation" Description="" Level="High" ExectuionOrder="BeforeDependents">
447 <RuleParameters>
448 <RuleParameter Name="Enabled" Value="True" />
449 <RuleParameter Name="DifferenceThresholdSec" Value="0" />
450 <RuleParameter Name="CacheControlPrivate" Value="False" />
451 <RuleParameter Name="CacheControlPublic" Value="False" />
452 <RuleParameter Name="CacheControlNoCache" Value="True" />
453 <RuleParameter Name="ExpiresAfterSeconds" Value="0" />
454 <RuleParameter Name="StopOnError" Value="False" />
455 </RuleParameters>
456 </ValidationRule>
457 <ValidationRule Classname="Microsoft.VisualStudio.TestTools.WebTesting.Rules.ValidationRuleFindText, Microsoft.VisualStudio.QualityTools.WebTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" DisplayName="Find Text" Description="Verifies the existence of the specified text in the response." Level="High" ExectuionOrder="BeforeDependents">
458 <RuleParameters>
459 <RuleParameter Name="FindText" Value="How to of the Day" />
460 <RuleParameter Name="IgnoreCase" Value="False" />
461 <RuleParameter Name="UseRegularExpression" Value="False" />
462 <RuleParameter Name="PassIfTextFound" Value="False" />
463 </RuleParameters>
464 </ValidationRule>
465 <ValidationRule Classname="Microsoft.VisualStudio.TestTools.WebTesting.Rules.ValidationRuleFindText, Microsoft.VisualStudio.QualityTools.WebTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" DisplayName="Find Text" Description="Verifies the existence of the specified text in the response." Level="High" ExectuionOrder="BeforeDependents">
466 <RuleParameters>
467 <RuleParameter Name="FindText" Value="Digg" />
468 <RuleParameter Name="IgnoreCase" Value="False" />
469 <RuleParameter Name="UseRegularExpression" Value="False" />
470 <RuleParameter Name="PassIfTextFound" Value="True" />
471 </RuleParameters>
472 </ValidationRule>
473 <ValidationRule Classname="Microsoft.VisualStudio.TestTools.WebTesting.Rules.ValidationRuleFindText, Microsoft.VisualStudio.QualityTools.WebTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" DisplayName="Find Text" Description="Verifies the existence of the specified text in the response." Level="High" ExectuionOrder="BeforeDependents">
474 <RuleParameters>
475 <RuleParameter Name="FindText" Value="All rights reserved" />
476 <RuleParameter Name="IgnoreCase" Value="False" />
477 <RuleParameter Name="UseRegularExpression" Value="False" />
478 <RuleParameter Name="PassIfTextFound" Value="True" />
479 </RuleParameters>
480 </ValidationRule>
481 </ValidationRules>
482 </Request>
483 <Comment CommentText="- Logout and ensure Anon Cookie is set to expire" />
484 <Request Method="GET" Version="1.1" Url="{{Config.TestParameters.ServerURL}}/Logout.ashx" ThinkTime="0" Timeout="300" ParseDependentRequests="False" FollowRedirects="False" RecordResult="True" Cache="False" ResponseTimeGoal="0.5" Encoding="utf-8" ExpectedHttpStatusCode="302" ExpectedResponseUrl="" ReportingName="">
485 <ValidationRules>
486 <ValidationRule Classname="Dropthings.Test.Rules.CookieSetToExpire, Dropthings.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" DisplayName="Ensure Cookie Set to Expire" Description="" Level="High" ExectuionOrder="BeforeDependents">
487 <RuleParameters>
488 <RuleParameter Name="CookieName" Value="{{Config.TestParameters.AnonCookieName}}" />
489 <RuleParameter Name="Domain" Value="" />
490 <RuleParameter Name="StopOnError" Value="False" />
491 </RuleParameters>
492 </ValidationRule>
493 </ValidationRules>
494 </Request>
495 </Items>
496 <DataSources>
497 <DataSource Name="Config" Provider="Microsoft.VisualStudio.TestTools.DataSource.XML" Connection="|DataDirectory|\Config\TestParameters.xml">
498 <Tables>
499 <DataSourceTable Name="TestParameters" SelectColumns="SelectOnlyBoundColumns" AccessMethod="Sequential" />
500 </Tables>
501 </DataSource>
502 </DataSources>
503 <ValidationRules>
504 <ValidationRule Classname="Microsoft.VisualStudio.TestTools.WebTesting.Rules.ValidateResponseUrl, Microsoft.VisualStudio.QualityTools.WebTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" DisplayName="Response URL" Description="Validates that the response URL after redirects are followed is the same as the recorded response URL. QueryString parameters are ignored." Level="Low" ExectuionOrder="BeforeDependents" />
505 </ValidationRules>
506 <WebTestPlugins>
507 <WebTestPlugin Classname="Dropthings.Test.Plugin.ASPNETWebTestPlugin, Dropthings.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" DisplayName="ASPNETWebTestPlugin" Description="" />
508 </WebTestPlugins>
509 </WebTest>
510 `)
511
View as plain text