Beispiel #1
0
        public void AfterStepMakeScreenShot()
        {
            Console.WriteLine("AfterStep");
            Thread.Sleep(TimeSpan.FromSeconds(1));
            var screenshotPathFile = setUp.MakeScreenshot(ScenarioContext.Current.StepContext.StepInfo.StepDefinitionType.ToString(), ScenarioContext.Current.ScenarioInfo.Title);

            CurrentTestContext.AddResultFile(screenshotPathFile);
        }
        public void AfterScenario()
        {
            try
            {
                if (!this.setUpDriver.IsDriverNull())
                {
                    if (ScenarioContext.Current.TestError != null)
                    {
                        // Take a screenshot.
                        var screenshotPathFile = this.setUpDriver.MakeScreenshot(ScenarioContext.Current.ScenarioInfo.Title);
                        CurrentTestContext.AddResultFile(screenshotPathFile);
                    }
                }

                this.setUpDriver.CloseDriver();
            }
            catch
            {
                this.setUpDriver.CloseDriver();
            }
        }