public SingleTestRun(TestWorkspace testWorkSpace, SLTestCase sbTestCase, ISingleTestRunProgressListener singleTestRunProgressListener) { this.testWorkspace = testWorkSpace; this.sbTestCase = sbTestCase; this.singleTestRunProgressListener = singleTestRunProgressListener; }
private void updateCalsInfo() { tbCalValue.Text = ""; SLTestCase testCase = outputsTestSuites[lvOutputs.SelectedItems[0].SubItems[2].Text][lvTestCases.SelectedIndices[0]]; tbCalValue.Text = testCase.calibrationVars[cmbCalVars.Text].ToString(); }
public ErrorResult TestRunModel(TestWorkspace testWorkspace, SLTestCase sbTestCase) { singleTestRun = new SingleTestRun(testWorkspace, sbTestCase, this); singleTestRun.RunAsync(); CreateCloseTimer(); ShowDialog(); return(testErrorResult); }
private void btnRunTestCase_Click(object sender, EventArgs e) { SLTestCase slTestCase = outputsTestSuites[lvOutputs.SelectedItems[0].SubItems[2].Text][lvTestCases.SelectedIndices[0]]; slTestCase.dsrdTCNo = lvTestCases.SelectedIndices[0] + 1; slTestCase.dsrdOutNo = Int32.Parse(lvOutputs.SelectedItems[0].SubItems[1].Text); slTestCase.filesDir = slTestWorkspace.modelSettings.GetSimulinkModelDirectory() + "\\" + slTestWorkspace.modelSettings.GetSimulinkModelNameWithNoExtension() + "-Files\\"; slTestCase.testSuiteDir = TestWorkspaceDataProvider.GetTestWorkspaceDataProvider().GetWorkspaceResultsPath(slTestWorkspace.ToString()) + cmbCriteria.Text + "\\" + lvOutputs.SelectedItems[0].SubItems[2].Text; SingleTestCaseRun stcrun = new SingleTestCaseRun(slTestWorkspace, slTestCase); stcrun.RunAsync(); }
private void lvOutputs_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) { if (e.IsSelected) { string selectedOutput = lvOutputs.SelectedItems[0].SubItems[2].Text; lvTestCases.Items.Clear(); for (int count = 0; count < outputsTestSuites[selectedOutput].Count; ++count) { SLTestCase testCase = outputsTestSuites[selectedOutput][count]; string[] items = new string[1]; items[0] = String.Format("Test Case {0}", count + 1); /*string[] items = new string[1 + testCase.inputVarsInitialValues.Count + testCase.calibrationVars.Count]; * * items[0] = (count + 1).ToString(); * int cnt = 0; * foreach (string key in testCase.inputVarsInitialValues.Keys) * { * string inputVarName = key; * float from = outputsTestSuites[cmbCriteria.SelectedItem.ToString()][count].inputVarsInitialValues[inputVarName]; * float to = outputsTestSuites[cmbCriteria.SelectedItem.ToString()][count].inputVarsFinalValues[inputVarName]; * float stepTime = outputsTestSuites[cmbCriteria.SelectedItem.ToString()][count].inputVarsStepTimes[inputVarName]; * items[1 + cnt] = String.Format("From {0} to {1} at {2} ms", from, to, Math.Ceiling(stepTime * 1000)); ++cnt; * } * cnt = 0; * foreach (string key in testCase.calibrationVars.Keys) * { * string configParName = key; * items[1 + testCase.inputVarsInitialValues.Count + cnt] = * outputsTestSuites[cmbCriteria.SelectedItem.ToString()][count].calibrationVars[configParName].ToString(); ++cnt; * }*/ ListViewItem listViewItem = new ListViewItem(items); lvTestCases.Items.Add(listViewItem); } btnRunTestCase.Enabled = false; //cmbInputVars.Enabled = tbInitialVal.Enabled = tbFinalVal.Enabled = tbStepTime.Enabled = false; //cmbCalVars.Enabled = tbCalValue.Enabled = false; if (lvTestCases.Items.Count > 0) { lvTestCases.Items[0].Selected = true; } } }
private void updateSignalInfo() { lvSignals.Items.Clear(); SLTestCase testCase = outputsTestSuites[lvOutputs.SelectedItems[0].SubItems[2].Text][lvTestCases.SelectedIndices[0]]; SLSignal signal = testCase.inputSignals[cmbInputVars.SelectedItem.ToString()]; for (int i = 0; i < signal.signalStepTimes.Count - 1; ++i) { String[] items = new String[2]; items[0] = signal.signalStepTimes[i].ToString(); items[1] = signal.signalValues[i].ToString(); ListViewItem listViewItem = new ListViewItem(items); lvSignals.Items.Add(listViewItem); } }
public Dictionary <string, Dictionary <string, List <SLTestCase> > > LoadTestSuitesToSLTestWorkspace(string testWorkspaceName) { Dictionary <string, Dictionary <string, List <SLTestCase> > > testSuites = new Dictionary <string, Dictionary <string, List <SLTestCase> > >(); string workspaceResultsPath = GetWorkspaceResultsPath(testWorkspaceName); if (!Directory.Exists(workspaceResultsPath)) { return(testSuites); } XmlReaderSettings xmlSettings = new XmlReaderSettings(); xmlSettings.ValidationType = ValidationType.None; List <string> criteriaDirectories = new List <string>(Directory.EnumerateDirectories(workspaceResultsPath)); foreach (string criterionDirectory in criteriaDirectories) { int startIndexOfCriDirName = criterionDirectory.LastIndexOf('\\'); string criterionDirectoryName = criterionDirectory.Substring(startIndexOfCriDirName + 1); Dictionary <string, List <SLTestCase> > criterionTestSuites = new Dictionary <string, List <SLTestCase> >(); List <string> outputDirectories = new List <string>(Directory.EnumerateDirectories(criterionDirectory)); foreach (string outputDirectory in outputDirectories) { int startIndexOfOutDirName = outputDirectory.LastIndexOf('\\'); string outptuDirectoryName = outputDirectory.Substring(startIndexOfOutDirName + 1); List <SLTestCase> outputTestCases = new List <SLTestCase>(); string testSuiteFilePath = outputDirectory + "\\TestSuite.xml"; if (!File.Exists(testSuiteFilePath)) { continue; } XmlReader workspaceReader = XmlReader.Create( testSuiteFilePath, xmlSettings); while (workspaceReader.Read()) { if (workspaceReader.NodeType == XmlNodeType.Element && workspaceReader.Name == "TestCase") { SLTestCase slTestCase = new SLTestCase(); string varName, varType; while (workspaceReader.Read()) { if (workspaceReader.NodeType == XmlNodeType.Element && workspaceReader.Name == "Input") { do { workspaceReader.Read(); }while (workspaceReader.Name != "VarName"); workspaceReader.Read(); varName = workspaceReader.Value; do { workspaceReader.Read(); }while (workspaceReader.Name != "Type"); workspaceReader.Read(); varType = workspaceReader.Value; if (varType.Equals("Input")) { do { workspaceReader.Read(); }while (workspaceReader.Name != "NoSegments"); workspaceReader.Read(); int noSegs = Int16.Parse(workspaceReader.Value); SLSignal slSignal = new SLSignal(); for (int i = 0; i <= noSegs; ++i) { do { workspaceReader.Read(); }while (workspaceReader.Name != "StepTime"); workspaceReader.Read(); float stepTime = float.Parse(workspaceReader.Value); slSignal.signalStepTimes.Add(stepTime); do { workspaceReader.Read(); }while (workspaceReader.Name != "Value"); workspaceReader.Read(); float sigValue = float.Parse(workspaceReader.Value); slSignal.signalValues.Add(sigValue); } slTestCase.inputSignals.Add(varName, slSignal); } else if (varType.Equals("Calibration")) { do { workspaceReader.Read(); }while (workspaceReader.Name != "Value"); workspaceReader.Read(); slTestCase.calibrationVars.Add(varName, float.Parse(workspaceReader.Value)); } } else if (workspaceReader.NodeType == XmlNodeType.EndElement && workspaceReader.Name == "TestCase") { outputTestCases.Add(slTestCase); break; } } } } criterionTestSuites.Add(outptuDirectoryName, outputTestCases); } testSuites.Add(criterionDirectoryName, criterionTestSuites); } return(testSuites); }
public SingleTestCaseRun(TestWorkspace testWorkSpace, SLTestCase slTestCase) { this.testWorkspace = testWorkSpace; this.slTestCase = slTestCase; }