/// <summary> /// Initializes a new instance of the <see cref="RunStatisticsUpdatedEventArgs"/> class. /// </summary> /// <param name="statistics">The statistics.</param> public RunStatisticsUpdatedEventArgs(RunStatistics statistics) { ExceptionUtilities.CheckArgumentNotNull(statistics, "statistics"); this.Failures = statistics.Failures; this.Passed = statistics.Passed; this.Skipped = statistics.Skipped; this.Timeouts = statistics.Timeouts; this.Warnings = statistics.Warnings; }
/// <summary> /// Initializes a new instance of the <see cref="RunStatisticsUpdatedEventArgs"/> class. /// </summary> /// <param name="statistics">The statistics.</param> public RunStatisticsUpdatedEventArgs(RunStatistics statistics) { ExceptionUtilities.CheckArgumentNotNull(statistics, "statistics"); this.Failures = statistics.Failures; this.Passed = statistics.Passed; this.Skipped = statistics.Skipped; this.Timeouts = statistics.Timeouts; this.Warnings = statistics.Warnings; }
/// <summary> /// Runs the specified module. /// </summary> /// <param name="testModuleData">Data about the test module to run.</param> /// <param name="logWriter">The log writer.</param> /// <param name="variationsToRun">The variations to run.</param> /// <param name="parameters">The parameters.</param> public void Run(TestModuleData testModuleData, ITestLogWriter logWriter, IEnumerable <TestItemData> variationsToRun, IDictionary <string, string> parameters) { ExceptionUtilities.CheckArgumentNotNull(testModuleData, "testModuleData"); ExceptionUtilities.CheckArgumentNotNull(logWriter, "logWriter"); if (parameters == null) { parameters = new Dictionary <string, string>(); } var testModule = (TestModule)Activator.CreateInstance(testModuleData.TestItemType); testModule.ExplorationSeed = testModuleData.ExplorationSeed; testModule.ExplorationKind = testModuleData.ExplorationKind; foreach (var param in parameters) { testModule.TestParameters[param.Key] = param.Value; } if (variationsToRun == null) { variationsToRun = testModuleData.GetAllChildrenRecursive().Where(c => c.IsVariation); } lock (this.lockObject) { var logger = new TestLogWriterLogger(logWriter); logger.OnWarning += this.OnWarning; testModule.Log = logger; this.executionThreadAborted = false; this.runCompleted = false; this.currentLogWriter = logWriter; this.scheduledVariations = variationsToRun.Distinct().ToDictionary <TestItemData, TestItemData>(iteration => iteration); this.completedItems.Clear(); this.statisticsByPriority.Clear(); this.globalStatistics = new RunStatistics(); this.currentLogWriter.BeginTestSuite(); this.executionThread = new Thread(this.ExecutionThreadStart) { IsBackground = true, }; this.executionThread.Start(); this.BeginExecution(testModule, testModuleData); } }
private void OutputCounts(RunStatistics statistics) { int variationsExecuted = statistics.Failures + statistics.Passed + statistics.Timeouts + statistics.Warnings; int successfulVariations = statistics.Passed + statistics.Warnings; double passRate = 0.0; if (variationsExecuted != 0) { passRate = Math.Round(100.0 * successfulVariations / variationsExecuted); } this.OutputSingleCount("Failures", statistics.Failures); this.OutputSingleCount("Warnings", statistics.Warnings); this.OutputSingleCount("Skipped", statistics.Skipped); this.OutputSingleCount("Passed", statistics.Passed); this.OutputSingleCount("Timeouts", statistics.Timeouts); this.writer.WriteAttributeString("Run", XmlConvert.ToString(variationsExecuted)); this.writer.WriteAttributeString("Percent", XmlConvert.ToString(passRate)); }
private void IncrementResultCounter(TestItemData testItemData, TestResult result) { int priority = testItemData.Metadata.Priority; RunStatistics statistics; if (!this.statisticsByPriority.TryGetValue(priority, out statistics)) { this.statisticsByPriority[priority] = statistics = new RunStatistics(); } switch (result) { case TestResult.Timeout: ++statistics.Timeouts; ++this.globalStatistics.Timeouts; break; case TestResult.Skipped: ++statistics.Skipped; ++this.globalStatistics.Skipped; break; case TestResult.Failed: ++statistics.Failures; ++this.globalStatistics.Failures; break; case TestResult.Passed: ++statistics.Passed; ++this.globalStatistics.Passed; break; case TestResult.Warning: ++statistics.Warnings; ++this.globalStatistics.Warnings; break; } }
/// <summary> /// Ends the test module. /// </summary> /// <param name="testModule">The test module.</param> /// <param name="result">The result.</param> /// <param name="exception">The exception.</param> /// <param name="statisticsByPriority">The statistics for the module, broken down by priority.</param> /// <param name="globalStatistics">The global statistics for the module.</param> public void EndTestModule(TestModuleData testModule, TestResult result, ExceptionDetails exception, IDictionary <int, RunStatistics> statisticsByPriority, RunStatistics globalStatistics) { this.ForAll(i => i.EndTestModule(testModule, result, exception, statisticsByPriority, globalStatistics)); }
/// <summary> /// Ends the test module. /// </summary> /// <param name="testModule">The test module.</param> /// <param name="result">The result.</param> /// <param name="exception">The exception.</param> /// <param name="statisticsByPriority">The statistics for the module, broken down by priority.</param> /// <param name="globalStatistics">The global statistics for the module.</param> public void EndTestModule(TestModuleData testModule, TestResult result, ExceptionDetails exception, IDictionary<int, RunStatistics> statisticsByPriority, RunStatistics globalStatistics) { this.ForAll(i => i.EndTestModule(testModule, result, exception, statisticsByPriority, globalStatistics)); }
/// <summary> /// Ends the test module. /// </summary> /// <param name="testModule">The test module.</param> /// <param name="result">The result.</param> /// <param name="exception">The exception.</param> /// <param name="statisticsByPriority">The statistics for the module, broken down by priority.</param> /// <param name="globalStatistics">The global statistics for the module.</param> public void EndTestModule(TestModuleData testModule, TestResult result, ExceptionDetails exception, IDictionary<int, RunStatistics> statisticsByPriority, RunStatistics globalStatistics) { }
/// <summary> /// Ends the test module. /// </summary> /// <param name="testModule">The test module.</param> /// <param name="result">The result.</param> /// <param name="exception">The exception.</param> /// <param name="statisticsByPriority">The statistics for the module, broken down by priority.</param> /// <param name="globalStatistics">The global statistics for the module.</param> public void EndTestModule(TestModuleData testModule, TestResult result, ExceptionDetails exception, IDictionary <int, RunStatistics> statisticsByPriority, RunStatistics globalStatistics) { TestModuleData currentTestModule = this.testItemStack.Pop() as TestModuleData; ExceptionUtilities.Assert(currentTestModule == testModule, "Invalid test module on stack."); this.WriteResult(result, exception); this.writer.WriteEndElement(); this.writer.WriteStartElement("Summary"); this.OutputCounts(globalStatistics); foreach (var kvp in statisticsByPriority.OrderBy(c => c.Key)) { this.writer.WriteStartElement("Property"); this.OutputCounts(kvp.Value); this.writer.WriteAttributeString("Name", "Pri"); this.writer.WriteAttributeString("Value", XmlConvert.ToString(kvp.Key)); this.writer.WriteEndElement(); } this.writer.WriteEndElement(); this.writer.Flush(); }
private void OutputCounts(RunStatistics statistics) { int variationsExecuted = statistics.Failures + statistics.Passed + statistics.Timeouts + statistics.Warnings; int successfulVariations = statistics.Passed + statistics.Warnings; double passRate = 0.0; if (variationsExecuted != 0) { passRate = Math.Round(100.0 * successfulVariations / variationsExecuted); } this.OutputSingleCount("Failures", statistics.Failures); this.OutputSingleCount("Warnings", statistics.Warnings); this.OutputSingleCount("Skipped", statistics.Skipped); this.OutputSingleCount("Passed", statistics.Passed); this.OutputSingleCount("Timeouts", statistics.Timeouts); this.writer.WriteAttributeString("Run", XmlConvert.ToString(variationsExecuted)); this.writer.WriteAttributeString("Percent", XmlConvert.ToString(passRate)); }
/// <summary> /// Ends the test module. /// </summary> /// <param name="testModule">The test module.</param> /// <param name="result">The result.</param> /// <param name="exception">The exception.</param> /// <param name="statisticsByPriority">The statistics for the module, broken down by priority.</param> /// <param name="globalStatistics">The global statistics for the module.</param> public void EndTestModule(TestModuleData testModule, TestResult result, ExceptionDetails exception, IDictionary<int, RunStatistics> statisticsByPriority, RunStatistics globalStatistics) { TestModuleData currentTestModule = this.testItemStack.Pop() as TestModuleData; ExceptionUtilities.Assert(currentTestModule == testModule, "Invalid test module on stack."); this.WriteResult(result, exception); this.writer.WriteEndElement(); this.writer.WriteStartElement("Summary"); this.OutputCounts(globalStatistics); foreach (var kvp in statisticsByPriority.OrderBy(c => c.Key)) { this.writer.WriteStartElement("Property"); this.OutputCounts(kvp.Value); this.writer.WriteAttributeString("Name", "Pri"); this.writer.WriteAttributeString("Value", XmlConvert.ToString(kvp.Key)); this.writer.WriteEndElement(); } this.writer.WriteEndElement(); this.writer.Flush(); }
/// <summary> /// Ends the test module. /// </summary> /// <param name="testModule">The test module.</param> /// <param name="result">The result.</param> /// <param name="exception">The exception.</param> /// <param name="statisticsByPriority">The statistics for the module, broken down by priority.</param> /// <param name="globalStatistics">The global statistics for the module.</param> public void EndTestModule(TestModuleData testModule, TestResult result, ExceptionDetails exception, IDictionary <int, RunStatistics> statisticsByPriority, RunStatistics globalStatistics) { }
/// <summary> /// Ends the test module. /// </summary> /// <param name="testModule">The test module.</param> /// <param name="result">The result.</param> /// <param name="exception">The exception.</param> /// <param name="statisticsByPriority">The statistics for the module, broken down by priority.</param> /// <param name="globalStatistics">The global statistics for the module.</param> public void EndTestModule(TestModuleData testModule, TestResult result, ExceptionDetails exception, IDictionary <int, RunStatistics> statisticsByPriority, RunStatistics globalStatistics) { this.WriteTestItemDataDurationResult(testModule); }
/// <summary> /// Ends the test module. /// </summary> /// <param name="testModule">The test module.</param> /// <param name="result">The result.</param> /// <param name="exception">The exception.</param> /// <param name="statisticsByPriority">The statistics for the module, broken down by priority.</param> /// <param name="globalStatistics">The global statistics for the module.</param> public void EndTestModule(TestModuleData testModule, TestResult result, ExceptionDetails exception, IDictionary<int, RunStatistics> statisticsByPriority, RunStatistics globalStatistics) { this.WriteTestItemDataDurationResult(testModule); }