Commit 42f432ea 42f432ea4dc73481ce532ab0be0b0243c901f10a by Christian Gerdes

New option to SetTestParameter to abort/stop the loadtest if out of data for issue #7

1 parent b6b0e4f5
1  1 
2 Microsoft Visual Studio Solution File, Format Version 12.00 2 Microsoft Visual Studio Solution File, Format Version 12.00
3 # Visual Studio 14 3 # Visual Studio 14
4 VisualStudioVersion = 14.0.25420.1 4 VisualStudioVersion = 14.0.24720.0
5 MinimumVisualStudioVersion = 10.0.40219.1 5 MinimumVisualStudioVersion = 10.0.40219.1
6 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8ADAFB91-C10D-42C8-8499-30B3692C27F3}" 6 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8ADAFB91-C10D-42C8-8499-30B3692C27F3}"
7 ProjectSection(SolutionItems) = preProject 7 ProjectSection(SolutionItems) = preProject
8 LICENSE = LICENSE 8 LICENSE = LICENSE
9 LIL_VSTT_Plugins.vsmdi = LIL_VSTT_Plugins.vsmdi
10 Local.testsettings = Local.testsettings 9 Local.testsettings = Local.testsettings
11 Notes.md = Notes.md 10 Notes.md = Notes.md
12 README.md = README.md 11 README.md = README.md
......
...@@ -187,6 +187,9 @@ namespace LIL_VSTT_Plugins ...@@ -187,6 +187,9 @@ namespace LIL_VSTT_Plugins
187 private bool myUseAutoSplit = false; 187 private bool myUseAutoSplit = false;
188 private bool myIgnoreBlanks = true; 188 private bool myIgnoreBlanks = true;
189 189
190 private bool stop = false;
191 private int timeWait = 0;
192
190 private StringCollection myParams = new StringCollection(); 193 private StringCollection myParams = new StringCollection();
191 private Random random = new Random(); 194 private Random random = new Random();
192 private Dictionary<string, int> testIterations = new Dictionary<string, int>(); 195 private Dictionary<string, int> testIterations = new Dictionary<string, int>();
...@@ -303,7 +306,7 @@ namespace LIL_VSTT_Plugins ...@@ -303,7 +306,7 @@ namespace LIL_VSTT_Plugins
303 } 306 }
304 307
305 [DisplayName("Välj sekventiell loop?")] 308 [DisplayName("Välj sekventiell loop?")]
306 [Description("Ange true om du vill börja om från början om sekventiell läsning får slut på värden. Gäller även Unik läsning.")] 309 [Description("Ange true om du vill börja om från början om sekventiell läsning får slut på värden. Gäller även Unik läsning. Om data tar slut kommer sista värdet ges till alla om sekventiell loop inte tillåts")]
307 [DefaultValue(false)] 310 [DefaultValue(false)]
308 public bool Use_Loop 311 public bool Use_Loop
309 { 312 {
...@@ -311,6 +314,14 @@ namespace LIL_VSTT_Plugins ...@@ -311,6 +314,14 @@ namespace LIL_VSTT_Plugins
311 set { mySeqLoop = value; } 314 set { mySeqLoop = value; }
312 } 315 }
313 316
317 [DisplayName("OutOfTestDataException?")]
318 [Description("Ange true om du vill att ditt loadtest ska stoppas om testdata tar slut (och Sekventiell Loop är satt till false).")]
319 [DefaultValue(false)]
320 public bool ThrowException
321 {
322 get; set;
323 }
324
314 [DisplayName("Logga fungerande till fil?")] 325 [DisplayName("Logga fungerande till fil?")]
315 [Description("Ange True om du vill att poster vars tester slutar i Pass ska loggas till fil (c:\\fungerande.log). Om filen redan finns läggs de till i slutet.")] 326 [Description("Ange True om du vill att poster vars tester slutar i Pass ska loggas till fil (c:\\fungerande.log). Om filen redan finns läggs de till i slutet.")]
316 [DefaultValue(false)] 327 [DefaultValue(false)]
...@@ -375,6 +386,18 @@ namespace LIL_VSTT_Plugins ...@@ -375,6 +386,18 @@ namespace LIL_VSTT_Plugins
375 { 386 {
376 m_loadTest.TestFinished += new EventHandler<TestFinishedEventArgs>(loadTestEndLogger); 387 m_loadTest.TestFinished += new EventHandler<TestFinishedEventArgs>(loadTestEndLogger);
377 } 388 }
389 m_loadTest.Heartbeat += new EventHandler<HeartbeatEventArgs>(loadTestHeartBeat);
390 }
391
392 void loadTestHeartBeat(object sender, HeartbeatEventArgs e)
393 {
394 if (stop)
395 {
396 if (timeWait > 60)
397 m_loadTest.Abort(new Exception("Out of test data"));
398 else
399 timeWait++;
400 }
378 } 401 }
379 402
380 void loadTestEndLogger(object sender, TestFinishedEventArgs e) 403 void loadTestEndLogger(object sender, TestFinishedEventArgs e)
...@@ -509,8 +532,19 @@ namespace LIL_VSTT_Plugins ...@@ -509,8 +532,19 @@ namespace LIL_VSTT_Plugins
509 { 532 {
510 if (mySeqLoop) 533 if (mySeqLoop)
511 return myParams[seqIndex % myParams.Count]; 534 return myParams[seqIndex % myParams.Count];
512 else 535 else {
513 return myParams[myParams.Count - 1]; 536 // Handle out of testdata here
537 if (ThrowException)
538 {
539 foreach (LoadTestScenario s in m_loadTest.Scenarios)
540 {
541 s.CurrentLoad = 0;
542 }
543 this.stop = true;
544 return "OutOfData";
545 }
546 else return myParams[myParams.Count - 1];
547 }
514 } 548 }
515 } 549 }
516 550
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
2 <TestSettings name="Local" id="f9146b42-ca07-41ed-9af4-6ec2afc90583" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010"> 2 <TestSettings name="Local" id="f9146b42-ca07-41ed-9af4-6ec2afc90583" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
3 <Description>These are default test settings for a local test run.</Description> 3 <Description>These are default test settings for a local test run.</Description>
4 <Deployment> 4 <Deployment>
5 <DeploymentItem filename="TestProject1\UserdataFew.csv" />
5 <DeploymentItem filename="TestProject1\Userdata.csv" /> 6 <DeploymentItem filename="TestProject1\Userdata.csv" />
6 </Deployment> 7 </Deployment>
7 <Execution hostProcessPlatform="MSIL"> 8 <Execution hostProcessPlatform="MSIL">
......
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <LoadTest Name="LoadTest1" Description="" Owner="" storage="d:\git\vstt-plugins\testproject1\loadtest1.loadtest" Priority="2147483647" Enabled="true" CssProjectStructure="" CssIteration="" DeploymentItemsEditable="" WorkItemIds="" TraceLevel="None" CurrentRunConfig="Run Settings1" Id="0e35c1c4-9214-4fc4-907f-42e11a00845a" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010"> 2 <LoadTest Name="LoadTest1" Description="" Owner="" storage="c:\users\wflg\source\repos\vstt-plugins\testproject1\loadtest1.loadtest" Priority="2147483647" Enabled="true" CssProjectStructure="" CssIteration="" DeploymentItemsEditable="" WorkItemIds="" TraceLevel="None" CurrentRunConfig="Run Settings1" Id="0e35c1c4-9214-4fc4-907f-42e11a00845a" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
3 <Scenarios> 3 <Scenarios>
4 <Scenario Name="Scenario1" DelayBetweenIterations="1" PercentNewUsers="0" IPSwitching="true" TestMixType="PercentageOfUsersRunning" ApplyDistributionToPacingDelay="true" MaxTestIterations="0" DisableDuringWarmup="false" DelayStartTime="0" AllowedAgents=""> 4 <Scenario Name="Scenario1" DelayBetweenIterations="30" PercentNewUsers="0" IPSwitching="true" TestMixType="PercentageOfUsersRunning" ApplyDistributionToPacingDelay="true" MaxTestIterations="0" DisableDuringWarmup="false" DelayStartTime="0" AllowedAgents="">
5 <ThinkProfile Value="0.2" Pattern="NormalDistribution" /> 5 <ThinkProfile Value="0.2" Pattern="NormalDistribution" />
6 <LoadProfile Pattern="Constant" InitialUsers="4" /> 6 <LoadProfile Pattern="Constant" InitialUsers="2" />
7 <TestMix> 7 <TestMix>
8 <TestProfile Name="WebTest21" Path="webtest21.webtest" Id="9af8354e-b982-4f5a-80f9-777eaed55003" Percentage="100" Type="Microsoft.VisualStudio.TestTools.WebStress.DeclarativeWebTestElement, Microsoft.VisualStudio.QualityTools.LoadTest, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> 8 <TestProfile Name="WebTest8" Path="webtest8.webtest" Id="bac430ba-6ffc-4989-a29b-d9425412a248" Percentage="100" Type="Microsoft.VisualStudio.TestTools.WebStress.DeclarativeWebTestElement, Microsoft.VisualStudio.QualityTools.LoadTest, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
9 </TestMix> 9 </TestMix>
10 <BrowserMix> 10 <BrowserMix>
11 <BrowserProfile Percentage="100"> 11 <BrowserProfile Percentage="100">
...@@ -416,7 +416,7 @@ ...@@ -416,7 +416,7 @@
416 </CounterSet> 416 </CounterSet>
417 </CounterSets> 417 </CounterSets>
418 <RunConfigurations> 418 <RunConfigurations>
419 <RunConfiguration Name="Run Settings1" Description="" ResultsStoreType="Database" TimingDetailsStorage="AllIndividualDetails" SaveTestLogsOnError="true" SaveTestLogsFrequency="1" MaxErrorDetails="200" MaxErrorsPerType="1000" MaxThresholdViolations="1000" MaxRequestUrlsReported="1000" UseTestIterations="true" RunDuration="600" WarmupTime="0" CoolDownTime="0" TestIterations="8" WebTestConnectionModel="ConnectionPerUser" WebTestConnectionPoolSize="50" SampleRate="5" ValidationLevel="High" SqlTracingConnectString="" SqlTracingConnectStringDisplayValue="" SqlTracingDirectory="" SqlTracingEnabled="false" SqlTracingFileCount="2" SqlTracingRolloverEnabled="true" SqlTracingMinimumDuration="500" RunUnitTestsInAppDomain="true" CoreCount="0" ResourcesRetentionTimeInMinutes="0" UseMultipleIPs="false" TestAgentConfiguration="Default" AgentDiagnosticsLevel="Warning"> 419 <RunConfiguration Name="Run Settings1" Description="" ResultsStoreType="Database" TimingDetailsStorage="AllIndividualDetails" SaveTestLogsOnError="true" SaveTestLogsFrequency="1" MaxErrorDetails="200" MaxErrorsPerType="1000" MaxThresholdViolations="1000" MaxRequestUrlsReported="1000" UseTestIterations="true" RunDuration="600" WarmupTime="0" CoolDownTime="0" TestIterations="8" WebTestConnectionModel="ConnectionPerUser" WebTestConnectionPoolSize="50" SampleRate="5" ValidationLevel="High" SqlTracingConnectString="" SqlTracingConnectStringDisplayValue="" SqlTracingDirectory="" SqlTracingEnabled="false" SqlTracingFileCount="2" SqlTracingRolloverEnabled="true" SqlTracingMinimumDuration="500" RunUnitTestsInAppDomain="true" CoreCount="0" UseMultipleIPs="false" TestAgentConfiguration="Default" AgentDiagnosticsLevel="Warning">
420 <CounterSetMappings> 420 <CounterSetMappings>
421 <CounterSetMapping ComputerName="[CONTROLLER MACHINE]"> 421 <CounterSetMapping ComputerName="[CONTROLLER MACHINE]">
422 <CounterSetReferences> 422 <CounterSetReferences>
...@@ -435,10 +435,10 @@ ...@@ -435,10 +435,10 @@
435 <LoadTestPlugins> 435 <LoadTestPlugins>
436 <LoadTestPlugin Classname="LIL_VSTT_Plugins.SetTestParameter, LIL_VSTT_Plugins, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null" DisplayName="Set Test Context Parameters" Description="(C) Copyright 2011 LIGHTS IN LINE AB&#xD;&#xA;Sätter parametrar i testcontextet för tester i mixen hämtat från en CSV fil"> 436 <LoadTestPlugin Classname="LIL_VSTT_Plugins.SetTestParameter, LIL_VSTT_Plugins, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null" DisplayName="Set Test Context Parameters" Description="(C) Copyright 2011 LIGHTS IN LINE AB&#xD;&#xA;Sätter parametrar i testcontextet för tester i mixen hämtat från en CSV fil">
437 <RuleParameters> 437 <RuleParameters>
438 <RuleParameter Name="Connection_String" Value="Userdata.csv" /> 438 <RuleParameter Name="Connection_String" Value="UserdataFew.csv" />
439 <RuleParameter Name="Has_col_name" Value="False" /> 439 <RuleParameter Name="Has_col_name" Value="True" />
440 <RuleParameter Name="Autosplit" Value="False" /> 440 <RuleParameter Name="Autosplit" Value="False" />
441 <RuleParameter Name="Parameter_Name" Value="Parameter1" /> 441 <RuleParameter Name="Parameter_Name" Value="Kolumnnamn" />
442 <RuleParameter Name="LogFilePathString" Value="C:\Temp\Fungerande.log" /> 442 <RuleParameter Name="LogFilePathString" Value="C:\Temp\Fungerande.log" />
443 <RuleParameter Name="LogFileAppendID" Value="False" /> 443 <RuleParameter Name="LogFileAppendID" Value="False" />
444 <RuleParameter Name="LogFileAppendName" Value="False" /> 444 <RuleParameter Name="LogFileAppendName" Value="False" />
...@@ -452,6 +452,7 @@ ...@@ -452,6 +452,7 @@
452 <RuleParameter Name="Agent_Names" Value="" /> 452 <RuleParameter Name="Agent_Names" Value="" />
453 <RuleParameter Name="Use_UniqueTestIteration" Value="True" /> 453 <RuleParameter Name="Use_UniqueTestIteration" Value="True" />
454 <RuleParameter Name="IgnoreBlanks" Value="True" /> 454 <RuleParameter Name="IgnoreBlanks" Value="True" />
455 <RuleParameter Name="ThrowException" Value="True" />
455 </RuleParameters> 456 </RuleParameters>
456 </LoadTestPlugin> 457 </LoadTestPlugin>
457 </LoadTestPlugins> 458 </LoadTestPlugins>
......
...@@ -89,6 +89,9 @@ ...@@ -89,6 +89,9 @@
89 <None Include="LoadTest6.loadtest"> 89 <None Include="LoadTest6.loadtest">
90 <CopyToOutputDirectory>Always</CopyToOutputDirectory> 90 <CopyToOutputDirectory>Always</CopyToOutputDirectory>
91 </None> 91 </None>
92 <Content Include="UserdataFew.csv">
93 <CopyToOutputDirectory>Always</CopyToOutputDirectory>
94 </Content>
92 <None Include="WebTest2.webtest"> 95 <None Include="WebTest2.webtest">
93 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 96 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
94 </None> 97 </None>
...@@ -119,6 +122,9 @@ ...@@ -119,6 +122,9 @@
119 <None Include="WebTest7.webtest"> 122 <None Include="WebTest7.webtest">
120 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 123 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
121 </None> 124 </None>
125 <None Include="WebTest8.webtest">
126 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
127 </None>
122 </ItemGroup> 128 </ItemGroup>
123 <ItemGroup> 129 <ItemGroup>
124 <ProjectReference Include="..\LIL_VSTT_Plugins\LIL_VSTT_Plugins.csproj"> 130 <ProjectReference Include="..\LIL_VSTT_Plugins\LIL_VSTT_Plugins.csproj">
......
1 UserName
2 user1
3 user2
4 user3
...\ No newline at end of file ...\ No newline at end of file
1 <?xml version="1.0" encoding="utf-8"?>
2 <WebTest Name="WebTest8" Id="bac430ba-6ffc-4989-a29b-d9425412a248" 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>
4 <Request Method="GET" Guid="98c3ac11-a7d8-4267-ad44-075ad706a99b" Version="1.1" Url="http://na28133.rsva.se:8080/SiteScope/servlet/Main" ThinkTime="1" Timeout="300" ParseDependentRequests="False" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0" Encoding="utf-8" ExpectedHttpStatusCode="0" ExpectedResponseUrl="" ReportingName="" IgnoreHttpStatusCode="False" />
5 </Items>
6 </WebTest>
...\ No newline at end of file ...\ No newline at end of file