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; ...@@ -17,6 +17,7 @@ using Microsoft.VisualStudio.TestTools.LoadTesting;
17 using System.ComponentModel; 17 using System.ComponentModel;
18 using System.IO; 18 using System.IO;
19 using System.Collections.Specialized; 19 using System.Collections.Specialized;
20 using System.Net;
20 21
21 namespace LIL_VSTT_Plugins 22 namespace LIL_VSTT_Plugins
22 { 23 {
...@@ -83,35 +84,75 @@ namespace LIL_VSTT_Plugins ...@@ -83,35 +84,75 @@ namespace LIL_VSTT_Plugins
83 [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.")] 84 [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.")]
84 public class ServiceManagerPlugin : ILoadTestPlugin 85 public class ServiceManagerPlugin : ILoadTestPlugin
85 { 86 {
86 [DisplayName("Use Expect 100 Behaviour"), DefaultValue(true)] 87 [DisplayName("Enable Expect 100 Behaviour"), DefaultValue(false)]
88 [Description(".Net 4.5 default is true, plugin default is false")]
87 public bool exp100 { get; set; } 89 public bool exp100 { get; set; }
88 90
89 [DisplayName("Max Connection Idle Time"), DefaultValue(100)] 91 [DisplayName("Connection Pool Idle Time (s)"), DefaultValue(100)]
90 public int maxIdle { get; set; } 92 public int maxIdle { get; set; }
91 93
94 [DisplayName("DNS Refresh Timeout (s)"), DefaultValue(120)]
95 public int DnsRefreshTimeout { get; set; }
96
97 [DisplayName("Enable DNS Round Robin"), DefaultValue(false)]
98 public bool EnableDnsRoundRobin { get; set; }
99
100 [Category("Transport Control")]
92 [DisplayName("TCP Keep Alive"), DefaultValue(false)] 101 [DisplayName("TCP Keep Alive"), DefaultValue(false)]
93 public bool keepAlive { get; set; } 102 public bool keepAlive { get; set; }
94 103
104 [Category("Transport Control")]
95 [DisplayName("TCP Keep Alive Timeout (ms)"), DefaultValue(5000)] 105 [DisplayName("TCP Keep Alive Timeout (ms)"), DefaultValue(5000)]
96 public int timeOut { get; set; } 106 public int timeOut { get; set; }
97 107
108 [Category("Transport Control")]
98 [DisplayName("TCP Keep Alive Interval"), DefaultValue(1000)] 109 [DisplayName("TCP Keep Alive Interval"), DefaultValue(1000)]
99 public int interVal { get; set; } 110 public int interVal { get; set; }
100 111
112 [Category("Transport Control")]
101 [DisplayName("Use Nagle Algorithm"), DefaultValue(false)] 113 [DisplayName("Use Nagle Algorithm"), DefaultValue(false)]
102 public bool useNagle { get; set; } 114 public bool useNagle { get; set; }
103 115
104 [DisplayName("Force TLS 1.2"), DefaultValue(false)] 116 [Category("Secure Sockets")]
105 [Description("Kräver .NET 4.5 samt att TLS1.2 är aktiverat i SChannel (använd bifogad schannel_high.reg)")] 117 [DisplayName("Enable TLS 1.2"), DefaultValue(true)]
118 [Description(".Net 4.5 default is false, plugin default is true")]
106 public bool useTls12 { get; set; } 119 public bool useTls12 { get; set; }
107 120
121 [Category("Secure Sockets")]
122 [DisplayName("Enable TLS 1.1"), DefaultValue(true)]
123 [Description(".Net 4.5 default is false, plugin default is true")]
124 public bool useTls11 { get; set; }
125
126 [Category("Secure Sockets")]
127 [DisplayName("Enable TLS 1.0"), DefaultValue(true)]
128 public bool useTls10 { get; set; }
129
130 [Category("Secure Sockets")]
131 [DisplayName("Enable SSL 3.0"), DefaultValue(false)]
132 public bool useSsl3 { get; set; }
133
134 [Category("Secure Sockets")]
135 [DisplayName("Enable CRL checks"), DefaultValue(false)]
136 public bool useCrl { get; set; }
137
108 public void Initialize(LoadTest loadTest) 138 public void Initialize(LoadTest loadTest)
109 { 139 {
110 System.Net.ServicePointManager.Expect100Continue = exp100; 140 ServicePointManager.Expect100Continue = exp100;
111 System.Net.ServicePointManager.MaxServicePointIdleTime = maxIdle; 141 ServicePointManager.MaxServicePointIdleTime = maxIdle * 1000;
112 System.Net.ServicePointManager.SetTcpKeepAlive(keepAlive, timeOut, interVal); 142 ServicePointManager.DnsRefreshTimeout = DnsRefreshTimeout * 1000;
113 System.Net.ServicePointManager.UseNagleAlgorithm = useNagle; 143 ServicePointManager.EnableDnsRoundRobin = EnableDnsRoundRobin;
114 if (useTls12) System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; 144 ServicePointManager.SetTcpKeepAlive(keepAlive, timeOut, interVal);
145 ServicePointManager.UseNagleAlgorithm = useNagle;
146 //if (useTls12) System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
147 if (useSsl3) ServicePointManager.SecurityProtocol |= SecurityProtocolType.Ssl3;
148 else ServicePointManager.SecurityProtocol &= SecurityProtocolType.Ssl3;
149 if (useTls10) ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls;
150 else ServicePointManager.SecurityProtocol &= SecurityProtocolType.Tls;
151 if (useTls11) ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls11;
152 else ServicePointManager.SecurityProtocol &= SecurityProtocolType.Tls11;
153 if (useTls12) ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
154 else ServicePointManager.SecurityProtocol &= SecurityProtocolType.Tls12;
155 ServicePointManager.CheckCertificateRevocationList = useCrl;
115 } 156 }
116 157
117 } 158 }
......
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <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"> 2 <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">
3 <Scenarios> 3 <Scenarios>
4 <Scenario Name="Scenario1" DelayBetweenIterations="0" PercentNewUsers="0" IPSwitching="false" TestMixType="PercentageOfTestsStarted" ApplyDistributionToPacingDelay="true" MaxTestIterations="0" DisableDuringWarmup="false" DelayStartTime="0" AllowedAgents=""> 4 <Scenario Name="Scenario1" DelayBetweenIterations="0" PercentNewUsers="0" IPSwitching="false" TestMixType="PercentageOfTestsStarted" ApplyDistributionToPacingDelay="true" MaxTestIterations="0" DisableDuringWarmup="false" DelayStartTime="0" AllowedAgents="">
5 <ThinkProfile Value="0.2" Pattern="Off" /> 5 <ThinkProfile Value="0.2" Pattern="Off" />
...@@ -440,4 +440,23 @@ ...@@ -440,4 +440,23 @@
440 </LoadGeneratorLocations> 440 </LoadGeneratorLocations>
441 </RunConfiguration> 441 </RunConfiguration>
442 </RunConfigurations> 442 </RunConfigurations>
443 <LoadTestPlugins>
444 <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.">
445 <RuleParameters>
446 <RuleParameter Name="exp100" Value="True" />
447 <RuleParameter Name="maxIdle" Value="100" />
448 <RuleParameter Name="DnsRefreshTimeout" Value="120" />
449 <RuleParameter Name="EnableDnsRoundRobin" Value="False" />
450 <RuleParameter Name="keepAlive" Value="False" />
451 <RuleParameter Name="timeOut" Value="5000" />
452 <RuleParameter Name="interVal" Value="1000" />
453 <RuleParameter Name="useNagle" Value="False" />
454 <RuleParameter Name="useTls12" Value="False" />
455 <RuleParameter Name="useTls11" Value="False" />
456 <RuleParameter Name="useTls10" Value="True" />
457 <RuleParameter Name="useSsl3" Value="False" />
458 <RuleParameter Name="useCrl" Value="False" />
459 </RuleParameters>
460 </LoadTestPlugin>
461 </LoadTestPlugins>
443 </LoadTest> 462 </LoadTest>
...\ No newline at end of file ...\ No newline at end of file
......
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <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=""> 2 <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="">
3 <Items> 3 <Items>
4 <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"> 4 <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" />
5 <Headers> 5 <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" />
6 <Header Name="Accept" Value="application/json, text/plain, */*" />
7 </Headers>
8 </Request>
9 </Items> 6 </Items>
10 <ContextParameters>
11 <ContextParameter Name="PEM" Value="U:\projekt\MjukaCertifikat\Interna_Certifikat_Okt_2016\8946019907112000070.pem" />
12 </ContextParameters>
13 <ValidationRules> 7 <ValidationRules>
14 <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" /> 8 <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" />
15 <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"> 9 <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 @@ ...@@ -28,17 +22,7 @@
28 <RuleParameter Name="interVal" Value="1000" /> 22 <RuleParameter Name="interVal" Value="1000" />
29 <RuleParameter Name="useNagle" Value="False" /> 23 <RuleParameter Name="useNagle" Value="False" />
30 <RuleParameter Name="useTls12" Value="False" /> 24 <RuleParameter Name="useTls12" Value="False" />
31 </RuleParameters> 25 <RuleParameter Name="proxyOverride" Value="True" />
32 </WebTestPlugin>
33 <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.">
34 <RuleParameters>
35 <RuleParameter Name="pCertificatePath" Value="" />
36 <RuleParameter Name="pCertificatePathParameter" Value="PEM" />
37 <RuleParameter Name="pCertificatePassword" Value="" />
38 <RuleParameter Name="pCertificatePasswordParameter" Value="" />
39 <RuleParameter Name="pDebug" Value="True" />
40 <RuleParameter Name="pInstallTrusted" Value="True" />
41 <RuleParameter Name="pInstallUntrusted" Value="False" />
42 </RuleParameters> 26 </RuleParameters>
43 </WebTestPlugin> 27 </WebTestPlugin>
44 </WebTestPlugins> 28 </WebTestPlugins>
......