/// <summary> /// Counts the issues and the blocking issues /// </summary> /// <param name="obj"></param> /// <param name="visitSubNodes"></param> public override void visit(Generated.ReferencesParagraph obj, bool visitSubNodes) { ReferencesParagraph referencesParagraph = obj as ReferencesParagraph; if (referencesParagraph != null) { foreach (ReqRef reqRef in referencesParagraph.Requirements) { IssueKind?kind = IssueKindUtil.GetKind(reqRef.Paragraph); if (kind != null) { Issues[(IssueKind)kind] += 1; if (kind == IssueKind.Blocking) { SubSequence enclosingSubSequence = EnclosingFinder <SubSequence> .find(referencesParagraph, true); if (enclosingSubSequence != null) { BlockingSubSequences.Add(enclosingSubSequence); } } } } } base.visit(obj, visitSubNodes); }
/// <summary> /// Executes the tests in the background thread /// </summary> public override void ExecuteWork() { if (Window != null) { SynchronizerList.SuspendSynchronization(); MarkingHistory.PerformMark(() => { SubSequence subSequence = TestCase.Enclosing as SubSequence; if (subSequence != null && TestCase.Steps.Count > 0) { Step step = null; bool found = false; foreach (TestCase current in subSequence.TestCases) { if (found && current.Steps.Count > 0) { step = (Step)current.Steps[0]; break; } found = (current == TestCase); } Runner runner = Window.GetRunner(subSequence); runner.RunUntilStep(step); } }); SynchronizerList.ResumeSynchronization(); } }
/// <summary> /// Creates a section for a given sub-sequence /// </summary> /// <param name="aSubSequence">A sub-sequence to be displayed</param> /// <param name="aReportConfig">The report configuration containing display details</param> /// <param name="activatedRules">The list that will contain the rules activated by this sub-sequence</param> /// <param name="createPdf">Indicates if the information about this sub-sequence has to be added to the pdf</param> public void CreateSubSequenceSection(SubSequence aSubSequence, TestsCoverageReportHandler aReportConfig, HashSet <RuleCondition> activatedRules, bool createPdf) { string title = "Sub sequence " + aSubSequence.Name; if (createPdf) { AddSubParagraph(title); } HashSet <RuleCondition> rules = new HashSet <RuleCondition>(); aSubSequence.EFSSystem.Runner = new Runner(aSubSequence, false, true); foreach (TestCase testCase in aSubSequence.TestCases) { // SIDE EFFECT: // each test case will calculate the list of rules it activates // and add them to activatedRules list CreateTestCaseSection(aSubSequence.EFSSystem.Runner, testCase, aReportConfig, rules, createPdf && aReportConfig.AddTestCases); } activatedRules.UnionWith(rules); // now we can create the table with the current sub sequence statistics if (createPdf) { CreateActivatedRulesSection(title, rules, aReportConfig.Dictionary.ImplementedRules, aReportConfig.AddActivatedRulesInSubSequences); CloseSubParagraph(); } }
/// <summary> /// Allows to refresh the view, when the selected model changed /// </summary> /// <param name="context"></param> /// <returns>true if refresh should be performed</returns> public override bool HandleSelectionChange(Context.SelectionContext context) { bool retVal = base.HandleSelectionChange(context); if (retVal) { SubSequence subSequence = DisplayedModel as SubSequence; if (subSequence != null) { testDescriptionTimeLineControl.SubSequence = subSequence; testDescriptionTimeLineControl.Refresh(); tabControl1.SelectedTab = testDescriptionTabPage; } TestCase testCase = DisplayedModel as TestCase; if (testCase != null) { testDescriptionTimeLineControl.TestCase = testCase; testDescriptionTimeLineControl.Refresh(); tabControl1.SelectedTab = testDescriptionTabPage; } } return(retVal); }
/// <summary> /// Updates an expression according to translation rules /// </summary> /// <param name="step">the step in which the expression occurs</param> /// <param name="expression"></param> /// <returns>the updated string</returns> private string ReviewExpression(Step step, string expression) { string retVal = expression; if (expression.IndexOf('%') >= 0) { SubSequence subSequence = step.TestCase.SubSequence; retVal = retVal.Replace("%D_LRBG", format_decimal_as_str(subSequence.getD_LRBG())); retVal = retVal.Replace("%Level", format_level(subSequence.getLevel())); retVal = retVal.Replace("%Mode", format_mode(subSequence.getMode())); retVal = retVal.Replace("%NID_LRBG", format_decimal_as_str(subSequence.getNID_LRBG())); retVal = retVal.Replace("%Q_DIRLRBG", format_decimal_as_str(subSequence.getQ_DIRLRBG())); retVal = retVal.Replace("%Q_DIRTRAIN", format_decimal_as_str(subSequence.getQ_DIRTRAIN())); retVal = retVal.Replace("%Q_DLRBG", format_decimal_as_str(subSequence.getQ_DLRBG())); retVal = retVal.Replace("%RBC_ID", format_decimal_as_str(subSequence.getRBC_ID())); retVal = retVal.Replace("%RBCPhone", format_str(subSequence.getRBCPhone())); retVal = retVal.Replace("%Step_Distance", step.getDistance() + ""); retVal = retVal.Replace("%Step_LevelIN", format_level(step.getLevelIN())); retVal = retVal.Replace("%Step_LevelOUT", format_level(step.getLevelOUT())); retVal = retVal.Replace("%Step_ModeIN", format_mode(step.getModeOUT())); retVal = retVal.Replace("%Step_ModeOUT", format_mode(step.getModeOUT())); for (int i = 0; i < step.StepMessages.Count; i++) { DBElements.DBMessage message = step.StepMessages[i] as DBElements.DBMessage; if (message != null) { retVal = retVal.Replace("%Step_Messages_" + i, format_message(message)); } } } return(retVal); }
/// <summary> /// Constructor /// </summary> /// <param name="subSequence"></param> /// <param name="explain"></param> /// <param name="ensureCompilation">Indicates that the runner should make sure that the system is compiled</param> /// <param name="checkForCompatibleChanges">Indicates that the runner should check that no variables are accessed twice during the same cycle</param> public Runner(SubSequence subSequence, bool explain, bool ensureCompilation, bool checkForCompatibleChanges = false) { EventTimeLine = new EventTimeLine(this); SubSequence = subSequence; CompletedSubStep = new HashSet <SubStep>(); EfsSystem.Instance.Runner = this; Explain = explain; CheckForCompatibleChanges = checkForCompatibleChanges; if (ensureCompilation) { // Compile everything EfsSystem.Instance.Compiler.Compile_Synchronous(EfsSystem.Instance.ShouldRebuild); EfsSystem.Instance.ShouldRebuild = false; } Setup(); PleaseWait = true; Expression expression = new Parser().Expression(subSequence.Dictionary, "Kernel.DateAndTime.CurrentTime"); TimeInModel = expression.GetVariable(new InterpretationContext()); Range range = TimeInModel.Type as Range; if (range == null || range.getPrecision() != acceptor.PrecisionEnum.aDoublePrecision) { TimeInModel = null; } }
/// <summary> /// Constructor: creates a report for the selected sub sequence /// </summary> /// <param name="aSubSequence"></param> public TestReport(SubSequence aSubSequence) { InitializeComponent(); _reportHandler = new TestsCoverageReportHandler(aSubSequence.Dictionary) {SubSequence = aSubSequence}; InitializeCheckBoxes(2); TxtB_Path.Text = _reportHandler.FileName; }
/// <summary> /// Sets the current sub sequence window parameters /// </summary> /// <param name="subSequence"></param> public void SetSubSequence(SubSequence subSequence) { Invoke((MethodInvoker) delegate { subSequenceSelectorComboBox.Text = subSequence.Name; SetFrame(subSequence.Frame); Refresh(); }); }
/// <summary> /// Constructor: creates a report for the selected sub sequence /// </summary> /// <param name="aSubSequence"></param> public TestReport(SubSequence aSubSequence) { InitializeComponent(); _reportHandler = new TestsCoverageReportHandler(aSubSequence.Dictionary) { SubSequence = aSubSequence }; InitializeCheckBoxes(2); TxtB_Path.Text = _reportHandler.FileName; }
private static string LcsUnConsecutiveUsingTable(string s1, int s1End, string s2, int s2End, ref Dictionary <SubSequence, string> calculated) { if (s1End < 0 || s2End < 0) { return(string.Empty); } if (s1[s1End] == s2[s2End]) { SubSequence sub = new SubSequence(s1End - 1, s2End - 1); if (calculated.ContainsKey(sub)) { //the sub problem is calculated string result = calculated[sub] + s1[s1End]; // add current problem to table calculated[new SubSequence(s1End, s2End)] = result; return(result); } else { //the sub problem is not calculated string result = LcsUnConsecutiveUsingTable(s1, s1End - 1, s2, s2End - 1, ref calculated); //add sub problem to the table calculated[sub] = result; result += s1[s1End]; //add current problem to the table calculated[new SubSequence(s1End, s2End)] = result; return(result); } } else { SubSequence sub1 = new SubSequence(s1End - 1, s2End); SubSequence sub2 = new SubSequence(s1End, s2End - 1); string t1 = calculated.ContainsKey(sub1) ? calculated[sub1] : LcsUnConsecutiveUsingTable(s1, s1End - 1, s2, s2End, ref calculated); string t2 = calculated.ContainsKey(sub2) ? calculated[sub2] : LcsUnConsecutiveUsingTable(s1, s1End, s2, s2End - 1, ref calculated); if (t1.Length > t2.Length) { calculated[sub1] = t1; calculated[new SubSequence(s1End, s2End)] = t1; return(t1); } else { calculated[sub2] = t2; calculated[new SubSequence(s1End, s2End)] = t2; return(t2); } } }
/// <summary> /// Selects the current test sequence by clicking on the label /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripLabel2_Click(object sender, EventArgs e) { if (EfsSystem.Runner != null) { SubSequence subSequence = EfsSystem.Runner.SubSequence; if (subSequence != null) { EfsSystem.Instance.Context.SelectElement(subSequence, this, Context.SelectionCriteria.DoubleClick); } } }
/// <summary> /// Updates an expression according to translation rules /// </summary> /// <param name="step">the step in which the expression occurs</param> /// <param name="expression"></param> /// <returns>the updated string</returns> private string ReviewExpression(Step step, string expression) { string retVal = expression; if (expression.IndexOf('%') >= 0) { SubSequence subSequence = step.TestCase.SubSequence; retVal = retVal.Replace("%D_LRBG", format_decimal_as_str(subSequence.getD_LRBG())); retVal = retVal.Replace("%Level", format_level(subSequence.getLevel())); retVal = retVal.Replace("%Mode", format_mode(subSequence.getMode())); retVal = retVal.Replace("%NID_LRBG", format_decimal_as_str(subSequence.getNID_LRBG())); retVal = retVal.Replace("%Q_DIRLRBG", format_decimal_as_str(subSequence.getQ_DIRLRBG())); retVal = retVal.Replace("%Q_DIRTRAIN", format_decimal_as_str(subSequence.getQ_DIRTRAIN())); retVal = retVal.Replace("%Q_DLRBG", format_decimal_as_str(subSequence.getQ_DLRBG())); retVal = retVal.Replace("%RBC_ID", format_decimal_as_str(subSequence.getRBC_ID())); retVal = retVal.Replace("%RBCPhone", format_str(subSequence.getRBCPhone())); retVal = retVal.Replace("%Step_Distance", step.getDistance() + ""); retVal = retVal.Replace("%Step_LevelIN", format_level(step.getLevelIN())); retVal = retVal.Replace("%Step_LevelOUT", format_level(step.getLevelOUT())); retVal = retVal.Replace("%Step_ModeIN", format_mode(step.getModeOUT())); retVal = retVal.Replace("%Step_ModeOUT", format_mode(step.getModeOUT())); int max_step_messages = 8; for (int i = 0; i < max_step_messages; i++) { if (retVal.IndexOf("%Step_Messages_" + i) >= 0) { if (step.StepMessages.Count > i) { DBMessage message = step.StepMessages[i] as DBMessage; if (message != null) { retVal = retVal.Replace("%Step_Messages_" + i, format_message(message)); } } else { retVal = retVal.Replace("%Step_Messages_" + i, format_default_message(expression)); } } } if (retVal.IndexOf("%") > 0) { step.AddError("Cannot completely translate this step"); } } return(retVal); }
/// <summary> /// Constructor /// </summary> /// <param name="subSequence"></param> public Runner(SubSequence subSequence) { EventTimeLine = new Events.EventTimeLine(); SubSequence = subSequence; EFSSystem.Runner = this; // Compile everything Interpreter.Compiler compiler = new Interpreter.Compiler(EFSSystem, EFSSystem.ShouldRebuild); compiler.Compile(); EFSSystem.ShouldRebuild = false; Setup(); }
/// <summary> /// The runner /// </summary> public Runner GetRunner(SubSequence subSequence) { Runner runner = EfsSystem.Runner; if (runner == null || runner.SubSequence != subSequence) { if (subSequence != null) { EfsSystem.Runner = new Runner(subSequence, true, true, Settings.Default.CheckForCompatibleChanges); } } return(EfsSystem.Runner); }
public override void visit(SubSequence obj, bool visitSubNodes) { obj.setD_LRBG(""); obj.setLevel(""); obj.setMode(""); obj.setNID_LRBG(""); obj.setQ_DIRLRBG(""); obj.setQ_DIRTRAIN(""); obj.setQ_DLRBG(""); obj.setRBC_ID(""); obj.setRBCPhone(""); obj.setCompleted(true); base.visit(obj, visitSubNodes); }
/// <summary> /// Ensures that the runner is not empty /// </summary> private void CheckRunner() { if (EfsSystem.Runner == null) { if (Frame != null) { SubSequence subSequence = Frame.findSubSequence(subSequenceSelectorComboBox.Text); if (subSequence != null) { EfsSystem.Runner = new Runner(subSequence, true, true, Settings.Default.CheckForCompatibleChanges); } } else { EfsSystem.Runner = EFSService.Instance.Runner; } } }
public static void Main() { var logger = new ConsoleLogger(); var reader = new ConsoleReader(); // ============================================================================ // Task 1. Sum of subsequences. var pr = new SubSequence(logger); pr.Calculate(reader); /* * Test 1. * 4 2 * numbers => 1 2 3 4 * result = 30 * * Test 2. * 5 3 * numbers => 1 –5 7 10 –3 * result 40 */ // ============================================================================ // Task 2. (firstNumber + secondNumber) ^ n var binominal = new Binominal(); binominal.Start(reader, logger); /* * Test 1. * (a+z) * 1 * result => (a^1)+(z^1) * * Test 2. * (c+y) * 3 * result => (c^3)+3(c^2)(y^1)+3(c^1)(y^2)+(y^3) * */ }
static void Main() { // Get Sum int inputSum = int.Parse(Console.ReadLine()); // standard input format = size + fill array int sizeN = int.Parse(Console.ReadLine()); //Get Array int[] inputArray = new int[sizeN]; for (int i = 0; i < sizeN; i++) { inputArray[i] = int.Parse(Console.ReadLine()); } // Get sub sequences var findTheSum = // Divide into subsequences !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! from startAt in Enumerable.Range(0, inputArray.Length) from length in Enumerable.Range(1, inputArray.Length - startAt) let SubSequence = inputArray.Skip(startAt).Take(length) // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! orderby SubSequence.Count() descending //filter where SubSequence.Sum() == inputSum //return subsequences select SubSequence; var ResultSubseq = findTheSum.First(); foreach (var value in ResultSubseq) { Console.Write(value.ToString() + " "); } Console.Write(ResultSubseq.Sum()); }
/// <summary> /// Counts the number of sub sequences /// </summary> /// <param name="obj"></param> /// <param name="visitSubNodes"></param> public override void visit(Generated.SubSequence obj, bool visitSubNodes) { SubSequences += 1; SubSequence subSequence = obj as SubSequence; if (subSequence != null) { if (subSequence.getCompleted()) { CompletedSubSequences.Add(subSequence); } else { OngoingSubSequences.Add(subSequence); } } base.visit(obj, visitSubNodes); }
public void TestMoveBugReport568() { Dictionary test = CreateDictionary("Test"); NameSpace namespace1 = CreateNameSpace(test, "Kernel"); NameSpace nameSpace2 = CreateNameSpace(namespace1, "MA"); Function function1 = CreateFunction(nameSpace2, "SpeedRestriction", "Boolean"); NameSpace nameSpace3 = CreateNameSpace(namespace1, "MRSP"); Function function2 = CreateFunction(nameSpace3, "SpeedRestriction", "Boolean"); Frame frame = CreateTestFrame(test, "frame"); SubSequence subSequence = CreateSubSequence(frame, "subsequence"); TestCase testCase = CreateTestCase(subSequence, "TestCase"); Step step = CreateStep(testCase, "Step"); SubStep subStep = CreateSubStep(step, "SubStep"); Expectation expectation = CreateExpectation(subStep, "Kernel.MA.SpeedRestriction()"); Expectation expectation2 = CreateExpectation(subStep, "MIN(Kernel.MA.SpeedRestriction, Kernel.MRSP.SpeedRestriction)"); Refactor(function1, "SpeedRestriction"); Assert.AreEqual("Kernel.MA.SpeedRestriction()", expectation.ExpressionText); Assert.AreEqual("MIN(Kernel.MA.SpeedRestriction, Kernel.MRSP.SpeedRestriction)", expectation2.ExpressionText); }
/// <summary> /// Creates a section for a given sub sequence /// </summary> /// <param name="aFrame">Frame to be displayed</param> /// <param name="aReportConfig">The report configuration containing display details</param> /// <param name="activatedRules">The list that will contain the rules activated by this sub sequence</param> /// <returns></returns> public void CreateSubSequenceSection(SubSequence aSubSequence, TestsCoverageReportHandler aReportConfig, HashSet <RuleCondition> activatedRules, bool createPdf) { AddSubParagraph("Sub sequence " + aSubSequence.Name); HashSet <RuleCondition> rules = new HashSet <RuleCondition>(); aSubSequence.EFSSystem.Runner = new DataDictionary.Tests.Runner.Runner(aSubSequence); foreach (TestCase testCase in aSubSequence.TestCases) { // each test case will calculate the list of rules it activate // and add them to activatedRules list CreateTestCaseSection(aSubSequence.EFSSystem.Runner, testCase, aReportConfig, rules, createPdf && aReportConfig.AddTestCases); } // now we can create the table with the current sub sequence statistics CreateTable(aSubSequence.Name, rules, aReportConfig.Dictionary.ImplementedRules, aReportConfig.AddActivatedRulesInSubSequences, aReportConfig.AddNonCoveredRulesInSubSequences); activatedRules.UnionWith(rules); CloseSubParagraph(); }
/// <summary> /// The runner /// </summary> public Runner GetRunner(SubSequence subSequence) { Runner runner = EfsSystem.Runner; if (runner == null || runner.SubSequence != subSequence) { if (subSequence != null) { EfsSystem.Runner = new Runner(subSequence, false, true); } } return EfsSystem.Runner; }
/// <summary> /// Build the model of this tree view /// </summary> /// <returns>the root nodes of the tree</returns> protected override List <BaseTreeNode> BuildModel() { List <BaseTreeNode> retVal = new List <BaseTreeNode>(); ModelElement model = Root as ModelElement; if (model != null && model != _previousModel) { _previousModel = model; UsageTreeNode models = new UsageTreeNode("Model", true); models.SetImageIndex(false); models.SubNodesBuilt = true; retVal.Add(models); UsageTreeNode tests = new UsageTreeNode("Test", true); tests.SetImageIndex(false); tests.SubNodesBuilt = true; retVal.Add(tests); foreach (Usage usage in model.EFSSystem.FindReferences(model)) { UsageTreeNode current = new UsageTreeNode(usage, true); current.SetImageIndex(false); NameSpace nameSpace = EnclosingFinder <NameSpace> .find(usage.User, true); Frame frame = EnclosingFinder <Frame> .find(usage.User, true); if (nameSpace != null) { List <NameSpace> nameSpaces = new List <NameSpace>(); while (nameSpace != null) { nameSpaces.Insert(0, nameSpace); nameSpace = EnclosingFinder <NameSpace> .find(nameSpace); } UsageTreeNode currentTreeNode = models; foreach (NameSpace currentNameSpace in nameSpaces) { currentTreeNode = FindOrCreateFolderNode(currentTreeNode, currentNameSpace); } currentTreeNode.Nodes.Add(current); } else if (frame != null) { UsageTreeNode currentNode = FindOrCreateFolderNode(tests, frame); SubSequence subSequence = EnclosingFinder <SubSequence> .find(usage.User, true); if (subSequence != null) { currentNode = FindOrCreateFolderNode(currentNode, subSequence); } currentNode.Nodes.Add(current); } else { retVal.Add(current); } } Sort(); models.ExpandAll(); tests.ExpandAll(); } else { foreach (BaseTreeNode node in Nodes) { retVal.Add(node); } } return(retVal); }
/// <summary> /// Activates the rules in the dictionary until stabilisation /// </summary> public void Cycle() { try { DataDictionary.Generated.ControllersManager.NamableController.DesactivateNotification(); LastActivationTime = Time; Utils.ModelElement.ErrorCount = 0; foreach (Generated.acceptor.RulePriority priority in PRIORITIES_ORDER) { // Clears the cache of functions FunctionCacheCleaner.ClearCaches(); // Activates the processing engine HashSet <Activation> activations = new HashSet <Activation>(); foreach (DataDictionary.Dictionary dictionary in EFSSystem.Dictionaries) { foreach (DataDictionary.Types.NameSpace nameSpace in dictionary.NameSpaces) { SetupNameSpaceActivations(priority, activations, nameSpace); } } ApplyActivations(activations); } // Clears the cache of functions FunctionCacheCleaner.ClearCaches(); if (Utils.ModelElement.ErrorCount > 0) { SubStep subStep = CurrentSubStep(); if (subStep != null) { subStep.AddError("Errors were raised while evaluating this sub step. See model view for more informations"); } else { Step step = CurrentStep(); if (step != null) { step.AddError("Errors were raised while evaluating this step. See model view for more informations"); } else { TestCase testCase = CurrentTestCase(); if (testCase != null) { testCase.AddError("Errors were raised while evaluating this test case. See model view for more informations"); } else { SubSequence.AddError("Errors were raised while evaluating this sub sequence. See model view for more informations"); } } } } } finally { DataDictionary.Generated.ControllersManager.NamableController.ActivateNotification(); } EventTimeLine.CurrentTime += Step; }
// The sheets of the workbook are: \\ // \\ // Sheet number 1, name: Train (main) \\ // Sheet number 2, name: Track \\ // Sheet number 3, name: National values \\ // Sheet number 4, name: Fixed values \\ // Sheet number 5, name: Brake parameters (lambda) \\ L // Sheet number 6, name: Brake parameters (gamma) \\ G // Sheet number 7, name: Correction factor Kdry_rst \\ G // Sheet number 8, name: Integrated correction factors \\ L // Sheet number 9, name: Lambda train deceleration \\ L // Sheet number 10, name: Gamma train deceleration \\ G // Sheet number 11, name: Curves Gamma train \\ G // Sheet number 12, name: Calc Gamma \\ G (hidden) // Sheet number 13, name: Curves Lambda train \\ L // Sheet number 14, name: Calc Lambda \\ L (hidden) /// <summary> /// Launches import of the excel file in the background task /// </summary> /// <param name="arg"></param> public override void ExecuteWork() { if (TheDictionary != null) { Microsoft.Office.Interop.Excel.Application application = new Microsoft.Office.Interop.Excel.Application(); if (application != null) { Workbook workbook = application.Workbooks.Open(FileName); Worksheet trainData = workbook.Sheets[1] as Worksheet; Range aRange = trainData.UsedRange; string trainTypeName = (string)(aRange.Cells[14, 4] as Range).Value2; bool trainIsGamma = false; if (trainTypeName.Equals("Gamma")) { trainIsGamma = true; } else if (!trainTypeName.Equals("Lambda")) { new Exception("Unknown train type"); } Frame newFrame = new Frame(); newFrame.Name = FrameName; newFrame.setCycleDuration("Kernel.CycleDuration"); TheDictionary.AddModelElement(newFrame); SubSequence newSubSequence = new SubSequence(); newSubSequence.Name = FrameName; newFrame.AddModelElement(newSubSequence); TestCase aTestCase = new TestCase(); aTestCase.Name = "Setup"; aTestCase.NeedsRequirement = false; newSubSequence.AddModelElement(aTestCase); intializeEFS(aTestCase, workbook); aTestCase = new TestCase(); aTestCase.Name = "Initialize input"; aTestCase.NeedsRequirement = false; newSubSequence.AddModelElement(aTestCase); if (trainIsGamma) { initializeInputForGamma(aTestCase, workbook); } else { initializeInputForLambda(aTestCase, workbook); } aTestCase = new TestCase(); aTestCase.Name = "Verify input"; aTestCase.NeedsRequirement = false; newSubSequence.AddModelElement(aTestCase); if (trainIsGamma) { verifyInputForGamma(aTestCase, workbook); } else { verifyInputForLambda(aTestCase, workbook); } aTestCase = new TestCase(); aTestCase.Name = "Verify output"; aTestCase.NeedsRequirement = false; newSubSequence.AddModelElement(aTestCase); verifyOutputForTrains(trainIsGamma, aTestCase, workbook); } else { Log.ErrorFormat("Error while opening the excel file"); } application.Quit(); } else { if (TheStep != null) { //importExpectations(workbook); } else { Log.ErrorFormat("The import config is not properly initialized"); } } }
/// <summary> /// Constructor: creates a report for the selected sub sequence /// </summary> /// <param name="aSubSequence"></param> public TestReport(SubSequence aSubSequence) { InitializeComponent(); EFSSystem = aSubSequence.EFSSystem; reportHandler = new TestsCoverageReportHandler(aSubSequence.Dictionary); reportHandler.SubSequence = aSubSequence; InitializeCheckBoxes(2); TxtB_Path.Text = reportHandler.FileName; }
/// <summary> /// Creates a section for a given sub sequence /// </summary> /// <param name="aFrame">Frame to be displayed</param> /// <param name="aReportConfig">The report configuration containing display details</param> /// <param name="activatedRules">The list that will contain the rules activated by this sub sequence</param> /// <returns></returns> public void CreateSubSequenceSection(SubSequence aSubSequence, TestsCoverageReportHandler aReportConfig, HashSet<RuleCondition> activatedRules, bool createPdf) { AddSubParagraph("Sub sequence " + aSubSequence.Name); HashSet<RuleCondition> rules = new HashSet<RuleCondition>(); aSubSequence.EFSSystem.Runner = new DataDictionary.Tests.Runner.Runner(aSubSequence); foreach (TestCase testCase in aSubSequence.TestCases) { // each test case will calculate the list of rules it activate // and add them to activatedRules list CreateTestCaseSection(aSubSequence.EFSSystem.Runner, testCase, aReportConfig, rules, createPdf && aReportConfig.AddTestCases); } // now we can create the table with the current sub sequence statistics CreateTable(aSubSequence.Name, rules, aReportConfig.Dictionary.ImplementedRules, aReportConfig.AddActivatedRulesInSubSequences, aReportConfig.AddNonCoveredRulesInSubSequences); activatedRules.UnionWith(rules); CloseSubParagraph(); }
/// <summary> /// Constructor /// </summary> /// <param name="subSequence"></param> public ApplyTranslationRulesHandler(SubSequence subSequence) { SubSequence = subSequence; }
/// <summary> /// Constructor /// </summary> /// <param name="window"></param> /// <param name="subSequence"></param> public ExecuteTestsHandler(Window window, SubSequence subSequence) { Window = window; SubSequence = subSequence; }
/// <summary> /// The runner /// </summary> public Runner GetRunner(SubSequence subSequence) { Runner runner = EfsSystem.Runner; if (runner == null || runner.SubSequence != subSequence) { if (subSequence != null) { EfsSystem.Runner = new Runner(subSequence, false, true, Settings.Default.CheckForCompatibleChanges); } } return EfsSystem.Runner; }
/// <summary> /// Creates a section for a given sub-sequence /// </summary> /// <param name="aSubSequence">A sub-sequence to be displayed</param> /// <param name="aReportConfig">The report configuration containing display details</param> /// <param name="activatedRules">The list that will contain the rules activated by this sub-sequence</param> /// <param name="createPdf">Indicates if the information about this sub-sequence has to be added to the pdf</param> public void CreateSubSequenceSection(SubSequence aSubSequence, TestsCoverageReportHandler aReportConfig, HashSet<RuleCondition> activatedRules, bool createPdf) { string title = "Sub sequence " + aSubSequence.Name; if (createPdf) { AddSubParagraph(title); } HashSet<RuleCondition> rules = new HashSet<RuleCondition>(); aSubSequence.EFSSystem.Runner = new Runner(aSubSequence, false, true); foreach (TestCase testCase in aSubSequence.TestCases) { // SIDE EFFECT: // each test case will calculate the list of rules it activates // and add them to activatedRules list CreateTestCaseSection(aSubSequence.EFSSystem.Runner, testCase, aReportConfig, rules, createPdf && aReportConfig.AddTestCases); } activatedRules.UnionWith(rules); // now we can create the table with the current sub sequence statistics if (createPdf) { CreateActivatedRulesSection(title, rules, aReportConfig.Dictionary.ImplementedRules, aReportConfig.AddActivatedRulesInSubSequences); CloseSubParagraph(); } }