public static void UpdateDetailedSummary() { //set test summary switch (currentTemplate) { case AbtTemplates.DetailedReport: HtmlSummary = "<div>Steps Run:<a href=\"#\"><b>" + CurrentTestCase.StepsCompletedCount() + "</b></a>;</br>Steps Failures:<a href=\"#\"><b>" + CurrentTestCase.StepFailuresCount() + "</b></a></br>" + "Run Time:<b>" + CurrentTestCase.GetRunTime() + "</b></br>" + "Response Time:<b>" + CurrentTestCase.GetResponseTime() + "</b></div>"; HtmlReport[HtmlHeader.Count + 1] = HtmlSummary; break; case AbtTemplates.OktaPageResponse: HtmlSummary = "<div>Steps Run:<a href=\"#\"><b>" + CurrentTestCase.StepsCompletedCount() + "</b></a>;</br>Steps Failures:<a href=\"#\"><b>" + CurrentTestCase.StepFailuresCount() + "</b></a></br>" + "Run Time:<b>" + CurrentTestCase.GetRunTime() + "</b></br>" + "Response Time:<b>" + CurrentTestCase.GetResponseTime() + "</b></div>"; HtmlReport[HtmlHeader.Count + 1] = HtmlSummary; break; default: break; } }
public static void ReportTestOutcome(string screenshotPath) { var status = MyTestContext.Result.Outcome.Status; switch (status) { case TestStatus.Failed: MyLogger.Error($"Test failed => {MyTestContext.Test.Name}"); CurrentTestCase.AddScreenCaptureFromPath(screenshotPath); CurrentTestCase.Fail("Fail"); break; case TestStatus.Inconclusive: CurrentTestCase.AddScreenCaptureFromPath(screenshotPath); CurrentTestCase.Warning("Inconclusive"); break; case TestStatus.Skipped: CurrentTestCase.Skip("Test skipped"); break; default: CurrentTestCase.Pass("Pass"); break; } ReportManager.Flush(); }
public void Init() { _web = new WebInteraction(CurrentTestCase.TestCaseResult.LogPosts, new SeleniumTafDriver(CurrentTestCase.TestCaseResult.LogPosts, new ChromeDriver())); CurrentTestCase.AddReport(new TestCaseExecutionPlainTextReport()); CurrentTestCase.AddReport(new TestCaseHtmlReport()); }
private static void CreateInitialHtmlSteps() { for (int i = 0; i < CurrentTestCase.GetSteps().Count(); i++) { var step = "<tr ><td style=\"white - space:nowrap\">" + CurrentTestCase.GetSteps()[i].description + "</td><td style=\"white - space:nowrap\">" + CurrentTestCase.GetSteps()[i].status + "</td><td style =\"white-space:nowrap\">" + CurrentTestCase.GetSteps()[i].RunTime + "</td><td style =\"white-space:nowrap\">" + CurrentTestCase.GetSteps()[i].details + "</td></tr>"; HtmlReport[HtmlHeader.Count + 3 + i] = step; } }
private static void LoadTestCase(string testCasePath) { StreamReader file = new StreamReader(testCasePath); string line; while ((line = file.ReadLine()) != null) { CurrentTestCase.AddStep(line); } }
public void Init() { _web = new WebInteraction(CurrentTestCase.TestCaseResult.LogPostList, new SeleniumTafDriver(CurrentTestCase.TestCaseResult.LogPostList, new ChromeDriver())); CurrentTestCase.AddReport(new TestCaseExecutionPlainTextReport()); CurrentTestCase.AddReport(new TestCaseHtmlReport()); CurrentTestCase.Log(new LogPost.LogPostInfo("Browse to Skogsvårdsportalen")); _web.Navigate("https://skogsvardtestintern.sveaskog.se"); }
private static void SetHtmlHeader(string templatePath) { //loads the html header // StreamReader file = new StreamReader(templatePath); HtmlHeader = HtmlRepository.GetAbtHtmlHeader(); HtmlReport = new string[HtmlHeader.Count + CurrentTestCase.StepCount() + 4]; //the lines in htmlheader+line per step+line for title+line for html summary+line for html body+ending tags HtmlHeader.CopyTo(0, HtmlReport, 0, HtmlHeader.Count); //set the test title HtmlTestName = "<h1>" + CurrentTestCase.GetName() + "</h1>"; HtmlReport[HtmlHeader.Count()] = HtmlTestName; }
public static void UpdateHtmlStep(int stepPosition) { //Update Step Data if (CurrentTestCase.GetSteps()[stepPosition].status.Equals("Passed")) { var step = "<tr class=\"success\"><td style=\"white-space:nowrap\">" + CurrentTestCase.GetSteps()[stepPosition].description + "</td><td style=\"white-space:nowrap\">" + CurrentTestCase.GetSteps()[stepPosition].status + "</td><td style =\"white-space:nowrap\">" + CurrentTestCase.GetSteps()[stepPosition].RunTime + "</td><td style =\"white-space:nowrap\">" + CurrentTestCase.GetSteps()[stepPosition].details + "</td></tr>"; HtmlReport[HtmlHeader.Count + 3 + stepPosition] = step; } if (CurrentTestCase.GetSteps()[stepPosition].status.Equals("Failed")) { var step = "<tr class=\"danger\"><td style=\"white-space:nowrap\">" + CurrentTestCase.GetSteps()[stepPosition].description + "</td><td style=\"white-space:nowrap\">" + CurrentTestCase.GetSteps()[stepPosition].status + "</td><td style =\"white-space:nowrap\">" + CurrentTestCase.GetSteps()[stepPosition].RunTime + "</td><td style =\"white-space:nowrap\">" + CurrentTestCase.GetSteps()[stepPosition].details + "</td></tr>"; HtmlReport[HtmlHeader.Count + 3 + stepPosition] = step; } if (CurrentTestCase.GetSteps()[stepPosition].status.Equals("Not Run")) { var step = "<tr><td style=\"white-space:nowrap\">" + CurrentTestCase.GetSteps()[stepPosition].description + "</td><td style=\"white - space:nowrap\">" + CurrentTestCase.GetSteps()[stepPosition].status + "</td><td style =\"white-space:nowrap\">" + CurrentTestCase.GetSteps()[stepPosition].RunTime + "</td><td style =\"white-space:nowrap\">" + CurrentTestCase.GetSteps()[stepPosition].details + "</td></tr>"; HtmlReport[HtmlHeader.Count + 3 + stepPosition] = step; } }
public static void PrintTestCaseSteps() { CurrentTestCase.PrintSteps(); }
public static void LogPassingTestStep(string message) { MyLogger.Info(message); CurrentTestCase.Log(Status.Pass, message); }
private static void LogInfoMessage(Status status, string message) { MyLogger.Info(message); CurrentTestCase.Log(status, message); }