public void ConvertHTMLReportAndALMUpdates() { if (Reports.IsRequiredReport && (Reports.isWordReport || Reports.isPdfReport)) { Reports.errorMessage = null; Reports.runtimescnshtpath = null; int count = GetTestResultCount(); if (count > 0) { for (int i = 1; i <= count; i++) { String rootPath = "//li[@test-id='" + i + "']"; TestName = GetTestName(rootPath); if (TestName.Trim() == BaseUtilities.scenarioName.Trim()) { BaseUtilities.scenarioName = TestName; BaseUtilities.scenarioStatus = GetTestStatus(rootPath); Reports.starttime = GetTestStartTime(rootPath); Reports.endtime = GetTestEndTime(rootPath); Reports.timetaken = GetTestTimeTaken(rootPath); string[] TestDesc = Regex.Split(GetTestDescription(rootPath).Trim(), "</b>"); BaseUtilities.featureFileName = Regex.Split(TestDesc[1].Trim(), "<b>")[0]; BaseUtilities.testSetName = TestDesc[2].Trim(); if (Reports.isWordReport) { WordReport.InitSetupWord(); } if (Reports.isPdfReport) { PDFReport.InitSetupPDF(); } Dictionary <string, string> Steps = GetStepDetails(rootPath); if (Steps.Count > 0) { foreach (KeyValuePair <string, string> list in Steps) { var html = @"<!DOCTYPE html><html><body>" + list.Key + "</body></html> "; var htmlDoc = new HtmlDocument(); htmlDoc.LoadHtml(html); string[] StepDetailsArray = Regex.Split(htmlDoc.DocumentNode.SelectSingleNode("//body").InnerText.Replace("Screenshot:", ""), "Error Message:"); try { Reports.runtimescnshtpath = htmlDoc.DocumentNode.SelectSingleNode("//body//img").GetAttributeValue("src", ""); } catch (Exception) { Reports.runtimescnshtpath = ""; } if (StepDetailsArray.Length > 1) { Reports.errorMessage = StepDetailsArray[1]; } if (Reports.isWordReport) { WordReport.InsertWordResults(StepDetailsArray[0], Reports.GetEnumStatus(list.Value)); } if (Reports.isPdfReport) { PDFReport.InsertPDFResults(StepDetailsArray[0], Reports.GetEnumStatus(list.Value)); } Reports.errorMessage = null; Reports.runtimescnshtpath = null; } } if (Reports.isPdfReport) { PDFReport.PDFdocument.Close(); } if (Reports.isReuiredALMUpdates) { ALMQCIntegration.UpdateTestRunsInALMQC(); } BaseUtilities.featureFileName = null; BaseUtilities.scenarioStatus = null; BaseUtilities.testSetName = null; Reports.starttime = null; Reports.endtime = null; Reports.timetaken = null; BaseUtilities.scenarioName = null; } } } } }