public void RecordHammer(HammerOptions hammerOptions, HammerStats hammerStats) { var properties = new Dictionary <string, string> { { "Url", hammerOptions.Url }, { "MaximumConcurrentRequests", hammerOptions.MaximumConcurrentRequests.ToString() }, { "MaximumMillisecondsToHammer", hammerOptions.MaximumMillisecondsToHammer.ToString() }, { "QueryStringParameters", CombineQueryStringParameters(hammerOptions.QueryStringParameters) } }; foreach (var hammerSwingResult in hammerStats.HammerSwingStats) { var metrics = new Dictionary <string, double> { { "FailureCount", hammerSwingResult.FailureCount }, { "ConnectionCount", hammerSwingResult.TotalRequestCount }, { "AverageResponseTime", (double)hammerSwingResult.AverageResponseTime } }; _telemetryClient.TrackEvent("Hammer", properties, metrics); } _telemetryClient.Flush(); System.Threading.Thread.Sleep(5000); }
private void HammerUrl(HammerOptions hammerOptions) { var hammer = new Hammer(); var hammerStats = hammer.HammerUrl(hammerOptions); var aggregatedResults = hammerStats.HammerSwingStats.SelectMany(s => s.RequestResults).ToList(); _scenarioContext.Set(hammerStats, "HammerStats"); _scenarioContext.Set(aggregatedResults.Average(a => a.ResponseMilliseconds), "AverageResponseTime"); _scenarioContext.Set(aggregatedResults.Count(c => !c.IsSuccessful), "FailureCount"); }
public void WhenIHammerUpToConcurrentRequestsForAMaximumOfMilliseconds(string url, int maximumConcurrentRequests, int maximumMillisecondsToHammer) { var hammerOptions = new HammerOptions { Url = url, MaximumConcurrentRequests = maximumConcurrentRequests, MaximumMillisecondsToHammer = maximumMillisecondsToHammer, RequestHeaders = AddRequestHeaders(), Recorder = GetRecorder(), PreHammerProcesses = GetPreHammerProcesses() }; HammerUrl(hammerOptions); }
public void WhenIHammerWithUpToConcurrentRequestsForAMaximumOfMilliseconds(string url, int maximumConcurrentRequests, RequestMethod requestMethod, int maximumMillisecondsToHammer, Table table) { var hammerOptions = new HammerOptions { Url = url, RequestMethod = requestMethod, BodyType = BodyType.Json, Body = table.CreateDynamicInstance(), MaximumConcurrentRequests = maximumConcurrentRequests, MaximumMillisecondsToHammer = maximumMillisecondsToHammer, RequestHeaders = AddRequestHeaders(), Recorder = GetRecorder(), PreHammerProcesses = GetPreHammerProcesses() }; HammerUrl(hammerOptions); }
public void WhenIHammerWithUpToConcurrentRequestsForAMaximumOfMillisecondsWithQueryParameters(string url, int concurrentRequestCount, int maximumMillisecondsToHammer, Table table) { var queryStringParameters = new Dictionary <string, string>(); foreach (var tableRow in table.Rows) { queryStringParameters.Add(tableRow["Key"], tableRow["Value"]); } var hammerOptions = new HammerOptions { Url = url, MaximumConcurrentRequests = concurrentRequestCount, MaximumMillisecondsToHammer = maximumMillisecondsToHammer, RequestHeaders = AddRequestHeaders(), QueryStringParameters = queryStringParameters, Recorder = GetRecorder(), PreHammerProcesses = GetPreHammerProcesses() }; HammerUrl(hammerOptions); }
public void RecordHammer(HammerOptions hammerOptions, HammerStats hammerStats) { }