コード例 #1
0
    private void TakeScreenShot(ScreenShotHandler handler)
    {
        GUILayout.Space(50);
        GUILayout.BeginVertical();

        if (GUILayout.Button("Take Screenshot", GUILayout.Height(50)))
        {
            handler.TakeScreenShot();
        }

        GUILayout.EndVertical();
    }
コード例 #2
0
        public void AfterBaseTest()
        {
            try
            {
                var status     = TestContext.CurrentContext.Result.Outcome.Status;
                var stacktrace = string.IsNullOrEmpty(TestContext.CurrentContext.Result.StackTrace)
                        ? ""
                        : string.Format("{0}", TestContext.CurrentContext.Result.StackTrace);
                Status logstatus;

                switch (status)
                {
                case TestStatus.Failed:
                    logstatus = Status.Fail;
                    Test.AddScreenCaptureFromPath(ScreenShotHandler.TakeScreenShot(Driver));
                    break;

                case TestStatus.Inconclusive:
                    logstatus = Status.Warning;
                    break;

                case TestStatus.Skipped:
                    logstatus = Status.Skip;
                    break;

                default:
                    logstatus = Status.Pass;
                    break;
                }

                Test.Log(logstatus, "Test ended with " + logstatus + stacktrace);
            }
            catch (Exception e)
            {
                Test.Log(Status.Error, "Exception " + e.Message);
            }
            finally
            {
                LogApplitools();
                if (Driver != null)
                {
                    Driver.Quit();
                }
            }
        }