/// <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> /// Create Result Directory for storing images --> Support Method /// </summary> public static void CreateTestsRunDierectory() { SetCurrentTestRunPath(); testRunResultWordFolder = getCurrentTestRunPath + "\\WordReport"; testRunResultPDFFolder = getCurrentTestRunPath + "\\PDFReport"; testRunResultHTMLFolder = getCurrentTestRunPath + "\\HTMLReport"; testRunResultImgFolder = getCurrentTestRunPath + "\\Screenshots"; testRunResultOutputFolder = getCurrentTestRunPath + "\\OutputData"; if (Reports.IsRequiredReport) { DirectoryInfo dirimg = Directory.CreateDirectory(testRunResultImgFolder); } if (Reports.IsRequiredReport && isWordReport) { DirectoryInfo dirword = Directory.CreateDirectory(testRunResultWordFolder); } if (Reports.IsRequiredReport && isPdfReport) { DirectoryInfo dirpdf = Directory.CreateDirectory(testRunResultPDFFolder); } if (isHTMLReport) { DirectoryInfo dirhtml = Directory.CreateDirectory(testRunResultHTMLFolder); HTMLExtentReport.StartResult(); } }
/// <summary> /// Save html report /// </summary> public static void SaveHTMLReport() { if (isHTMLReport) { HTMLExtentReport.EndResult(); } }
/// <summary> /// Customize html report /// </summary> public static void SaveCustomizedHTMLReport() { if (Reports.isHTMLReport) { HTMLExtentReport.CustomizeHTMLReport(); } }
/// <summary> /// Initialize test reports /// </summary> public static void InitializeReports() { //Initial setup for Word and PDF Results if (isHTMLReport) { HTMLExtentReport.StartTestCases(BaseUtilities.scenarioName, "<b>Feature Name: </b> " + BaseUtilities.featureFileName + "<b> ALM TestSet Name: </b> " + BaseUtilities.testSetName); } //create image folder CreateTestRunImageFolder(); }