Commit bc8d1a03 bc8d1a03c1abe03a11283fd0342982a47de963ea by Christian Gerdes

New version with more options for the ServiceManagerPlugin for loadtests

1 parent 914a719f
......@@ -17,6 +17,7 @@ using Microsoft.VisualStudio.TestTools.LoadTesting;
using System.ComponentModel;
using System.IO;
using System.Collections.Specialized;
using System.Net;
namespace LIL_VSTT_Plugins
{
......@@ -83,35 +84,75 @@ namespace LIL_VSTT_Plugins
[Description("(C) Copyright 2015 LIGHTS IN LINE AB\r\nSätter config värden i Service Manager instansen för hela loadtestet. Finns även som WebTestPlugin som enbart slår på det webtestet.")]
public class ServiceManagerPlugin : ILoadTestPlugin
{
[DisplayName("Use Expect 100 Behaviour"), DefaultValue(true)]
[DisplayName("Enable Expect 100 Behaviour"), DefaultValue(false)]
[Description(".Net 4.5 default is true, plugin default is false")]
public bool exp100 { get; set; }
[DisplayName("Max Connection Idle Time"), DefaultValue(100)]
[DisplayName("Connection Pool Idle Time (s)"), DefaultValue(100)]
public int maxIdle { get; set; }
[DisplayName("DNS Refresh Timeout (s)"), DefaultValue(120)]
public int DnsRefreshTimeout { get; set; }
[DisplayName("Enable DNS Round Robin"), DefaultValue(false)]
public bool EnableDnsRoundRobin { get; set; }
[Category("Transport Control")]
[DisplayName("TCP Keep Alive"), DefaultValue(false)]
public bool keepAlive { get; set; }
[Category("Transport Control")]
[DisplayName("TCP Keep Alive Timeout (ms)"), DefaultValue(5000)]
public int timeOut { get; set; }
[Category("Transport Control")]
[DisplayName("TCP Keep Alive Interval"), DefaultValue(1000)]
public int interVal { get; set; }
[Category("Transport Control")]
[DisplayName("Use Nagle Algorithm"), DefaultValue(false)]
public bool useNagle { get; set; }
[DisplayName("Force TLS 1.2"), DefaultValue(false)]
[Description("Kräver .NET 4.5 samt att TLS1.2 är aktiverat i SChannel (använd bifogad schannel_high.reg)")]
[Category("Secure Sockets")]
[DisplayName("Enable TLS 1.2"), DefaultValue(true)]
[Description(".Net 4.5 default is false, plugin default is true")]
public bool useTls12 { get; set; }
[Category("Secure Sockets")]
[DisplayName("Enable TLS 1.1"), DefaultValue(true)]
[Description(".Net 4.5 default is false, plugin default is true")]
public bool useTls11 { get; set; }
[Category("Secure Sockets")]
[DisplayName("Enable TLS 1.0"), DefaultValue(true)]
public bool useTls10 { get; set; }
[Category("Secure Sockets")]
[DisplayName("Enable SSL 3.0"), DefaultValue(false)]
public bool useSsl3 { get; set; }
[Category("Secure Sockets")]
[DisplayName("Enable CRL checks"), DefaultValue(false)]
public bool useCrl { get; set; }
public void Initialize(LoadTest loadTest)
{
System.Net.ServicePointManager.Expect100Continue = exp100;
System.Net.ServicePointManager.MaxServicePointIdleTime = maxIdle;
System.Net.ServicePointManager.SetTcpKeepAlive(keepAlive, timeOut, interVal);
System.Net.ServicePointManager.UseNagleAlgorithm = useNagle;
if (useTls12) System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
ServicePointManager.Expect100Continue = exp100;
ServicePointManager.MaxServicePointIdleTime = maxIdle * 1000;
ServicePointManager.DnsRefreshTimeout = DnsRefreshTimeout * 1000;
ServicePointManager.EnableDnsRoundRobin = EnableDnsRoundRobin;
ServicePointManager.SetTcpKeepAlive(keepAlive, timeOut, interVal);
ServicePointManager.UseNagleAlgorithm = useNagle;
//if (useTls12) System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
if (useSsl3) ServicePointManager.SecurityProtocol |= SecurityProtocolType.Ssl3;
else ServicePointManager.SecurityProtocol &= SecurityProtocolType.Ssl3;
if (useTls10) ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls;
else ServicePointManager.SecurityProtocol &= SecurityProtocolType.Tls;
if (useTls11) ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls11;
else ServicePointManager.SecurityProtocol &= SecurityProtocolType.Tls11;
if (useTls12) ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
else ServicePointManager.SecurityProtocol &= SecurityProtocolType.Tls12;
ServicePointManager.CheckCertificateRevocationList = useCrl;
}
}
......
<?xml version="1.0" encoding="utf-8"?>
<LoadTest Name="LoadTest5" Description="" Owner="" storage="c:\ws\repos\vstt-plugins\testproject1\loadtest5.loadtest" Priority="2147483647" Enabled="true" CssProjectStructure="" CssIteration="" DeploymentItemsEditable="" WorkItemIds="" TraceLevel="None" CurrentRunConfig="Run Settings1" Id="67894cbd-a6dc-48d4-997b-05f60d87d6e7" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<LoadTest Name="LoadTest5" Description="" Owner="" storage="c:\users\wflg\source\repos\vstt-plugins\testproject1\loadtest5.loadtest" Priority="2147483647" Enabled="true" CssProjectStructure="" CssIteration="" DeploymentItemsEditable="" WorkItemIds="" TraceLevel="None" CurrentRunConfig="Run Settings1" Id="67894cbd-a6dc-48d4-997b-05f60d87d6e7" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<Scenarios>
<Scenario Name="Scenario1" DelayBetweenIterations="0" PercentNewUsers="0" IPSwitching="false" TestMixType="PercentageOfTestsStarted" ApplyDistributionToPacingDelay="true" MaxTestIterations="0" DisableDuringWarmup="false" DelayStartTime="0" AllowedAgents="">
<ThinkProfile Value="0.2" Pattern="Off" />
......@@ -440,4 +440,23 @@
</LoadGeneratorLocations>
</RunConfiguration>
</RunConfigurations>
<LoadTestPlugins>
<LoadTestPlugin Classname="LIL_VSTT_Plugins.ServiceManagerPlugin, 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 loadtestet. Finns även som WebTestPlugin som enbart slår på det webtestet.">
<RuleParameters>
<RuleParameter Name="exp100" Value="True" />
<RuleParameter Name="maxIdle" Value="100" />
<RuleParameter Name="DnsRefreshTimeout" Value="120" />
<RuleParameter Name="EnableDnsRoundRobin" Value="False" />
<RuleParameter Name="keepAlive" Value="False" />
<RuleParameter Name="timeOut" Value="5000" />
<RuleParameter Name="interVal" Value="1000" />
<RuleParameter Name="useNagle" Value="False" />
<RuleParameter Name="useTls12" Value="False" />
<RuleParameter Name="useTls11" Value="False" />
<RuleParameter Name="useTls10" Value="True" />
<RuleParameter Name="useSsl3" Value="False" />
<RuleParameter Name="useCrl" Value="False" />
</RuleParameters>
</LoadTestPlugin>
</LoadTestPlugins>
</LoadTest>
\ No newline at end of file
......
<?xml version="1.0" encoding="utf-8"?>
<WebTest Name="WebTest6" Id="122acb09-9cc2-4809-903b-a7fee7f1e5c3" 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="WebTest5.10d2bf93-1ab4-4a60-b4ff-f80b74d5d7e4.rec.webtestresult" ResultsLocale="">
<Items>
<Request Method="GET" Guid="57c5c6f4-6ec7-461e-85f2-5ff56e9a7a5f" Version="1.1" Url="https://u30015:45123/aimk12/KontrolluppgiftServiceV2TO/KontrolluppgiftServiceV2TO" ThinkTime="0" Timeout="300" ParseDependentRequests="True" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0" Encoding="utf-8" ExpectedHttpStatusCode="0" ExpectedResponseUrl="" ReportingName="" IgnoreHttpStatusCode="False">
<Headers>
<Header Name="Accept" Value="application/json, text/plain, */*" />
</Headers>
</Request>
<Request Method="GET" Guid="57c5c6f4-6ec7-461e-85f2-5ff56e9a7a5f" Version="1.1" Url="https://ssokpr.rsv.se/" ThinkTime="0" Timeout="300" ParseDependentRequests="True" FollowRedirects="False" RecordResult="True" Cache="False" ResponseTimeGoal="0" Encoding="utf-8" ExpectedHttpStatusCode="0" ExpectedResponseUrl="" ReportingName="" IgnoreHttpStatusCode="False" />
<Request Method="GET" Guid="69c1e190-3d37-4759-a340-83bdcf7457a7" Version="1.1" Url="https://ppmk2s2.pp.kap.rsv.se:17001/" ThinkTime="0" Timeout="300" ParseDependentRequests="True" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0" Encoding="utf-8" ExpectedHttpStatusCode="0" ExpectedResponseUrl="" ReportingName="" IgnoreHttpStatusCode="False" />
</Items>
<ContextParameters>
<ContextParameter Name="PEM" Value="U:\projekt\MjukaCertifikat\Interna_Certifikat_Okt_2016\8946019907112000070.pem" />
</ContextParameters>
<ValidationRules>
<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" />
<ValidationRule Classname="Microsoft.VisualStudio.TestTools.WebTesting.Rules.ValidationRuleResponseTimeGoal, Microsoft.VisualStudio.QualityTools.WebTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" DisplayName="Response Time Goal" Description="Validates that the response time for the request is less than or equal to the response time goal as specified on the request. Response time goals of zero will be ignored." Level="Low" ExectuionOrder="AfterDependents">
......@@ -28,17 +22,7 @@
<RuleParameter Name="interVal" Value="1000" />
<RuleParameter Name="useNagle" Value="False" />
<RuleParameter Name="useTls12" Value="False" />
</RuleParameters>
</WebTestPlugin>
<WebTestPlugin Classname="LIL_VSTT_Plugins.ClientCertificatePlugin, LIL_VSTT_Plugins, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null" DisplayName="Client Certificate" Description="(C) Copyright 2016 LIGHTS IN LINE AB&#xD;&#xA;Sätter webtestet att använda ett specifikt client cert för SSL. Certifikatet behöver inte installeras i certstore först.">
<RuleParameters>
<RuleParameter Name="pCertificatePath" Value="" />
<RuleParameter Name="pCertificatePathParameter" Value="PEM" />
<RuleParameter Name="pCertificatePassword" Value="" />
<RuleParameter Name="pCertificatePasswordParameter" Value="" />
<RuleParameter Name="pDebug" Value="True" />
<RuleParameter Name="pInstallTrusted" Value="True" />
<RuleParameter Name="pInstallUntrusted" Value="False" />
<RuleParameter Name="proxyOverride" Value="True" />
</RuleParameters>
</WebTestPlugin>
</WebTestPlugins>
......