public static void setTestClassStart(String testClassName, String dateTime) { try { SAFEBBALog.Info("Executing Test Cases for Class Started for Class : " + testClassName); errorTestResultFilePath = null; //For Directory if (!Directory.Exists(resultFolderPath)) { resultFolderPath = resultFolderPath + "_" + dateTime; Directory.CreateDirectory(resultFolderPath); System.IO.File.Copy(@Environment.CurrentDirectory + "\\Test_Results_Template.xlsx", resultFolderPath + "\\Test_Results" + "_" + dateTime + ".xlsx"); } testResultFilePath = resultFolderPath + "\\Test_Results" + "_" + dateTime + ".xlsx"; testResultFile = new FileInfo(testResultFilePath); excelPackage = new ExcelPackage(testResultFile); testCaseWorkSheet = excelPackage.Workbook.Worksheets.First(); testStepWorkSheet = excelPackage.Workbook.Worksheets.Last(); } catch (Exception e) { SAFEBBALog.TestCaseErrorMessage(e); } }
public static void setTestClassFinish(String testClassName) { try { SAFEBBALog.Info("Executing Test Cases Finished for Class : " + testClassName); excelPackage.SaveAs(testResultFile); excelPackage.Dispose(); // excelPackage.Load(holdingStream); SAFEBBALog.Info("Saving Test Results for Class : " + testClassName + " in path -> " + testResultFilePath); } catch (Exception e) { SAFEBBALog.TestCaseErrorMessage(e); } finally { //tc_RowIndex = 7; ts_RowIndex = 7; testCaseIDCounter = 1; testStepIDCounter = 1; } }
// Click the menu from the left side of the panel public void clickTableLink(String id, String text) { IWebElement webelement = findWebDriverElement.waitForElementById(null, null, id); Boolean flag = false; IReadOnlyCollection <IWebElement> elementLiList = webelement.FindElements(By.TagName("table")); try { foreach (IWebElement elementLi in elementLiList) { IReadOnlyCollection <IWebElement> elementUlList = elementLi.FindElements(By.TagName("tbody")); foreach (IWebElement elementUl in elementUlList) { if (elementUl.GetAttribute("innerHTML").Contains(text)) { elementUl.Click(); flag = true; break; } } if (flag) { break; } } } catch (Exception e) { SAFEBBALog.TestCaseErrorMessage(e); } }
public static void setTestCaseErrorMessage(Exception e) { SAFEBBALog.TestCaseErrorMessage(e); }