private void FindElementCompletedHandler(object sender, FindElementEventArgs e) { if (e.Element != null) { report.Report("Found element with tag: " + e.Element.TagName); } }
public void TestFinished(TestResult result) { switch (result.ResultState) { case ResultState.Error: { testInfo.Status = ReporterTestInfo.TestStatus.error; report.Report(result.Message, result.StackTrace, ReporterTestInfo.TestStatus.error); break; } case ResultState.Success: { testInfo.Status = ReporterTestInfo.TestStatus.success; break; } case ResultState.Failure: { testInfo.Status = ReporterTestInfo.TestStatus.failure; report.Report(result.Message, result.StackTrace, ReporterTestInfo.TestStatus.failure); break; } default: { testInfo.Status = ReporterTestInfo.TestStatus.warning; break; } } testStopwatch.Stop(); testInfo.DurationTime = testStopwatch.ElapsedMilliseconds; report.EndTest(testInfo); }
public bool Click(string locator, int timeout) { // Reporting the action is important, report can be made more specific Report.Report($"Clicking element at {locator}"); // We'll need to use explicit waiting to ensure the clicked object has the chance to load WebDriverWait wait = new WebDriverWait(InnerDriver, TimeSpan.FromSeconds(timeout)); try { wait.Until(d => d.FindElement(By.XPath(locator))).Click(); return(true); } catch { Report.Report("Click failed"); //Optionally - can fail the test by setting status to failure/error - see DifidoReportsReference return(false); } }
public void AfterAll() { TestContext.ResultAdapter resultAdapter = TestContext.CurrentContext.Result; if (resultAdapter.Outcome == ResultState.Success && (testInfo.Status == DifidoTestStatus.failure || testInfo.Status == DifidoTestStatus.error)) { testStopwatch.Stop(); testInfo.DurationTime = testStopwatch.ElapsedMilliseconds; report.EndTest(testInfo); Assert.Fail("Test failed. See reports above for details."); } if (resultAdapter.Outcome == ResultState.Success) { testInfo.Status = DifidoTestStatus.success; } else if (resultAdapter.Outcome == ResultState.Error) { testInfo.Status = DifidoTestStatus.error; report.Report(resultAdapter.Message, resultAdapter.StackTrace, DifidoTestStatus.error); } else if (resultAdapter.Outcome == ResultState.Failure) { testInfo.Status = DifidoTestStatus.failure; report.Report(resultAdapter.Message, resultAdapter.StackTrace, DifidoTestStatus.failure); } else { testInfo.Status = DifidoTestStatus.warning; } testStopwatch.Stop(); testInfo.DurationTime = testStopwatch.ElapsedMilliseconds; report.EndTest(testInfo); }
public void SimpleReport() { report.Report("My very simple report"); }
public void SimpleReport() { Report.Report("This is a simple report example"); }