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