/// <summary> /// Creates a section for a given test case /// </summary> /// <param name="runner">The runner to be used to execute the tests</param> /// <param name="aFrame">Frame to be displayed</param> /// <param name="aReportConfig">The report configuration containing display details</param> /// <param name="activatedRuleConditions">The list that will contain the rules activated by this test case</param> /// <returns></returns> public void CreateTestCaseSection(DataDictionary.Tests.Runner.Runner runner, TestCase aTestCase, TestsCoverageReportHandler aReportConfig, HashSet<RuleCondition> activatedRuleConditions, bool createPdf) { AddSubParagraph("Test case " + aTestCase.Name); if (aTestCase.Requirements.Count > 0) { AddParagraph("This test case verifies the following requirements"); foreach (DataDictionary.ReqRef reqRef in aTestCase.Requirements) { string text = "Requirement " + reqRef.Name; if (!Utils.Utils.isEmpty(reqRef.Comment)) { text = text + " : " + reqRef.Comment; } AddListItem(text); } } runner.RunUntilStep(null); activatedRuleConditions.UnionWith(runner.EventTimeLine.GetActivatedRules()); string title = "Test case " + aTestCase.Name; CreateTable(title, runner.EventTimeLine.GetActivatedRules(), aReportConfig.Dictionary.ImplementedRules, aReportConfig.AddActivatedRulesInTestCases, aReportConfig.AddNonCoveredRulesInTestCases); if (createPdf && aReportConfig.AddSteps) { foreach (Step step in aTestCase.Steps) { if (step.SubSteps.Count > 0) { AddSubParagraph(String.Format("Step {0}", step.Name)); DataDictionary.Tests.SubStep firstSubStep = step.SubSteps[0] as DataDictionary.Tests.SubStep; DataDictionary.Tests.SubStep lastSubStep = step.SubSteps[step.SubSteps.Count - 1] as DataDictionary.Tests.SubStep; double start = runner.EventTimeLine.GetSubStepActivationTime(firstSubStep); double end = runner.EventTimeLine.GetNextSubStepActivationTime(lastSubStep); List<RuleCondition> activatedRules = runner.EventTimeLine.GetActivatedRulesInRange(start, end); CreateStepTable(runner, step, aTestCase.Dictionary.ImplementedRules.Count, activatedRules, aReportConfig); if (aReportConfig.AddLog) { List<DataDictionary.Tests.Runner.Events.ModelEvent> events = runner.EventTimeLine.GetEventsInRange((uint)start, (uint)end); foreach (ModelEvent ev in events) { AddCode(ev.ToString()); } } CloseSubParagraph(); } } } CloseSubParagraph(); }