Commit 60f30298 60f3029879f5e8cb6d697300a0ab537a4fb998d5 by Mick Smith

Senaste version från LIL-GIT 2017-09-12. MICK

git-tfs-id: [https://tfs.rsv.se/tfs/LoadTestCollection]$/VSTT-Plugins;C1190
1 parent 61003c77
......@@ -18,10 +18,46 @@ using System.ComponentModel;
using Microsoft.VisualStudio.TestTools.WebTesting.Rules;
using System.Text.RegularExpressions;
using System.IO;
using System.IO.Compression;
using Microsoft.VisualStudio.TestTools.LoadTesting;
namespace LIL_VSTT_Plugins
{
[DisplayName("Zip File Upload"), Description("Creates an ZIP archive of each of the files to be uploaded using the files name and adding .zip. Warning, uses %TEMP% for temp storage.")]
public class ZipFileUploadBeforePost : WebTestRequestPlugin
{
Queue<String> deleteDirs = new Queue<string>();
public override void PreRequest(object sender, PreRequestEventArgs e)
{
if (e.Request.Body.GetType() == typeof(FormPostHttpBody)) {
FormPostHttpBody body = (FormPostHttpBody)e.Request.Body;
foreach (FormPostParameter param in body.FormPostParameters) {
if(param.GetType() == typeof(FileUploadParameter))
{
FileUploadParameter fparam = (FileUploadParameter)param;
String tempDir = Path.GetTempPath() + "\\" + Guid.NewGuid().ToString();
Directory.CreateDirectory(tempDir);
deleteDirs.Enqueue(tempDir);
Directory.CreateDirectory(tempDir + @"\ZipDir");
File.Copy(fparam.FileName, tempDir + @"\ZipDir\" + Path.GetFileName(fparam.FileName));
ZipFile.CreateFromDirectory(tempDir + @"\ZipDir", tempDir + "\\" + Path.GetFileName(fparam.FileName) + ".zip");
fparam.FileName = tempDir + "\\" + Path.GetFileName(fparam.FileName) + ".zip";
fparam.FileUploadName = fparam.FileUploadName + ".zip";
}
}
}
base.PreRequest(sender, e);
}
public override void PostRequest(object sender, PostRequestEventArgs e)
{
foreach (String dir in deleteDirs) Directory.Delete(dir, true);
deleteDirs.Clear();
base.PostRequest(sender, e);
}
}
[DisplayName("Set Request Think Time"), Description("Changes the thinktime on requests with a set thinktime over 0 to the value of the ThinkTime context parameter")]
public class SetRequestThinkTime : WebTestPlugin
{
......@@ -208,6 +244,9 @@ namespace LIL_VSTT_Plugins
[DisplayName("File Name"), Description("The file name to use for logging")]
public String Filename { get; set; }
[DisplayName("Autogenerate File Name"), Description("Automatically generate a filename using the test name and user id from the load test")]
public bool autoFilename { get; set; }
[DisplayName("Write header"), DefaultValue(false), Description("Writes the parameter names as a header. Will write a new header for each user (dont use in loadtest)")]
public bool useHeader { get; set; }
......@@ -221,6 +260,11 @@ namespace LIL_VSTT_Plugins
public override void PostWebTest(object sender, PostWebTestEventArgs e)
{
String completeFileName = Filename + e.WebTest.Context.WebTestUserId + ".log";
if (autoFilename)
{
completeFileName = e.WebTest.Name + e.WebTest.Context.WebTestUserId + ".log";
}
if ((e.WebTest.Outcome == Outcome.Pass && logPassed) || (e.WebTest.Outcome == Outcome.Fail && logFailed)) {
string row = "";
string hrow = "";
......@@ -240,10 +284,10 @@ namespace LIL_VSTT_Plugins
}
if (header && useHeader)
{
File.AppendAllText(Filename + e.WebTest.Context.WebTestUserId + ".log", hrow + "\r\n");
File.AppendAllText(completeFileName, hrow + "\r\n");
header = false;
}
File.AppendAllText(Filename + e.WebTest.Context.WebTestUserId + ".log", row + "\r\n");
File.AppendAllText(completeFileName, row + "\r\n");
base.PostWebTest(sender, e);
}
}
......
......@@ -13,6 +13,10 @@
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
......@@ -41,6 +45,8 @@
<Reference Include="Microsoft.VisualStudio.QualityTools.WebTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
......
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = ""
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}
......@@ -51,6 +51,31 @@ namespace LIL_VSTT_Plugins
}
}
/// <summary>
/// LoadTest Context Copy
/// </summary>
[DisplayName("Personnummer Generator")]
[Description("(C) Copyright 2017 LIGHTS IN LINE AB\r\nGenererar personnummer och sätter dem som parameter till testernas context.")]
public class LoadTestPnumGen : ILoadTestPlugin
{
//store the load test object.
LoadTest mLoadTest;
public void Initialize(LoadTest loadTest)
{
mLoadTest = loadTest;
//connect to the TestStarting event.
mLoadTest.TestStarting += new EventHandler<TestStartingEventArgs>(mLoadTest_TestStarting);
}
void mLoadTest_TestStarting(object sender, TestStartingEventArgs e)
{
//TODO
}
}
/// <summary>
/// Service Manager Plugin
/// </summary>
......@@ -457,6 +482,7 @@ namespace LIL_VSTT_Plugins
string input = null;
int lineNum = 0;
int dataNum = 0;
char[] trim = { ' ', '\x00', '\t', '\x20' };
while ((input = re.ReadLine()) != null)
{
// Ignore blank lines and empty lines (just whitespace) or lines with only blank/empty/whitespace columns
......@@ -466,7 +492,7 @@ namespace LIL_VSTT_Plugins
if (lineNum == 1 && myHasColName == true)
{
// First line is column names
myColNames = input.TrimEnd();
myColNames = input.TrimEnd(trim);
}
else
{
......@@ -477,13 +503,13 @@ namespace LIL_VSTT_Plugins
else ifAgentId = dataNum + 1;
if (ifAgentId == agentId)
{
myParams.Add(input.TrimEnd());
myParams.Add(input.TrimEnd(trim));
}
dataNum++;
}
else
{
myParams.Add(input.TrimEnd());
myParams.Add(input.TrimEnd(trim));
}
}
}
......
......@@ -20,6 +20,7 @@ using System.IO;
using System.ComponentModel;
using System.Text.RegularExpressions;
using System.Security.Cryptography.X509Certificates;
using System.Diagnostics;
namespace LIL_VSTT_Plugins
{
......@@ -233,6 +234,54 @@ namespace LIL_VSTT_Plugins
}
/// <summary>
/// Slå på URL encode på query string parametrar
/// </summary>
[DisplayName("URL Encode Query String Parameter")]
[Description("(C) Copyright 2011 LIGHTS IN LINE AB\r\nTvingar en URL Encode på angiven Query String parameter i alla request")]
public class URLEncodeQueryStringParameter : WebTestPlugin
{
[DisplayName("Query String Parameter Name")]
[Description("Name of the query string parameter to URL encode before each request")]
public String paramName { get; set; }
public override void PreRequest(object sender, PreRequestEventArgs e)
{
if (e.Request.HasQueryStringParameters)
{
if (e.Request.QueryStringParameters.Contains(paramName))
{
foreach (QueryStringParameter qsp in e.Request.QueryStringParameters) {
if (qsp.Name.Equals(paramName))
{
qsp.UrlEncode = true;
}
}
}
}
}
}
/// <summary>
/// Loggar alla transaktioners svarstider som context parametrar
/// </summary>
[DisplayName("Transaction Response Times to Context")]
[Description("(C) Copyright 2016 LIGHTS IN LINE AB\r\nLoggar alla transaktioners svarstider som context parametrar")]
public class TransactionsToContext : WebTestPlugin
{
public override void PostTransaction(object sender, PostTransactionEventArgs e)
{
base.PostTransaction(sender, e);
if (!e.WebTest.Context.ContainsKey(e.TransactionName))
{
e.WebTest.Context.Add(e.TransactionName, e.Duration.TotalMilliseconds.ToString());
}
else
{
e.WebTest.Context[e.TransactionName] = e.Duration.TotalMilliseconds.ToString();
}
}
}
/// <summary>
/// Ignorerar status koder under 500.
/// </summary>
[DisplayName("Ignore 4xx status codes")]
......@@ -306,16 +355,70 @@ namespace LIL_VSTT_Plugins
[Description("Default inte påslaget. Om servern inte stödjer TLS1.2 kommer SSL handskakningen att avbrytas och requestet failar. Kräver .NET 4.5 samt att TLS1.2 är aktiverat i SChannel (använd bifogad schannel_high.reg om det inte är påslaget på äldre windows versioner)")]
public bool useTls12 { get; set; }
[DisplayName("Apply Override"), DefaultValue(false)]
[Description("Ändrar proxy inställningarna för detta webtest enligt detta plugin")]
[Category("Web Proxy")]
public bool proxyOverride { get; set; }
[DisplayName("Proxy URI"), DefaultValue("http://host:port")]
[Description("Anger proxyserverns URI (http://host:port)")]
[Category("Web Proxy")]
public string proxyURI { get; set; }
[DisplayName("Bypass Local"), DefaultValue(false)]
[Description("True för att inte använda proxy på lokala hostnamn, i.e. utan domännamn")]
[Category("Web Proxy")]
public bool proxyBypassLocal { get; set; }
[DisplayName("Bypass RegExp"), DefaultValue("")]
[Description("Sätter ett reguljärt uttryck för URI (hostnamn) som INTE ska gå via proxyn")]
[Category("Web Proxy")]
public string proxyBypass { get; set; }
[DisplayName("User Name"), DefaultValue("")]
[Description("Sätter användarnamn för proxyn")]
[Category("Web Proxy")]
public string proxyUser { get; set; }
[DisplayName("User Password"), DefaultValue("")]
[Description("Sätter swedbanks proxy (temp lösning)")]
[Category("Web Proxy")]
public string proxyPass { get; set; }
System.Net.WebProxy myProxy = null;
public override void PreWebTest(object sender, PreWebTestEventArgs e)
{
base.PreWebTest(sender, e);
if (proxyOverride)
{
if (myProxy == null)
{
myProxy = new System.Net.WebProxy();
if(!String.IsNullOrWhiteSpace(proxyURI)) myProxy.Address = new Uri(proxyURI);
myProxy.BypassProxyOnLocal = proxyBypassLocal;
if (!String.IsNullOrWhiteSpace(proxyBypass)) myProxy.BypassList = new string[] { proxyBypass };
if (!String.IsNullOrWhiteSpace(proxyUser)) myProxy.Credentials = new System.Net.NetworkCredential(proxyUser, proxyPass);
}
// Change the webtests proxy setting
e.WebTest.Proxy = "lil";
e.WebTest.WebProxy = myProxy;
// Set context parameters
e.WebTest.Context["proxyOverride"] = proxyOverride;
e.WebTest.Context["proxyURI"] = proxyURI;
e.WebTest.Context["proxyBypassLocal"] = proxyBypassLocal;
e.WebTest.Context["proxyBypass"] = proxyBypass;
e.WebTest.Context["proxyUser"] = proxyUser;
e.WebTest.Context["proxyPass"] = proxyPass;
}
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;
}
}
/// <summary>
......@@ -558,21 +661,21 @@ namespace LIL_VSTT_Plugins
/// WebTest Client Certificate
/// </summary>
[DisplayName("Client Certificate")]
[Description("(C) Copyright 2016 LIGHTS IN LINE AB\r\nSätter webtestet att använda ett specifikt client cert för SSL. Certifikatet behöver inte installeras i certstore först.")]
[Description("(C) Copyright 2016 LIGHTS IN LINE AB\r\nSätter webtestet att använda ett specifikt client cert för SSL. Certifikatet installeras automatiskt i Windows User Certificate Store.")]
public class ClientCertificatePlugin : WebTestPlugin
{
[DisplayName("Certificate Path")]
[Description("Sökvägen till certifikatfilen (.P12/.PFX/.PEM med privat nyckel)")]
[Description("Sökvägen till certifikatfilen (P12/PFX/PEM med privat nyckel eller CER/DER utan privat nyckel)")]
[DefaultValue("")]
public string pCertificatePath { get; set; }
[DisplayName("Certificate Path Parameter")]
[Description("Ange namn på parameter som ska användas för sökvägen till certifikatfilen (.P12/.PFX/.PEM). Om parametern saknas eller är tom används Certificate Path")]
[Description("Ange namn på parameter som ska användas för sökvägen till certifikatfilen. Om parametern saknas eller är tom används Certificate Path")]
[DefaultValue("")]
public string pCertificatePathParameter { get; set; }
[DisplayName("Certificate Password")]
[Description("Ange lösenordet för att öppna certifikatfilen")]
[Description("Ange lösenordet för att öppna skyddade/krypterade filer")]
[DefaultValue("")]
public string pCertificatePassword { get; set; }
......@@ -598,19 +701,25 @@ namespace LIL_VSTT_Plugins
private bool haveCert = false;
private X509Certificate2 myClientCertAndKey;
private Regex p12RegExp = new Regex(@"p12$|pfx$",RegexOptions.IgnoreCase);
private Regex cerRegExp = new Regex(@"cer$|der$", RegexOptions.IgnoreCase);
private Regex pemRegExp = new Regex(@"pem$", RegexOptions.IgnoreCase);
public override void PreWebTest(object sender, PreWebTestEventArgs e)
{
Stopwatch sw = new Stopwatch();
sw.Start();
base.PreWebTest(sender, e);
String certPath, certPass;
// Ladda in certifikatet och sätt CertPolicy
if (!String.IsNullOrWhiteSpace(pCertificatePathParameter) && e.WebTest.Context.ContainsKey(pCertificatePathParameter) && !String.IsNullOrWhiteSpace(e.WebTest.Context[pCertificatePathParameter].ToString()) )
{
certPath = e.WebTest.Context[pCertificatePathParameter].ToString();
certPath = e.WebTest.Context[pCertificatePathParameter].ToString().Trim();
} else
{
certPath = pCertificatePath;
certPath = pCertificatePath.Trim();
}
if (!String.IsNullOrWhiteSpace(pCertificatePasswordParameter) && e.WebTest.Context.ContainsKey(pCertificatePasswordParameter) && !String.IsNullOrWhiteSpace(e.WebTest.Context[pCertificatePasswordParameter].ToString()))
......@@ -629,11 +738,11 @@ namespace LIL_VSTT_Plugins
return;
}
// Check what type of container we have. All files are treated as PEM unless the extension is .pfx or .p12
// Check what type of container we have. All files are treated as PEM unless the extension matches our winX509regExp regular expression (see above)
// Read certificate and private key depending on type
if (certPath.ToLower().EndsWith(".pfx") || certPath.ToLower().EndsWith(".p12"))
if (p12RegExp.IsMatch(certPath))
{
if (pDebug) e.WebTest.AddCommentToResult("Certificate file is treated as PFX/PKCS12");
if (pDebug) e.WebTest.AddCommentToResult("Certificate file is treated as PFX/P12");
try
{
myClientCertAndKey = new X509Certificate2(certPath, certPass, X509KeyStorageFlags.PersistKeySet);
......@@ -643,9 +752,21 @@ namespace LIL_VSTT_Plugins
e.WebTest.AddCommentToResult("Error during loading of certificate: " + certPath + " Message: " + ex.Message);
return;
}
} else
} else if (cerRegExp.IsMatch(certPath))
{
if (pDebug) e.WebTest.AddCommentToResult("Certificate file is treated as CER/DER without private key");
try
{
myClientCertAndKey = new X509Certificate2(certPath, certPass);
}
catch (Exception ex)
{
e.WebTest.AddCommentToResult("Error during loading of certificate: " + certPath + " Message: " + ex.Message);
return;
}
} else if (pemRegExp.IsMatch(certPath))
{
if (pDebug) e.WebTest.AddCommentToResult("Certificate file is treated as PEM/PKCS8");
if (pDebug) e.WebTest.AddCommentToResult("Certificate file is treated as OpenSSL encoded PEM");
// Use Bouncy Castle to read the certificate and key, then convert to .NET X509Certificate2 and X509Certificate
String text;
......@@ -698,19 +819,24 @@ namespace LIL_VSTT_Plugins
}
keyTextBeginPos = text.IndexOf("-----BEGIN", keyTextEndPos);
}
if (bcKey == null || bcCert == null)
if (bcCert == null)
{
e.WebTest.AddCommentToResult("Error: PEM file has to contain both certificate and private key");
e.WebTest.AddCommentToResult("Error: PEM file has to contain an x509 certificate");
return;
}
try {
myClientCertAndKey = new X509Certificate2(Org.BouncyCastle.Security.DotNetUtilities.ToX509Certificate(bcCert));
myClientCertAndKey.PrivateKey = Org.BouncyCastle.Security.DotNetUtilities.ToRSA(bcKey.Private as Org.BouncyCastle.Crypto.Parameters.RsaPrivateCrtKeyParameters);
if(bcKey != null) myClientCertAndKey.PrivateKey = Org.BouncyCastle.Security.DotNetUtilities.ToRSA(bcKey.Private as Org.BouncyCastle.Crypto.Parameters.RsaPrivateCrtKeyParameters);
} catch (Exception ex)
{
e.WebTest.AddCommentToResult("Error during loading of PEM file: " + certPath + " Message: " + ex.Message);
return;
}
} else
{
// Unknown or unsuported format
e.WebTest.AddCommentToResult("Error during loading of file: " + certPath + " Message: Unsupported format");
return;
}
// Check that we have a certificate
......@@ -721,16 +847,17 @@ namespace LIL_VSTT_Plugins
}
else
{
if (pDebug) e.WebTest.AddCommentToResult("Certificate File " + certPath + " loaded successfully.");
if (pDebug) e.WebTest.AddCommentToResult("Certificate File " + certPath + " loaded successfully in " + sw.ElapsedMilliseconds + "ms");
}
// Check that it seems okey
if (string.IsNullOrWhiteSpace(myClientCertAndKey.GetCertHashString()))
if (string.IsNullOrWhiteSpace(myClientCertAndKey.Thumbprint))
{
if (pDebug) e.WebTest.AddCommentToResult("Certificate File " + certPath + " contains no SHA1 hash. Not using it.");
if (pDebug) e.WebTest.AddCommentToResult("Certificate File " + certPath + " contains no Thumbprint. Not using it.");
return;
}
if (pDebug) e.WebTest.AddCommentToResult("Loaded client certificate for Subject: [" + myClientCertAndKey.Subject + "] Issued by: [" + myClientCertAndKey.Issuer + "] Expires: [" + myClientCertAndKey.GetExpirationDateString() + "]");
if (pDebug) e.WebTest.AddCommentToResult("Subject: [" + myClientCertAndKey.Subject + "]");
if (pDebug) e.WebTest.AddCommentToResult("Issued by: [" + myClientCertAndKey.Issuer + "] Expires: [" + myClientCertAndKey.GetExpirationDateString() + "]");
// Check if the certificate is trusted (i.e. chain can be validated)
bool myCertTrusted = false;
......@@ -747,24 +874,19 @@ namespace LIL_VSTT_Plugins
// Check if it is expired or about to expire
if(myClientCertAndKey.NotAfter < DateTime.Now)
{
e.WebTest.AddCommentToResult("Warning: Client Certificate has expired. Might not be trusted on server. Expired " + myClientCertAndKey.NotAfter.ToString());
e.WebTest.AddCommentToResult("Warning: Client Certificate has expired. Might not be trusted on server.");
} else if (myClientCertAndKey.NotBefore > DateTime.Now)
{
e.WebTest.AddCommentToResult("Warning: Client Certificate is not valid yet. Might not be trusted on server. Valid " + myClientCertAndKey.NotBefore.ToString());
e.WebTest.AddCommentToResult("Warning: Client Certificate is not valid yet. Might not be trusted on server. Valid on " + myClientCertAndKey.NotBefore.ToString());
} else if (myClientCertAndKey.NotAfter < DateTime.Now.AddDays(14))
{
e.WebTest.AddCommentToResult("Warning: Client Certificate will expire in less than 14 days. Better renew it soon. Expires " + myClientCertAndKey.NotAfter.ToString());
e.WebTest.AddCommentToResult("Warning: Client Certificate will expire in less than 14 days. Better renew it soon.");
}
// Check if we have a private key
if (!myClientCertAndKey.HasPrivateKey)
if (myClientCertAndKey.HasPrivateKey)
{
// Cant use it without private key
e.WebTest.AddCommentToResult("Error: Certificate HAS NO PRIVATE KEY, cannot use it without one.");
return;
} else
{
if (pDebug) e.WebTest.AddCommentToResult("Certificate HAS PRIVATE KEY");
if (pDebug) e.WebTest.AddCommentToResult("Certificate HAS PRIVATE KEY in file");
}
// Check that the certificate exists in the cert store
......@@ -772,31 +894,69 @@ namespace LIL_VSTT_Plugins
cuStore.Open(OpenFlags.ReadWrite);
if(cuStore.Certificates.Contains(myClientCertAndKey)) {
if (pDebug) e.WebTest.AddCommentToResult("Certificate already INSTALLED in Current User Windows Certificate Store");
// Try to load the key from store if we dont have it and verify that it belongs to the certificate
if(!myClientCertAndKey.HasPrivateKey)
{
X509Certificate2Collection certCol = cuStore.Certificates.Find(X509FindType.FindByThumbprint, myClientCertAndKey.Thumbprint, false);
if(certCol == null || certCol.Count == 0)
{
e.WebTest.AddCommentToResult("Error: Certificate could not be loaded from store using it's thumbprint which is very strange. Aborting");
return;
} else
{
if(certCol.Count > 1)
{
if (pDebug) e.WebTest.AddCommentToResult("Certificates thumbprint has more than one match in the Windows User Certificate Store, using the first one.");
}
X509Certificate2 cert = certCol[0];
if (!cert.HasPrivateKey)
{
e.WebTest.AddCommentToResult("Error: Certificate does not have a corresponding private key in the Windows User Certificate Store. Can not use it for SSL.");
return;
} else
{
if (pDebug) e.WebTest.AddCommentToResult("Certificate was found in Windows User Certificate Store using thumbprint and HAS a corresponding PRIVATE KEY");
}
}
}
} else
{
if (pDebug) e.WebTest.AddCommentToResult("Certificate is NOT INSTALLED");
if(pInstallTrusted && myCertTrusted || pInstallUntrusted)
if (myClientCertAndKey.HasPrivateKey)
{
// Try to install certificate
if (myCertTrusted || !myCertTrusted)
if (pInstallTrusted && myCertTrusted || pInstallUntrusted)
{
// Try to install certificate
// Install in user store
try {
try
{
myClientCertAndKey.FriendlyName = "VSTT";
cuStore.Add(myClientCertAndKey);
if (pDebug) e.WebTest.AddCommentToResult("Certificate HAS BEEN INSTALLED in the Current User Windows Certificate Store with Friendly Name: VSTT");
} catch (Exception ex)
}
catch (Exception ex)
{
e.WebTest.AddCommentToResult("Error: COULD NOT INSTALL in the Current User Windows Certificate Store, Message: " + ex.Message);
return;
}
}
else
{
e.WebTest.AddCommentToResult("Error: COULD NOT INSTALL the certificate since you selected NOT to install untrusted certificates.");
return;
}
} else
{
e.WebTest.AddCommentToResult("Error: COULD NOT INSTALL the certificate since the file did not contain a private key and cannot be used without one.");
return;
}
}
// Set the PreRequest method to add the certificate on requests
haveCert = true;
if (pDebug) e.WebTest.AddCommentToResult("Certificate will be ADDED TO REQUESTS");
sw.Stop();
if (pDebug) e.WebTest.AddCommentToResult("Certificate processing done in " + sw.ElapsedMilliseconds + "ms");
}
public override void PreRequest(object sender, PreRequestEventArgs e)
......@@ -811,7 +971,7 @@ namespace LIL_VSTT_Plugins
e.WebTest.Context["Client Certificate"] = myClientCertAndKey.Subject;
} else
{
e.WebTest.Context["Client Certificate"] = "No certificate was added";
e.WebTest.Context["Client Certificate"] = "No certificate was specified in this request. Windows will try to automatically choose an installed client certificate if requested by the server.";
}
}
}
......