Ejemplo n.º 1
0
 public SingleTestRun(TestWorkspace testWorkSpace, CCTestCase ccTestCase,
                      ISingleTestRunProgressListener singleTestRunProgressListener)
 {
     this.testWorkspace = testWorkSpace;
     this.ccTestCase    = ccTestCase;
     this.singleTestRunProgressListener = singleTestRunProgressListener;
 }
Ejemplo n.º 2
0
        private void btnRunModel_Click(object sender, EventArgs e)
        {
            if (!CheckAndSetTestCCParameters())
            {
                return;
            }
            TestRunProgressForm testRunProgressForm = new TestRunProgressForm();
            CCTestCase          ccTestCase          = new CCTestCase();

            ccTestCase.initialDesired = ((CCTestWorkspace)testWorkspace).GetInitialDesiredValue();
            ccTestCase.finalDesired   = ((CCTestWorkspace)testWorkspace).GetFinalDesiredValue();
            ErrorResult errorResult = testRunProgressForm.TestRunModel(testWorkspace, ccTestCase);

            if (errorResult.errorCode != ErrorCode.Success)
            {
                if (errorResult.errorCode != ErrorCode.TestRunCanceled)
                {
                    MessageBox.Show("Error in Running the Model with this Information!",
                                    "Error Running the Model", MessageBoxButtons.OK);
                }
                return;
            }
            modelRunningTimeCurrentMilisec = errorResult.errorParemeter;
            cbConfirmCorrectness.Enabled   = true;
            cbConfirmCorrectness.Checked   = true;
        }
Ejemplo n.º 3
0
 public ErrorResult TestRunModel(TestWorkspace testWorkspace, CCTestCase ccTestCase)
 {
     singleTestRun = new SingleTestRun(testWorkspace, ccTestCase, this);
     singleTestRun.RunAsync();
     CreateCloseTimer();
     ShowDialog();
     return(testErrorResult);
 }
Ejemplo n.º 4
0
        public Dictionary <string, List <CCTestCase> > LoadWorstTestCasesToCCTestWorkspace(string testWorkspaceName)
        {
            Dictionary <string, List <CCTestCase> > worstTestCases = new Dictionary <string, List <CCTestCase> >();
            string singleStateSearchResultsPath = GetWorkspaceSingleStateSearchResultsPath(testWorkspaceName);

            if (!Directory.Exists(singleStateSearchResultsPath))
            {
                return(worstTestCases);
            }
            List <string> requirementDirectories = new List <string>(Directory.EnumerateDirectories(singleStateSearchResultsPath));

            foreach (string requirementDirectory in requirementDirectories)
            {
                int    startIndexOfFileName     = requirementDirectory.LastIndexOf('\\');
                string requirementDirectoryName = requirementDirectory.Substring(startIndexOfFileName + 1);
                worstTestCases.Add(requirementDirectoryName, new List <CCTestCase>());
                List <string> regionsDirectories = new List <string>(Directory.EnumerateDirectories(requirementDirectory));
                foreach (string regionsDirectory in regionsDirectories)
                {
                    string worstTestCasesFilePath = regionsDirectory + "\\WorstCaseScenarioInTheRegion.csv";
                    if (!File.Exists(worstTestCasesFilePath))
                    {
                        continue;
                    }
                    string[]        worstTestCasesFileLines = System.IO.File.ReadAllLines(worstTestCasesFilePath);
                    MatchCollection wordMatches             = Regex.Matches(worstTestCasesFileLines[0], @"[^,]+");
                    if (wordMatches.Count != 4)
                    {
                        continue;
                    }
                    MatchCollection valueMatches = Regex.Matches(worstTestCasesFileLines[1], @"[^,]+");
                    if (valueMatches.Count != 4)
                    {
                        continue;
                    }
                    HeatMapRegion heatMapRegion = new HeatMapRegion();
                    heatMapRegion.indexX = Int16.Parse(valueMatches[0].Value);
                    heatMapRegion.indexY = Int16.Parse(valueMatches[1].Value);
                    CCTestCase ccTestCase = new CCTestCase();
                    ccTestCase.initialDesired = float.Parse(valueMatches[2].Value);
                    ccTestCase.finalDesired   = float.Parse(valueMatches[3].Value);
                    ccTestCase.heatMapRegion  = heatMapRegion;
                    worstTestCases[requirementDirectoryName].Add(ccTestCase);
                }
            }
            return(worstTestCases);
        }
Ejemplo n.º 5
0
        private void btnRunModel_Click(object sender, EventArgs e)
        {
            TestRunProgressForm testRunProgressForm = new TestRunProgressForm();
            CCTestCase          ccTestCase          = new CCTestCase();

            ccTestCase.initialDesired = float.Parse(tbInitialDsrdTest.Text);
            ccTestCase.finalDesired   = float.Parse(tbFinalDsrdTest.Text);
            ErrorResult errorResult = testRunProgressForm.TestRunModel(ccTestWorkspace, ccTestCase);

            if (errorResult.errorCode != ErrorCode.Success)
            {
                if (errorResult.errorCode != ErrorCode.TestRunCanceled)
                {
                    MessageBox.Show("Error in Running the Model with this Information!",
                                    "Error Running the Model", MessageBoxButtons.OK);
                }
                return;
            }
        }