public static void SetCurrentTestRunPath() { string directory = BaseUtilities.GetFolderPath(); string datetime = BaseUtilities.GetCurrentTimeWithFormat(); getCurrentTestRunPath = directory + @"\Results\Run_" + datetime; }
/// <summary> /// Report Event --> Main Method /// </summary> /// <param name="stepName">Name of the step</param> /// <param name="stepDescription">Description of the step</param> /// <param name="stepStatus">Status of the step</param> public static void ReportEvent(string stepName, Status stepStatus, Boolean isScreenshot) { //System.Drawing.Image image = null; if (IsRequiredReport && isScreenshot) { if (BaseUtilities.applicationType != null) { if (BaseUtilities.applicationType.ToLower().Contains("web")) { if (IsDriverActive()) { Screenshot screenshot = ((ITakesScreenshot)driver).GetScreenshot(); scnshtpath = resultImgFolder + "\\"; runtimescnshtpath = scnshtpath + BaseUtilities.GetCurrentTimeWithFormat() + ".png"; screenshot.SaveAsFile(runtimescnshtpath); } } if (BaseUtilities.applicationType.ToLower().Contains("windows")) { scnshtpath = resultImgFolder + "\\"; runtimescnshtpath = scnshtpath + BaseUtilities.GetCurrentTimeWithFormat() + ".png"; TakeScreenshot(runtimescnshtpath); } } } if (isHTMLReport) { HTMLExtentReport.InsertResultStep(stepName, stepStatus, isScreenshot); } }
/// <summary> /// Save web screenshots into result Directory --> Support Method /// </summary> /// <param name="img">ScreenShot</param> public static void SaveWebScreenshot(Screenshot img) { scnshtpath = resultImgFolder + "\\"; runtimescnshtpath = scnshtpath + BaseUtilities.GetCurrentTimeWithFormat() + ".png"; img.SaveAsFile(runtimescnshtpath); }
/// <summary> /// Save screenshots into result Directory --> Support Method /// </summary> /// <param name="img">Image</param> public static void SaveScreenshot(System.Drawing.Image img) { scnshtpath = resultImgFolder + "\\"; runtimescnshtpath = scnshtpath + BaseUtilities.GetCurrentTimeWithFormat() + ".png"; img.Save(runtimescnshtpath); }