/// <summary> /// Constructor: creates a report for the selected frame /// </summary> /// <param name="aFrame"></param> public TestReport(Frame aFrame) { InitializeComponent(); _reportHandler = new TestsCoverageReportHandler(aFrame.Dictionary) {Frame = aFrame}; InitializeCheckBoxes(1); TxtB_Path.Text = _reportHandler.FileName; }
/// <summary> /// Saves the frame provided associated to this frame ref /// </summary> /// <param name="frame"></param> public void SaveFrame(Frame frame) { Directory.CreateDirectory(Path.GetDirectoryName(FileName)); VersionedWriter writer = new VersionedWriter(FileName); frame.unParse(writer, false); writer.Close(); }
public override Frame createFrame() { Frame retVal = new Tests.Frame(); _defaultValueSetter.SetDefaultValue(retVal); return(retVal); }
/// <summary> /// Constructor: creates a report for the selected frame /// </summary> /// <param name="aFrame"></param> public TestReport(Frame aFrame) { InitializeComponent(); EFSSystem = aFrame.EFSSystem; reportHandler = new TestsCoverageReportHandler(aFrame.Dictionary); reportHandler.Frame = aFrame; InitializeCheckBoxes(1); TxtB_Path.Text = reportHandler.FileName; }
public override void visit(Generated.Frame obj, bool visitSubNodes) { Tests.Frame frame = (Tests.Frame)obj; if (frame != null) { checkExpression(frame, frame.getCycleDuration()); Types.Type type = frame.CycleDuration.GetExpressionType(); if (type != null) { if (!frame.EFSSystem.DoubleType.Match(type)) { frame.AddError("Cycle duration should be compatible with the Time type"); } } } base.visit(obj, visitSubNodes); }
/// <summary> /// Creates an article for a given frame /// </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 frame</param> /// <returns></returns> public void CreateFrameArticle(Frame aFrame, TestsCoverageReportHandler aReportConfig, HashSet<RuleCondition> activatedRules) { string title = "Frame " + aFrame.Name; AddSubParagraph(title); foreach (SubSequence subSequence in aFrame.SubSequences) { // SIDE EFFECT: // each sub-sequence will calculate the list of rules it activates // and add them to activatedRules list CreateSubSequenceSection(subSequence, aReportConfig, activatedRules, aReportConfig.AddSubSequences); } // now we can create the section containing the activated rules of the frame CreateActivatedRulesSection(title, activatedRules, aReportConfig.Dictionary.ImplementedRules, aReportConfig.AddActivatedRulesInFrames); CloseSubParagraph(); }
/// <summary> /// Adds a model element in this model element /// </summary> /// <param name="copy"></param> public override void AddModelElement(Utils.IModelElement element) { { Types.NameSpace item = element as Types.NameSpace; if (item != null) { appendNameSpaces(item); } } { Rules.RuleDisabling item = element as Rules.RuleDisabling; if (item != null) { appendRuleDisablings(item); } } { Tests.Frame item = element as Tests.Frame; if (item != null) { appendTests(item); } } }
/// <summary> /// Rebuilds the contents of the subsequence combo box, according to the frame selected in the frames combo box /// </summary> private void RebuildSubSequencesComboBox() { subSequenceSelectorComboBox.Items.Clear(); foreach (Dictionary dictionary in EfsSystem.Dictionaries) { Frame = dictionary.FindFrame(frameToolStripComboBox.Text); if (Frame != null) { List<string> subSequences = new List<string>(); foreach (SubSequence subSequence in Frame.SubSequences) { subSequences.Add(subSequence.Name); } subSequences.Sort(); foreach (string subSequence in subSequences) { subSequenceSelectorComboBox.Items.Add(subSequence); } break; } } if (subSequenceSelectorComboBox.Items.Count > 0) { subSequenceSelectorComboBox.Text = subSequenceSelectorComboBox.Items[0].ToString(); } else { subSequenceSelectorComboBox.Text = ""; } }
/// <summary> /// Sets the current frame parameters /// </summary> /// <param name="frame"></param> public void SetFrame(Frame frame) { Invoke((MethodInvoker) delegate { frameToolStripComboBox.Text = frame.Name; Refresh(); }); }
/// <summary> /// Refreshes the display /// </summary> public override void Refresh() { if (!DoingRefresh) { try { DoingRefresh = true; string selectedFrame = frameToolStripComboBox.Text; if (EfsSystem.Runner == null) { toolStripTimeTextBox.Text = @"0"; toolStripCurrentStepTextBox.Text = Resources.Window_Refresh__none_; } else { toolStripTimeTextBox.Text = "" + EfsSystem.Runner.Time; Step currentStep = EfsSystem.Runner.CurrentStep(); if (currentStep != null) { toolStripCurrentStepTextBox.Text = currentStep.Name; } else { toolStripCurrentStepTextBox.Text = Resources.Window_Refresh__none_; } if (EfsSystem.Runner.SubSequence != null && EfsSystem.Runner.SubSequence.Frame != null) { Frame = EfsSystem.Runner.SubSequence.Frame; selectedFrame = EfsSystem.Runner.SubSequence.Frame.Name; } } testBrowserTreeView.Refresh(); testDescriptionTimeLineControl.Refresh(); testExecutionTimeLineControl.Refresh(); RebuildFramesComboBox(); frameToolStripComboBox.Text = selectedFrame; frameToolStripComboBox.ToolTipText = selectedFrame; if (Frame == null || !frameToolStripComboBox.Text.Equals(Frame.Name)) { RebuildSubSequencesComboBox(); if (EfsSystem.Runner != null && EfsSystem.Runner.SubSequence != null) { EfsSystem.Runner = null; } } if (EfsSystem.Runner != null && EfsSystem.Runner.SubSequence != null) { subSequenceSelectorComboBox.Text = EfsSystem.Runner.SubSequence.Name; } subSequenceSelectorComboBox.ToolTipText = subSequenceSelectorComboBox.Text; } finally { DoingRefresh = false; } } base.Refresh(); }
public override Frame createFrame() { Frame retVal = new Tests.Frame(); _defaultValueSetter.SetDefaultValue(retVal); return retVal; }
/// <summary> /// Creates an article for a given frame /// </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 frame</param> /// <returns></returns> public void CreateFrameArticle(Frame aFrame, TestsCoverageReportHandler aReportConfig, HashSet<RuleCondition> activatedRules) { AddSubParagraph("Frame " + aFrame.Name); foreach (SubSequence subSequence in aFrame.SubSequences) { // SIDE EFFECT : // each test case will calculate the list of rules it activate // and add them to activatedRules list CreateSubSequenceSection(subSequence, aReportConfig, activatedRules, aReportConfig.AddSubSequences); } // now we can create the table with the current sub sequence statistics AddSubParagraph("Statistics"); CreateTable(aFrame.Name, activatedRules, aReportConfig.Dictionary.ImplementedRules, aReportConfig.AddActivatedRulesInFrames, aReportConfig.AddNonCoveredRulesInFrames); CloseSubParagraph(); CloseSubParagraph(); }
private FrameRef referenceFrame(ModelElement enclosing, Frame test) { FrameRef retVal = (FrameRef)Generated.acceptor.getFactory().createFrameRef(); retVal.Name = test.Name; retVal.setFather(enclosing); retVal.SaveFrame(test); return retVal; }
// 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"); } } }