ParseFileGetStatus() public static method

Parse the file content to get the case status Result format in file: "Result":"Result: Passed"
public static ParseFileGetStatus ( string filePath, TestCaseStatus &status ) : bool
filePath string
status TestCaseStatus
return bool
Ejemplo n.º 1
0
 /// <summary>
 /// If existing running test cases, change the status to Other.
 /// </summary>
 public void FinishTest()
 {
     // Clear RunningTestCase
     if (RunningTestCase != null)
     {
         if (RunningTestCase.Status == TestCaseStatus.Running)
         {
             GroupByOutcome.ChangeStatus(RunningTestCase.Name, TestCaseStatus.NotRun);
         }
         RunningTestCase = null;
     }
     foreach (var testcase in AllTestCases)
     {
         // Clear Waiting cases.
         if (testcase.Status == TestCaseStatus.Waiting && CurrentPageCaseList.Contains(testcase.Name))
         {
             TestCaseStatus status = TestCaseStatus.NotRun;
             TestCaseDetail caseDetail;
             if (testcase.LogUri != null && System.IO.File.Exists(testcase.LogUri.AbsolutePath))
             {
                 Utility.ParseFileGetStatus(testcase.LogUri.AbsolutePath, out status, out caseDetail);
             }
             testcase.Status = status;
         }
         // Clear Running cases. Should not be here
         if (testcase.Status == TestCaseStatus.Running && CurrentPageCaseList.Contains(testcase.Name))
         {
             testcase.Status = TestCaseStatus.NotRun;
             RunningTestCase = null;
         }
     }
 }
Ejemplo n.º 2
0
        private void OnHtmlFileChanged(object sender, FileSystemEventArgs e)
        {
            // The html files are under the below folder, so any file that is not in that folder is not interesting.
            // E.g. C:\MicrosoftProtocolTests\FileSharing\Server-Endpoint\1.0.5812.0\HtmlTestResults\2014-11-09-21-59-16\Html\
            if (!e.FullPath.StartsWith(Path.Combine(workingDir, AppConfig.HtmlResultFolderName)))
            {
                return;
            }

            if (e.FullPath.Contains(AppConfig.IndexHtmlFileName))
            {
                this.indexHtmlFilePath = e.FullPath;
                return;
            }

            if (!e.FullPath.Contains(AppConfig.HtmlLogFileFolder))
            {
                return;
            }

            string caseName = Path.GetFileNameWithoutExtension(e.FullPath);

            if (!isFirstTimeAccess.ContainsKey(caseName) || !isFirstTimeAccess[caseName])
            {
                // This is the situation where the case has ran before.
                // Rerun the case will trigger two file change events.
                // We are interested in the second event where the log has been saved to file.
                isFirstTimeAccess[caseName] = true;
                return;
            }

            TestCaseStatus status;
            TestCaseDetail caseDetail;

            if (!Utility.ParseFileGetStatus(e.FullPath, out status, out caseDetail))
            {
                // The file name format is not correct, ignore it.
                return;
            }

            // Pass case status/name/log path/ to logger to update UI.
            UpdateCase(status, caseName, caseDetail, e.FullPath);
        }