Ejemplo n.º 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);
            }
        }
Ejemplo n.º 2
0
 public void TestStarted(TestName testName)
 {
     SAFEBBALog.Info(CommonUtilities.GetClassAndMethodName());
 }
Ejemplo n.º 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)));
 }
Ejemplo n.º 4
0
 public void SuiteStarted(TestName testName)
 {
     SAFEBBALog.Info(CommonUtilities.GetClassAndMethodName());
     isScreenShotTaken = false;
 }
Ejemplo n.º 5
0
 public void RunFinished(TestResult result)
 {
     SAFEBBALog.Info(CommonUtilities.GetClassAndMethodName());
     createReRunFailesTestCaseFile();
 }
Ejemplo n.º 6
0
 public void RunFinished(Exception exception)
 {
     SAFEBBALog.Info(CommonUtilities.GetClassAndMethodName());
 }
Ejemplo n.º 7
0
 public void TestFinished(TestResult result)
 {
     SAFEBBALog.Info(CommonUtilities.GetClassAndMethodName());
     CreatScreenShotOnFailure(result);
     SAFEBBALog.TestCaseEnd(result);
 }
Ejemplo n.º 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);
        }