public NewTestResultSummaryEventArgs(ITest test, ITestResult result, ITestOutcomeFilter outcomeFilter, ITestResultSummary summary) { Test = test; Result = result; OutcomeFilter = outcomeFilter; Summary = summary; }
/// <summary> /// Gets a summary for this result based on the supplied outcome filter /// </summary> public ITestResultSummary GetSummary(ITestOutcomeFilter outcomeFilter) { var summary = new TestResultSummary(this, outcomeFilter); // notify others that a new test summary is available OnNewTestResultSummary(this, new NewTestResultSummaryEventArgs(Test, this, outcomeFilter, summary)); return(summary); }
/// <summary> /// Gets a summary for this result based on the supplied outcome filter /// </summary> public ITestResultSummary GetSummary(ITestOutcomeFilter outcomeFilter) { var summary = new TestResultSummary(this, outcomeFilter); // notify others that a new test summary is available OnNewTestResultSummary(this, new NewTestResultSummaryEventArgs(Test, this, outcomeFilter, summary)); return summary; }
internal TestResultSummary(TestResult testResult, ITestOutcomeFilter outcomeFilter) { TestResult = testResult; Successes = TestResult.Outcomes.Count(o => o.Exception == null); Failures = TestResult.Outcomes.Count() - Successes; var eligibleOutcomes = outcomeFilter.Filter(TestResult.Outcomes); if (eligibleOutcomes.Any()) { AverageExecutionTime = eligibleOutcomes.Average(o => o.Elapsed.TotalMilliseconds); } }
internal TestResultSummary(TestResult testResult, ITestOutcomeFilter outcomeFilter) { TestResult = testResult; Successes = TestResult.Outcomes.Count(o => o.Exception == null); Failures = TestResult.Outcomes.Count() - Successes; var eligibleOutcomes = outcomeFilter.Filter(TestResult.Outcomes); if (eligibleOutcomes.Any()) { AverageExecutionTime = eligibleOutcomes.Average(o => o.Elapsed.TotalMilliseconds); MinExecutionTime = eligibleOutcomes.Min(o => o.Elapsed.TotalMilliseconds); MaxExecutionTime = eligibleOutcomes.Max(o => o.Elapsed.TotalMilliseconds); var sum = eligibleOutcomes.Sum(x => (x.Elapsed.TotalMilliseconds - AverageExecutionTime) * (x.Elapsed.TotalMilliseconds - AverageExecutionTime)); StandardDeviation = Math.Sqrt(sum / eligibleOutcomes.Count()); TotalExecutionTime = eligibleOutcomes.Sum(o => o.Elapsed.TotalMilliseconds); } }
/// <summary> /// Plans and executes a test against the specified data for a number of times and returns the test result summary using the /// specified outcome filter /// </summary> public ITestResultSummary PlanAndExecute <T>(string actionName, Action <T> action, T data, int count, ITestOutcomeFilter outcomeFilter) { var test = Plan(actionName, action, data, count); return(GetTestSummary(test, outcomeFilter)); }
/// <summary> /// Overload which uses the specified outcome filter to generate the summary /// </summary> private static ITestResultSummary GetTestSummary(ITest test, ITestOutcomeFilter outcomeFilter) { return(test.GetResult().GetSummary(outcomeFilter)); }