private void writeNotCoveredReqs(LogMetrics lm) { Set <Pair <string, string> > NotCoveredReqs = Set <Pair <string, string> > .EmptySet; foreach (KeyValuePair <string, string> req in NModel.Conformance.ConformanceTester.AllRequirements) { NotCoveredReqs = NotCoveredReqs.Add(new Pair <string, string>(req.Key, req.Value)); } foreach (Pair <string, string> req in NotCoveredReqs) { if (NModel.Attributes.RequirementAttribute.AllRequirementsInModels.Contains(req)) { NotCoveredReqs = NotCoveredReqs.Remove(req); } } double coverage = ( (double)NModel.Attributes.RequirementAttribute.AllRequirementsInModels.Count / (double)NModel.Conformance.ConformanceTester.AllRequirements.Count ) * 100.00; string percentage = coverage.ToString("#0.0"); lm.AddLine(TextType.Header, percentage + "% requirements coverage by test suite"); lm.AddLine(TextType.HeaderOpenBlock, "Not covered requirements by test suite"); if (!NotCoveredReqs.IsEmpty) { foreach (Pair <string, string> req in NotCoveredReqs) { lm.AddLine(TextType.Indent1, req.First + " - " + req.Second); } } lm.AddCloseBlock(); }
private void writeNotExecutedReqs(LogMetrics lm) { Set <Pair <string, string> > NotExecutedReqs = Set <Pair <string, string> > .EmptySet; foreach (Pair <string, string> req in NModel.Attributes.RequirementAttribute.AllRequirementsInModels) { NotExecutedReqs = NotExecutedReqs.Add(req); } foreach (Pair <string, string> req in NotExecutedReqs) { if (totalExecutedRequirements.Keys.Contains(req)) { NotExecutedReqs = NotExecutedReqs.Remove(req); } } double coverage = ( (double)totalExecutedRequirements.Keys.Count / (double)NModel.Attributes.RequirementAttribute.AllRequirementsInModels.Count ) * 100.00; string percentage = coverage.ToString("#0.0"); lm.AddLine(TextType.Header, percentage + "% of the covered requirements have been executed"); lm.AddLine(TextType.HeaderOpenBlock, "Covered requirements that have not been executed"); if (!NotExecutedReqs.IsEmpty) { foreach (Pair <string, string> req in NotExecutedReqs) { lm.AddLine(TextType.Indent1, req.First + " - " + req.Second); } } lm.AddCloseBlock(); }
private void writeFailedActionsSummary(LogMetrics lm) { lm.AddLine(TextType.HeaderOpenBlock, "Failed Actions"); foreach (Pair <string, string> action in FailedActionsWithMessages.Keys) { lm.AddLine(TextType.Indent1, "(" + action.First + ", Reason: " + action.Second + "( " + FailedActionsWithMessages.CountItem(action) + (FailedActionsWithMessages.CountItem(action) > 1 ? " times ))" : " time ))")); } lm.AddCloseBlock(); }
private void writeTestsResultsSummary(LogMetrics lm) { lm.AddLine(TextType.HeaderOpenBlock, "General Summary"); double passRate = (((double)NModel.Conformance.ConformanceTester.totalExecutedTests - (double)NModel.Conformance.ConformanceTester.totalFailedTests) / (double)NModel.Conformance.ConformanceTester.totalExecutedTests ) * 100.00; string percentage = passRate.ToString("#0.0"); lm.AddLine(TextType.Indent1, NModel.Conformance.ConformanceTester.totalExecutedTests + " tests Executed"); lm.AddLine(TextType.Indent1, NModel.Conformance.ConformanceTester.totalFailedTests + " tests Failed"); lm.AddLine(TextType.Indent1, "Pass Rate: " + percentage + "%"); lm.AddCloseBlock(); }
private void writeActionsTimeSpent(LogMetrics lm) { if (!ConformanceTester.TotalExecutionTimePerAction.IsEmpty) { lm.AddLine(TextType.HeaderOpenBlock, "Toatal time spent in each action"); foreach (string action in ConformanceTester.TotalExecutionTimePerAction.Keys) { TimeSpan average = new TimeSpan(0, 0, 0, 0, ((int)ConformanceTester.TotalExecutionTimePerAction[action].TotalMilliseconds / ConformanceTester.ActionNumberOfExecutions.CountItem(action))); lm.AddLine(TextType.Indent1, action + "(Executed " + ConformanceTester.ActionNumberOfExecutions.CountItem(action) + (ConformanceTester.ActionNumberOfExecutions.CountItem(action) > 1 ? " times" : " time") + ", Average execution time: " + average.ToString() + ") : " + ConformanceTester.TotalExecutionTimePerAction[action]); } } lm.AddCloseBlock(); }
private void writeNotExecutedReqs(LogMetrics lm) { Set<Pair<string, string>> NotExecutedReqs = Set<Pair<string, string>>.EmptySet; foreach (Pair<string, string> req in NModel.Attributes.RequirementAttribute.AllRequirementsInModels) NotExecutedReqs = NotExecutedReqs.Add(req); foreach (Pair<string, string> req in NotExecutedReqs) { if (totalExecutedRequirements.Keys.Contains(req)) NotExecutedReqs = NotExecutedReqs.Remove(req); } double coverage = ( (double)totalExecutedRequirements.Keys.Count / (double)NModel.Attributes.RequirementAttribute.AllRequirementsInModels.Count ) * 100.00; string percentage = coverage.ToString("#0.0"); lm.AddLine(TextType.Header, percentage + "% of the covered requirements have been executed"); lm.AddLine(TextType.HeaderOpenBlock, "Covered requirements that have not been executed"); if (!NotExecutedReqs.IsEmpty) { foreach (Pair<string, string> req in NotExecutedReqs) lm.AddLine(TextType.Indent1, req.First + " - " + req.Second); } lm.AddCloseBlock(); }
private void writeNotCoveredReqs(LogMetrics lm) { Set<Pair<string, string>> NotCoveredReqs = Set<Pair<string, string>>.EmptySet; foreach (KeyValuePair<string, string> req in NModel.Conformance.ConformanceTester.AllRequirements) NotCoveredReqs = NotCoveredReqs.Add(new Pair<string, string>(req.Key, req.Value)); foreach (Pair<string, string> req in NotCoveredReqs) { if (NModel.Attributes.RequirementAttribute.AllRequirementsInModels.Contains(req)) NotCoveredReqs = NotCoveredReqs.Remove(req); } double coverage = ( (double)NModel.Attributes.RequirementAttribute.AllRequirementsInModels.Count / (double)NModel.Conformance.ConformanceTester.AllRequirements.Count ) * 100.00; string percentage = coverage.ToString("#0.0"); lm.AddLine(TextType.Header, percentage + "% requirements coverage by test suite"); lm.AddLine(TextType.HeaderOpenBlock, "Not covered requirements by test suite"); if (!NotCoveredReqs.IsEmpty) { foreach (Pair<string, string> req in NotCoveredReqs) lm.AddLine(TextType.Indent1, req.First + " - " + req.Second); } lm.AddCloseBlock(); }
private void writeFailedActionsSummary(LogMetrics lm) { lm.AddLine(TextType.HeaderOpenBlock, "Failed Actions"); foreach (Pair<string, string> action in FailedActionsWithMessages.Keys) { lm.AddLine(TextType.Indent1, "(" + action.First + ", Reason: " + action.Second + "( " + FailedActionsWithMessages.CountItem(action) + (FailedActionsWithMessages.CountItem(action) > 1 ? " times ))" : " time ))")); } lm.AddCloseBlock(); }