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

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8ADAFB91-C10D-42C8-8499-30B3692C27F3}"
ProjectSection(SolutionItems) = preProject
LICENSE = LICENSE
LIL_VSTT_Plugins.vsmdi = LIL_VSTT_Plugins.vsmdi
Local.testsettings = Local.testsettings
Notes.md = Notes.md
README.md = README.md
......
......@@ -186,6 +186,9 @@ namespace LIL_VSTT_Plugins
private bool myHasColName = false;
private bool myUseAutoSplit = false;
private bool myIgnoreBlanks = true;
private bool stop = false;
private int timeWait = 0;
private StringCollection myParams = new StringCollection();
private Random random = new Random();
......@@ -303,7 +306,7 @@ namespace LIL_VSTT_Plugins
}
[DisplayName("Välj sekventiell loop?")]
[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.")]
[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")]
[DefaultValue(false)]
public bool Use_Loop
{
......@@ -311,6 +314,14 @@ namespace LIL_VSTT_Plugins
set { mySeqLoop = value; }
}
[DisplayName("OutOfTestDataException?")]
[Description("Ange true om du vill att ditt loadtest ska stoppas om testdata tar slut (och Sekventiell Loop är satt till false).")]
[DefaultValue(false)]
public bool ThrowException
{
get; set;
}
[DisplayName("Logga fungerande till fil?")]
[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.")]
[DefaultValue(false)]
......@@ -375,6 +386,18 @@ namespace LIL_VSTT_Plugins
{
m_loadTest.TestFinished += new EventHandler<TestFinishedEventArgs>(loadTestEndLogger);
}
m_loadTest.Heartbeat += new EventHandler<HeartbeatEventArgs>(loadTestHeartBeat);
}
void loadTestHeartBeat(object sender, HeartbeatEventArgs e)
{
if (stop)
{
if (timeWait > 60)
m_loadTest.Abort(new Exception("Out of test data"));
else
timeWait++;
}
}
void loadTestEndLogger(object sender, TestFinishedEventArgs e)
......@@ -509,8 +532,19 @@ namespace LIL_VSTT_Plugins
{
if (mySeqLoop)
return myParams[seqIndex % myParams.Count];
else
return myParams[myParams.Count - 1];
else {
// Handle out of testdata here
if (ThrowException)
{
foreach (LoadTestScenario s in m_loadTest.Scenarios)
{
s.CurrentLoad = 0;
}
this.stop = true;
return "OutOfData";
}
else return myParams[myParams.Count - 1];
}
}
}
......
......@@ -2,6 +2,7 @@
<TestSettings name="Local" id="f9146b42-ca07-41ed-9af4-6ec2afc90583" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<Description>These are default test settings for a local test run.</Description>
<Deployment>
<DeploymentItem filename="TestProject1\UserdataFew.csv" />
<DeploymentItem filename="TestProject1\Userdata.csv" />
</Deployment>
<Execution hostProcessPlatform="MSIL">
......
<?xml version="1.0" encoding="utf-8"?>
<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">
<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">
<Scenarios>
<Scenario Name="Scenario1" DelayBetweenIterations="1" PercentNewUsers="0" IPSwitching="true" TestMixType="PercentageOfUsersRunning" ApplyDistributionToPacingDelay="true" MaxTestIterations="0" DisableDuringWarmup="false" DelayStartTime="0" AllowedAgents="">
<Scenario Name="Scenario1" DelayBetweenIterations="30" PercentNewUsers="0" IPSwitching="true" TestMixType="PercentageOfUsersRunning" ApplyDistributionToPacingDelay="true" MaxTestIterations="0" DisableDuringWarmup="false" DelayStartTime="0" AllowedAgents="">
<ThinkProfile Value="0.2" Pattern="NormalDistribution" />
<LoadProfile Pattern="Constant" InitialUsers="4" />
<LoadProfile Pattern="Constant" InitialUsers="2" />
<TestMix>
<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" />
<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" />
</TestMix>
<BrowserMix>
<BrowserProfile Percentage="100">
......@@ -416,7 +416,7 @@
</CounterSet>
</CounterSets>
<RunConfigurations>
<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">
<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">
<CounterSetMappings>
<CounterSetMapping ComputerName="[CONTROLLER MACHINE]">
<CounterSetReferences>
......@@ -435,10 +435,10 @@
<LoadTestPlugins>
<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">
<RuleParameters>
<RuleParameter Name="Connection_String" Value="Userdata.csv" />
<RuleParameter Name="Has_col_name" Value="False" />
<RuleParameter Name="Connection_String" Value="UserdataFew.csv" />
<RuleParameter Name="Has_col_name" Value="True" />
<RuleParameter Name="Autosplit" Value="False" />
<RuleParameter Name="Parameter_Name" Value="Parameter1" />
<RuleParameter Name="Parameter_Name" Value="Kolumnnamn" />
<RuleParameter Name="LogFilePathString" Value="C:\Temp\Fungerande.log" />
<RuleParameter Name="LogFileAppendID" Value="False" />
<RuleParameter Name="LogFileAppendName" Value="False" />
......@@ -452,6 +452,7 @@
<RuleParameter Name="Agent_Names" Value="" />
<RuleParameter Name="Use_UniqueTestIteration" Value="True" />
<RuleParameter Name="IgnoreBlanks" Value="True" />
<RuleParameter Name="ThrowException" Value="True" />
</RuleParameters>
</LoadTestPlugin>
</LoadTestPlugins>
......
......@@ -89,6 +89,9 @@
<None Include="LoadTest6.loadtest">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Content Include="UserdataFew.csv">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<None Include="WebTest2.webtest">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
......@@ -119,6 +122,9 @@
<None Include="WebTest7.webtest">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="WebTest8.webtest">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LIL_VSTT_Plugins\LIL_VSTT_Plugins.csproj">
......
UserName
user1
user2
user3
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<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="">
<Items>
<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" />
</Items>
</WebTest>
\ No newline at end of file