Commit 2df24ed4 2df24ed481b2e31aa02582f6bba8523c6493576a by Christian Gerdes

Ny webtest plugin, DataGeneratorInteger som genererar slumpade integers i tester…

…, sidor, transaktioner eller requests.
1 parent 0ac81457
...@@ -243,6 +243,104 @@ namespace LIL_VSTT_Plugins ...@@ -243,6 +243,104 @@ namespace LIL_VSTT_Plugins
243 } 243 }
244 } 244 }
245 245
246 ///<summary>
247 ///WebTest Plugin Data Generator
248 ///</summary>
249 [DisplayName("Data Generator Integer")]
250 [Description("(C) Copyright 2016 LIGHTS IN LINE AB\r\nGenererar en slumpad integer som context parameter")]
251 public class dataGenInteger : WebTestPlugin
252 {
253 Random RandomNumber = new Random(System.DateTime.Now.Millisecond);
254
255 private string paramName;
256 [DisplayName("Parameter namn")]
257 [Description("Ange namnet på parametern i ditt webtest, tex IntParameter1")]
258 [DefaultValue("TimeStampParameter1")]
259 public string ParamNameVal
260 {
261 get { return paramName; }
262 set { paramName = value; }
263 }
264
265 private int intMin;
266 [DisplayName("Integer Min")]
267 [Description("Ange minsta värdet för parametern i ditt webtest, tex 0")]
268 [DefaultValue(0)]
269 public int IntegerMin
270 {
271 get { return intMin; }
272 set { intMin = value; }
273 }
274
275 private int intMax;
276 [DisplayName("Integer Max")]
277 [Description("Ange högsta värdet för parametern i ditt webtest, tex 100")]
278 [DefaultValue(100)]
279 public int IntegerMax
280 {
281 get { return intMax; }
282 set { intMax = value; }
283 }
284
285 private bool prePage = false;
286 [DisplayName("Uppdatera på varje Page")]
287 [Description("Sätt till true om du vill ha värdet uppdaterat inför varje ny sida som laddas i testet.")]
288 [DefaultValue(false)]
289 public bool PrePageVal
290 {
291 get { return prePage; }
292 set { prePage = value; }
293 }
294
295 private bool preTrans = false;
296 [DisplayName("Uppdatera på varje Transaktion")]
297 [Description("Sätt till true om du vill ha värdet uppdaterat inför varje ny transaktion i testet.")]
298 [DefaultValue(false)]
299 public bool PreTransactionVal
300 {
301 get { return preTrans; }
302 set { preTrans = value; }
303 }
304
305 private bool preReq = false;
306 [DisplayName("Uppdatera på varje Request")]
307 [Description("Sätt till true om du vill ha värdet uppdaterat inför varje nytt request i testet.")]
308 [DefaultValue(false)]
309 public bool PreRequestVal
310 {
311 get { return preReq; }
312 set { preReq = value; }
313 }
314
315 public override void PreWebTest(object sender, PreWebTestEventArgs e)
316 {
317 update(e.WebTest.Context);
318 base.PreWebTest(sender, e);
319 }
320
321 public override void PrePage(object sender, PrePageEventArgs e)
322 {
323 if (prePage) update(e.WebTest.Context);
324 base.PrePage(sender, e);
325 }
326
327 public override void PreRequestDataBinding(object sender, PreRequestDataBindingEventArgs e)
328 {
329 if (preReq) update(e.WebTest.Context);
330 base.PreRequestDataBinding(sender, e);
331 }
332
333 public override void PreTransaction(object sender, PreTransactionEventArgs e)
334 {
335 if (preTrans) update(e.WebTest.Context);
336 base.PreTransaction(sender, e);
337 }
338
339 private void update(WebTestContext context)
340 {
341 context[paramName] = RandomNumber.Next(intMin, intMax);
342 }
343 }
246 344
247 ///<summary> 345 ///<summary>
248 ///WebTest Plugin Data Generator 346 ///WebTest Plugin Data Generator
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
2 <WebTest Name="WebTest3" Id="5f8fe34b-e853-4a88-95cb-a8e963383b09" Owner="" Priority="2147483647" Enabled="True" CssProjectStructure="" CssIteration="" Timeout="0" WorkItemIds="" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010" Description="" CredentialUserName="" CredentialPassword="" PreAuthenticate="True" Proxy="default" StopOnError="False" RecordedResultFile="" ResultsLocale=""> 2 <WebTest Name="WebTest3" Id="5f8fe34b-e853-4a88-95cb-a8e963383b09" Owner="" Priority="2147483647" Enabled="True" CssProjectStructure="" CssIteration="" Timeout="0" WorkItemIds="" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010" Description="" CredentialUserName="" CredentialPassword="" PreAuthenticate="True" Proxy="default" StopOnError="False" RecordedResultFile="" ResultsLocale="">
3 <Items> 3 <Items>
4 <Request Method="GET" Guid="359feba0-105f-4dbf-a630-32d640c10817" Version="1.1" Url="https://new.vinnarum.com/" ThinkTime="0" Timeout="300" ParseDependentRequests="False" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0" Encoding="utf-8" ExpectedHttpStatusCode="0" ExpectedResponseUrl="" ReportingName="" IgnoreHttpStatusCode="False" /> 4 <Request Method="GET" Guid="359feba0-105f-4dbf-a630-32d640c10817" Version="1.1" Url="https://new.vinnarum.com/" ThinkTime="0" Timeout="300" ParseDependentRequests="False" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0" Encoding="utf-8" ExpectedHttpStatusCode="0" ExpectedResponseUrl="" ReportingName="" IgnoreHttpStatusCode="False" />
5 <Request Method="GET" Guid="359feba0-105f-4dbf-a630-32d640c10817" Version="1.1" Url="https://new.vinnarum.com/" ThinkTime="0" Timeout="300" ParseDependentRequests="False" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0" Encoding="utf-8" ExpectedHttpStatusCode="0" ExpectedResponseUrl="" ReportingName="" IgnoreHttpStatusCode="False" />
6 <Request Method="GET" Guid="359feba0-105f-4dbf-a630-32d640c10817" Version="1.1" Url="https://new.vinnarum.com/" ThinkTime="0" Timeout="300" ParseDependentRequests="False" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0" Encoding="utf-8" ExpectedHttpStatusCode="0" ExpectedResponseUrl="" ReportingName="" IgnoreHttpStatusCode="False" />
5 </Items> 7 </Items>
6 <WebTestPlugins> 8 <WebTestPlugins>
7 <WebTestPlugin Classname="LIL_VSTT_Plugins.ServiceManagerWebTestPlugin, LIL_VSTT_Plugins, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null" DisplayName="Service Manager Config" Description="(C) Copyright 2015 LIGHTS IN LINE AB&#xD;&#xA;Sätter config värden i Service Manager instansen för hela testet."> 9 <WebTestPlugin Classname="LIL_VSTT_Plugins.ServiceManagerWebTestPlugin, LIL_VSTT_Plugins, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null" DisplayName="Service Manager Config" Description="(C) Copyright 2015 LIGHTS IN LINE AB&#xD;&#xA;Sätter config värden i Service Manager instansen för hela testet.">
...@@ -15,5 +17,15 @@ ...@@ -15,5 +17,15 @@
15 <RuleParameter Name="useTls12" Value="True" /> 17 <RuleParameter Name="useTls12" Value="True" />
16 </RuleParameters> 18 </RuleParameters>
17 </WebTestPlugin> 19 </WebTestPlugin>
20 <WebTestPlugin Classname="LIL_VSTT_Plugins.dataGenInteger, LIL_VSTT_Plugins, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null" DisplayName="Data Generator Integer" Description="(C) Copyright 2016 LIGHTS IN LINE AB&#xD;&#xA;Genererar en slumpad integer som context parameter">
21 <RuleParameters>
22 <RuleParameter Name="ParamNameVal" Value="TimeStampParameter1" />
23 <RuleParameter Name="IntegerMin" Value="0" />
24 <RuleParameter Name="IntegerMax" Value="100" />
25 <RuleParameter Name="PrePageVal" Value="True" />
26 <RuleParameter Name="PreTransactionVal" Value="False" />
27 <RuleParameter Name="PreRequestVal" Value="False" />
28 </RuleParameters>
29 </WebTestPlugin>
18 </WebTestPlugins> 30 </WebTestPlugins>
19 </WebTest> 31 </WebTest>
...\ No newline at end of file ...\ No newline at end of file
......