Ejemplo n.º 1
0
        public static void LogTestCaseStart()
        {
            fileName = string.Concat(TestRun.GetCurrentTestResultDirectory(), "/", TestContext.CurrentContext.Test.Name, "_(TestCaseLog).txt");
            string entryText = string.Concat("TEST CASE STARTED: ", TestContext.CurrentContext.Test.Name);

            AppendTextToLog(entryText);
        }
        public static void Capture()
        {
            try
            {
                Screenshot screenShot = ((ITakesScreenshot)WebDriverHelper.Driver).GetScreenshot();

                string fileName = string.Concat(TestRun.GetCurrentTestResultDirectory(), "/", TestContext.CurrentContext.Test.Name, "_(Failure Screenshot).png");

                if (screenShot != null)
                {
                    screenShot.SaveAsFile(fileName, ScreenshotImageFormat.Png);
                    TestContext.AddTestAttachment(fileName);
                }
            }
            catch (Exception ex)
            {
                TestLogger.WriteToLog("Could not capture screenshot of the failure");
                TestLogger.WriteToLog(ex.Message);
            }
        }