示例#1
0
        /// <summary>
        /// Deletes all the files within the specified folder
        /// </summary>
        /// <param name="folder">The folder from which we wish to delete all of the files</param>
        public static void ClearFolder(DirectoryInfo folder)
        {
            SAFEBBALog.Debug(CommonUtilities.GetClassAndMethodName(), folder.FullName);
            // Iterate each file
            foreach (FileInfo file in folder.GetFiles())
            {
                try
                {
                    // Delete the file, ignoring any exceptions
                    file.Delete();
                }
                catch (Exception)
                {
                }
            }

            // For each folder in the specified folder
            foreach (DirectoryInfo subfolder in folder.GetDirectories())
            {
                // Clear all the files in the folder
                ClearFolder(subfolder);
            }
        }
示例#2
0
 public void TestStarted(TestName testName)
 {
     SAFEBBALog.Info(CommonUtilities.GetClassAndMethodName());
 }
示例#3
0
 /// <summary>
 /// Clear the cache for Inernet Explorer
 /// </summary>
 public static void ClearIECache()
 {
     SAFEBBALog.Debug(CommonUtilities.GetClassAndMethodName());
     // Clear the special cache folder
     ClearFolder(new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.InternetCache)));
 }
示例#4
0
 public void SuiteStarted(TestName testName)
 {
     SAFEBBALog.Info(CommonUtilities.GetClassAndMethodName());
     isScreenShotTaken = false;
 }
示例#5
0
 public void RunFinished(TestResult result)
 {
     SAFEBBALog.Info(CommonUtilities.GetClassAndMethodName());
     createReRunFailesTestCaseFile();
 }
示例#6
0
 public void RunFinished(Exception exception)
 {
     SAFEBBALog.Info(CommonUtilities.GetClassAndMethodName());
 }
示例#7
0
 public void TestFinished(TestResult result)
 {
     SAFEBBALog.Info(CommonUtilities.GetClassAndMethodName());
     CreatScreenShotOnFailure(result);
     SAFEBBALog.TestCaseEnd(result);
 }
示例#8
0
        /// <summary>
        /// Create a file that contains the commandline in order to be able rerun the failed test cases
        /// </summary>
        private void createReRunFailesTestCaseFile()
        {
            string projectName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
            string p           = " " + projectName + ConfigParameters.PATH_SAF_DLL_BIN_DEBUG + projectName + ".dll";

            failedTestCasesToReRun += p;
            failedTestCasesToReRun  = failedTestCasesToReRun.Replace("\\", @"\");
            string reRunFialdTestCasesFolderPath = ConfigParameters.PATH_RERUN_FAILED_TEST_CASES_FOLDER + ConfigParameters.ENVIRONMENT;
            bool   exists = Directory.Exists(reRunFialdTestCasesFolderPath);

            if (!exists)
            {
                System.IO.Directory.CreateDirectory(reRunFialdTestCasesFolderPath);
            }
            File.WriteAllText(reRunFialdTestCasesFolderPath + @"\ReRunFailedTestCases" + CommonUtilities.GetCurrentDate() + ".bat", failedTestCasesToReRun);
            File.WriteAllText(reRunFialdTestCasesFolderPath + @"\ReRunFailedTestCases_Latest.bat", failedTestCasesToReRun);
        }