public void TearDownTest() { bool videoRecordEnabled = false; try { videoRecordEnabled = ConfigurationManager.AppSettings["VIDEO_RECORDING_ENABLED"].Equals("1"); if (videoRecordEnabled) { VideoRecorder.EndRecording(); } //Prepara result block para o report string testResult = String.Format("<p>{0}</p>", TestContext.CurrentContext.Result.Message); var status = TestContext.CurrentContext.Result.Outcome.Status; string stackTrace = String.Format("<p>{0}</p>", TestContext.CurrentContext.Result.StackTrace); string screenshotBytes = ScreenShot.CaptureAsBase64EncodedString(); string imgTag = "<br/>" + "<img src='data:image/jpg; base64, " + screenshotBytes + "' " + "style='width:100%'>"; string fullTestResult = testResult + stackTrace + imgTag; if (ConfigurationManager.AppSettings["VIDEO_RECORDING_ENABLED"].Equals("1")) { string videoTag = "<br/>" + "<video controls style='width:100%'> " + "<source type='video/mp4' src='data:video/mp4;base64," + VideoRecorder.GetVideoRecordedAsBase64StringAndDeleteLocalFile() + "'> " + "</video>"; fullTestResult += videoTag; } switch (status) { case NUnit.Framework.Interfaces.TestStatus.Failed: Reporter.GetInstance().FailTest(fullTestResult); Reporter.GetInstance().failedTests++; break; default: Reporter.GetInstance().PassTest(fullTestResult); Reporter.GetInstance().passedTests++; break; } WebDriverHooks.Driver.Quit(); } catch (ConfigurationErrorsException) { } }