コード例 #1
0
 public void OnSpecificationStart(SpecificationInfo specification)
 {
   if (!_specificationTimer.IsRunning)
   {
     _specificationTimer.Restart();
   }
 }
        public TestResult GetVisualStudioTestResult(ContextInfo context, SpecificationInfo specification, Result result)
        {
            var vsResult = new TestResult(GetVisualStudioTest(context, specification));
            switch (result.Status)
            {
                case Status.Failing:
                    vsResult.Outcome = TestOutcome.Failed;
                    vsResult.ErrorMessage = result.Exception.Message;
                    vsResult.ErrorStackTrace = result.Exception.StackTrace;
                    break;
                case Status.Passing:
                    vsResult.Outcome = TestOutcome.Passed;
                    break;
                case Status.NotImplemented:
                    vsResult.Outcome = TestOutcome.NotFound;
                    break;
                case Status.Ignored:
                    vsResult.Outcome = TestOutcome.Skipped;
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }

            vsResult.Messages.Add(context.CapturedOutput);
            vsResult.Messages.Add(specification.CapturedOutput);
            return vsResult;
        }
コード例 #3
0
 public void Passing(SpecificationInfo specification)
 {
     Color(ConsoleColor.Green, () =>
     {
         inner.SpecificationStart(specification);
         inner.Passing(specification);
     });
 }
コード例 #4
0
 public void Ignored(SpecificationInfo specification)
 {
     Color(ConsoleColor.Yellow, () =>
     {
         inner.SpecificationStart(specification);
         inner.Ignored(specification);
     });
 }
コード例 #5
0
 public void Failed(SpecificationInfo specification, Result result)
 {
     Color(ConsoleColor.Red, () =>
     {
         inner.SpecificationStart(specification);
         inner.Failed(specification, result);
     });
 }
コード例 #6
0
 public void NotImplemented(SpecificationInfo specification)
 {
     Color(ConsoleColor.Gray, () =>
     {
         inner.SpecificationStart(specification);
         inner.NotImplemented(specification);
     });
 }
コード例 #7
0
        public void OnSpecificationStart(SpecificationInfo specification)
        {
            string specificationName  = specification.FieldName;
            string fullyQualifiedName = string.Format("{0}::{1}", specification.ContainingType, (object)specificationName);
            string displayName        = specificationName.Replace("_", " ");

            this.RecordStart(fullyQualifiedName, displayName);
            this.currentRunStats = new RunStats();
        }
コード例 #8
0
        public long GetSpecificationTime(SpecificationInfo specificationInfo)
        {
            if (_specificationTimes.ContainsKey(specificationInfo))
            {
                return(_specificationTimes[specificationInfo]);
            }

            return(-1);
        }
コード例 #9
0
        public void OnSpecificationStart(SpecificationInfo specification)
        {
            if (listenFor != null && !listenFor.Equals(specification.ToVisualStudioTestIdentifier(currentContext)))
            {
                return;
            }

            runListener.OnSpecificationStart(specification);
        }
コード例 #10
0
    public long GetSpecificationTime(SpecificationInfo specificationInfo)
    {
      if (_specificationTimes.ContainsKey(specificationInfo))
      {
        return _specificationTimes[specificationInfo];
      }

      return -1;
    }
コード例 #11
0
        public void OnSpecificationStart(SpecificationInfo specification)
        {
            _specifications += 1;

            _specificationOutput = new RedirectOutput();

            var notify = CreateTaskNotificationFor(specification, _currentContext);

            notify(task => _server.TaskStarting(task));
        }
コード例 #12
0
        public override void OnSpecificationStart(SpecificationInfo specification)
        {
            _listener.OnSpecificationStart(specification);

            ITestCommand specCommand = _commandsBySpec[specification.Name];
            ITestContext specContext = specCommand.StartPrimaryChildStep(_testContext.TestStep);

            _contextsBySpec.Add(specification.Name, specContext);

            specContext.LifecyclePhase = LifecyclePhases.Starting;
            _progressMonitor.SetStatus("» " + specification.Name);
        }
        public void OnSpecificationEnd(SpecificationInfo specification, Result result)
        {
            if (this.currentRunStats != null)
            {
                this.currentRunStats.Stop();
            }

            TestCase testCase = ConvertSpecificationToTestCase(specification, this.settings);

            this.frameworkHandle.RecordEnd(testCase, MapSpecificationResultToTestOutcome(result));
            this.frameworkHandle.RecordResult(ConverResultToTestResult(testCase, result, this.currentRunStats));
        }
コード例 #14
0
 void UpdateTestIgnored(SpecificationInfo specification, long executionTime)
 {
     _writer(string.Format("\x1B[33m* {0} (IGNORED)\x1B[39m", specification.Name)); // yellow
     _apiClient.UpdateTest(GetSpecificationName(specification),
                           FrameworkName,
                           _currentAssembly.Name,
                           "Skipped",
                           executionTime,
                           null,
                           null,
                           null,
                           null);
 }
コード例 #15
0
 void UpdateTestNotImplemented(SpecificationInfo specification, long executionTime)
 {
     _writer(string.Format("\x1B[90m* {0} (NOT IMPLEMENTED)\x1B[39m", specification.Name)); // gray
     _apiClient.UpdateTest(GetSpecificationName(specification),
                           FrameworkName,
                           _currentAssembly.Name,
                           "NotImplemented",
                           executionTime,
                           null,
                           null,
                           null,
                           null);
 }
コード例 #16
0
 void UpdateTestPassed(SpecificationInfo specification, long executionTime)
 {
     _writer(string.Format("\x1B[32m* {0}\x1B[39m", specification.Name)); // green
     _apiClient.UpdateTest(GetSpecificationName(specification),
                           FrameworkName,
                           _currentAssembly.Name,
                           "Passed",
                           executionTime,
                           null,
                           null,
                           specification.CapturedOutput,
                           null);
 }
コード例 #17
0
        public void RecordFailure(ContextInfo context, SpecificationInfo specification, Result result)
        {
            if (!_failures.ContainsKey(context))
            {
                _failures.Add(context, new List <FailedSpecification>());
            }

            var entry = _failures[context];

            entry.Add(new FailedSpecification {
                Specification = specification, Result = result
            });
        }
        public void OnSpecificationStart(SpecificationInfo specificationInfo)
        {
            var task = _context.GetBehaviorTask(_currentContext, specificationInfo) ??
                       _context.GetSpecificationTask(specificationInfo);

            if (task == null)
            {
                return;
            }

            _server.TaskStarting(task);

            _specifications += 1;
        }
コード例 #19
0
 private void UpdateTestPassed(SpecificationInfo specification, long executionTime)
 {
     writer($"\x1B[32m* {specification.Name}\x1B[39m"); // green
     apiClient.UpdateTest(
         GetSpecificationName(specification),
         FrameworkName,
         currentAssembly.Name,
         "Passed",
         executionTime,
         null,
         null,
         specification.CapturedOutput,
         null);
 }
コード例 #20
0
 private void UpdateTestIgnored(SpecificationInfo specification, long executionTime)
 {
     writer($"\x1B[33m* {specification.Name} (IGNORED)\x1B[39m"); // yellow
     apiClient.UpdateTest(
         GetSpecificationName(specification),
         FrameworkName,
         currentAssembly.Name,
         "Skipped",
         executionTime,
         null,
         null,
         null,
         null);
 }
コード例 #21
0
 private void UpdateTestNotImplemented(SpecificationInfo specification, long executionTime)
 {
     writer($"\x1B[90m* {specification.Name} (NOT IMPLEMENTED)\x1B[39m"); // gray
     apiClient.UpdateTest(
         GetSpecificationName(specification),
         FrameworkName,
         currentAssembly.Name,
         "NotImplemented",
         executionTime,
         null,
         null,
         null,
         null);
 }
 public Test GetVisualStudioTest(ContextInfo context, SpecificationInfo specification)
 {
     var test = new Test();
     if (string.IsNullOrWhiteSpace(context.Concern))
     {
         // no function yet, because the Dnx Testing host has no support https://github.com/aspnet/Tooling/issues/182
         test.Properties["Category"] = context.Concern;
     }
     test.FullyQualifiedName =
         $"{context.AssemblyName}:{context.TypeName}.{specification.Leader} {specification.FieldName}";
     test.DisplayName = $"{context.Name} {specification.Leader} {specification.Name}";
     test.Id = GuidFromString(test.FullyQualifiedName);
     return test;
 }
コード例 #23
0
        static IEnumerable <Source> GetGroups(SpecificationInfo run)
        {
            var name = string.Format("{0} {1}", run.GroupName, run.CaseName);

            foreach (var @event in run.Given)
            {
                yield return(new Source(@event, name + " Given"));
            }
            yield return(new Source(run.When, name + " When"));

            foreach (var w in run.Then)
            {
                yield return(new Source(w, name + " Expect"));
            }
        }
コード例 #24
0
        public void OnSpecificationStart(SpecificationInfo specification)
        {
            _specificationTimer.Reset();
            _specificationTimer.Start();

            _apiClient.AddTest(GetSpecificationName(specification),
                               FrameworkName,
                               _currentAssembly.Name,
                               "Running",
                               null,
                               null,
                               null,
                               null,
                               null);
        }
コード例 #25
0
        public override void OnSpecificationStart(SpecificationInfo specification)
        {
            _specificationTimer.Reset();
            _specificationTimer.Start();

            _apiClient.AddTest(GetSpecificationName(specification),
                               FrameworkName,
                               _currentAssembly.Name,
                               "Running",
                               null,
                               null,
                               null,
                               null,
                               null);
        }
コード例 #26
0
        private void OnListenEvent(string value)
        {
            using (var stringReader = new StringReader(value)) {
                XDocument doc     = XDocument.Load(stringReader);
                XElement  element = doc.XPathSelectElement("/listener/*");

                switch (element.Name.ToString())
                {
                case "onassemblystart":
                    _runListener.OnAssemblyStart(AssemblyInfo.Parse(element.XPathSelectElement("//onassemblystart/*").ToString()));
                    break;

                case "onassemblyend":
                    _runListener.OnAssemblyEnd(AssemblyInfo.Parse(element.XPathSelectElement("//onassemblyend/*").ToString()));
                    break;

                case "onrunstart":
                    _runListener.OnRunStart();
                    break;

                case "onrunend":
                    _runListener.OnRunEnd();
                    break;

                case "oncontextstart":
                    _runListener.OnContextStart(ContextInfo.Parse(element.XPathSelectElement("//oncontextstart/*").ToString()));
                    break;

                case "oncontextend":
                    _runListener.OnContextEnd(ContextInfo.Parse(element.XPathSelectElement("//oncontextend/*").ToString()));
                    break;

                case "onspecificationstart":
                    _runListener.OnSpecificationStart(SpecificationInfo.Parse(element.XPathSelectElement("//onspecificationstart/*").ToString()));
                    break;

                case "onspecificationend":
                    _runListener.OnSpecificationEnd(
                        SpecificationInfo.Parse(element.XPathSelectElement("//onspecificationend/specificationinfo").ToString()),
                        Result.Parse(element.XPathSelectElement("//onspecificationend/result").ToString()));
                    break;

                case "onfatalerror":
                    _runListener.OnFatalError(ExceptionResult.Parse(element.XPathSelectElement("//onfatalerror/*").ToString()));
                    break;
                }
            }
        }
コード例 #27
0
 Action <Action <RemoteTask> > CreateTaskNotificationFor(SpecificationInfo specification)
 {
     return(actionToBePerformedForEachTask =>
     {
         foreach (var notification in _taskNotifications)
         {
             if (notification.Matches(specification))
             {
                 foreach (var task in notification.RemoteTasks)
                 {
                     actionToBePerformedForEachTask(task);
                 }
             }
         }
     });
 }
コード例 #28
0
        public void OnSpecificationEnd(SpecificationInfo specification, Result result)
        {
            this.currentRunStats.Stop();

            string specificationName  = specification.FieldName;
            string fullyQualifiedName = string.Format("{0}::{1}", specification.ContainingType, (object)specificationName);
            string displayName        = specificationName.Replace("_", " ");

            int testResult = this.GetVSTestOutcomeFromMSpecResult(result);

            this.RecordEnd(fullyQualifiedName, displayName, testResult);
            this.RecordResult(fullyQualifiedName, displayName, this.currentRunStats.StartTime, this.currentRunStats.EndTime,
                              result.Exception != null ? result.Exception.Message : string.Empty, result.Exception != null ? result.Exception.StackTrace : null, testResult);

            this.currentRunStats = null;
        }
コード例 #29
0
        public override void OnSpecificationEnd(SpecificationInfo specification, Result result)
        {
            _listener.OnSpecificationEnd(specification, result);

            ITestContext testContext = _contextsBySpec[specification.Name];

            testContext.LifecyclePhase = LifecyclePhases.Finishing;

            TestOutcome outcome;
            TimeSpan?   span = null;

            if (result.Status == Status.NotImplemented)
            {
                TestLog.Warnings.WriteLine("{0} ({1})", specification.Name, "NOT IMPLEMENTED");
                TestLog.Warnings.Flush();

                outcome = TestOutcome.Pending;
                span    = new TimeSpan(0);
            }
            else if (result.Status == Status.Ignored)
            {
                TestLog.Warnings.WriteLine("{0} ({1})", specification.Name, "IGNORED");
                TestLog.Warnings.Flush();

                outcome = TestOutcome.Ignored;
                span    = new TimeSpan(0);
            }
            else if (result.Passed)
            {
                outcome = TestOutcome.Passed;
            }
            else
            {
                TestLog.Failures.WriteException(Convert(result.Exception));
                TestLog.Failures.Flush();

                outcome = TestOutcome.Failed;
            }

            testContext.FinishStep(outcome, span);
            _outcome = _outcome.CombineWith(outcome);

            _progressMonitor.Worked(1);
        }
コード例 #30
0
        public void OnSpecificationEnd(SpecificationInfo specification, Machine.Specifications.Result result)
        {
            var test = new TestResult(
                "MSpec",
                _assembly,
                specification.ContainingType,
                DateTime.Now.Subtract(_start).TotalMilliseconds,
                specification.ContainingType,
                specification.ContainingType + "." + specification.FieldName,
                getState(result.Status),
                getMessage(result.Exception));

            test.AddStackLines(getStackLines(result.Exception));
            _results.Add(test);
            if (_feedback != null)
            {
                _feedback.TestFinished(test);
            }
        }
コード例 #31
0
        public void OnSpecificationEnd(SpecificationInfo specification, Result result)
        {
            var notify = CreateTaskNotificationFor(specification, _currentContext);

            notify(task => _server.TaskProgress(task, null));

            NotifyRedirectedOutput(notify, _specificationOutput);

            TaskResult taskResult = TaskResult.Success;
            string     message    = null;

            switch (result.Status)
            {
            case Status.Failing:
                _errors += 1;

                notify(task => _server.TaskExplain(task, result.Exception.Message));
                notify(task => _server.TaskException(task,
                                                     ExceptionResultConverter.ConvertExceptions(result.Exception, out message)));
                taskResult = TaskResult.Exception;
                break;

            case Status.Passing:
                _successes += 1;

                taskResult = TaskResult.Success;
                break;

            case Status.NotImplemented:
                notify(task => _server.TaskExplain(task, "Not implemented"));
                message    = "Not implemented";
                taskResult = TaskResult.Inconclusive;
                break;

            case Status.Ignored:
                notify(task => _server.TaskExplain(task, "Ignored"));
                taskResult = TaskResult.Skipped;
                break;
            }

            notify(task => _server.TaskFinished(task, message, taskResult));
        }
コード例 #32
0
ファイル: Goods.cs プロジェクト: hardweight/ShopBackend
        /// <summary>
        /// 更新单规格
        /// 因为当用户在前台下单订购时,数量也会变化。也就是数量可能会单独变化。
        /// 所以,我们考虑单独为数量的变化定义一个domain event。
        /// </summary>
        /// <param name="SpecificationInfo"></param>
        /// <param name="stock"></param>
        public void UpdateSpecification(Guid specificationId, SpecificationInfo specificationInfo, int stock)
        {
            var specification = _specifications.SingleOrDefault(x => x.Id == specificationId);

            if (specification == null)
            {
                throw new Exception("不存在该规格.");
            }
            ApplyEvent(new SpecificationUpdatedEvent(specificationId, specificationInfo));

            if (specification.Stock != stock)
            {
                var totalReservationQuantity = GetTotalReservationQuantity(specification.Id);
                if (stock < totalReservationQuantity)
                {
                    throw new Exception(string.Format("库存数量不能小于已预定数量:{0}", totalReservationQuantity));
                }
                ApplyEvent(new SpecificationStockChangedEvent(specificationId, stock, stock - totalReservationQuantity));
            }
        }
 public void OnSpecificationEnd(SpecificationInfo specification, Result result)
 {
     switch (result.Status)
     {
         case Status.Failing:
             write.Failed(specification,result);
             break;
         case Status.Passing:
             write.Passing(specification);
             break;
         case Status.NotImplemented:
             write.NotImplemented(specification);
             break;
         case Status.Ignored:
             write.Ignored(specification);
             break;
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
コード例 #34
0
        private void RenderSpecification(XmlWriter reportBuilder, ContextInfo context, SpecificationInfo specification)
        {
            reportBuilder.WriteStartElement("testcase");
            reportBuilder.WriteAttributeString("classname", string.Format("{0}.{1}",context.AssemblyName, context.Concern));
            reportBuilder.WriteAttributeString("name", string.Format("{0}, {1}", context.Name, specification.Name));

            Result result;
            if(ResultsBySpecification.TryGetValue(specification, out result))
            {
                switch(result.Status)
                {
                    case Status.Failing:
                        reportBuilder.WriteStartElement("failure");
                        reportBuilder.WriteAttributeString("type", result.Exception.TypeName);
                        reportBuilder.WriteCData(result.Exception.ToString());
                        reportBuilder.WriteEndElement();
                        break;
                }
            }
            reportBuilder.WriteEndElement();
        }
コード例 #35
0
        Action <Action <RemoteTask> > CreateTaskNotificationFor(SpecificationInfo specification)
        {
            return(actionToBePerformedForEachTask =>
            {
                foreach (var notification in _taskNotifications)
                {
                    if (notification.Matches(specification))
                    {
                        Debug.WriteLine(String.Format("Notifcation for {0} {1}, with {2} remote tasks",
                                                      specification.ContainingType,
                                                      specification.FieldName,
                                                      notification.RemoteTasks.Count()));

                        foreach (var task in notification.RemoteTasks)
                        {
                            actionToBePerformedForEachTask(task);
                        }
                    }
                }
            });
        }
コード例 #36
0
        public override void OnSpecificationEnd(SpecificationInfo specification, Result result)
        {
            _specificationTimer.Stop();
            long duration = _specificationTimer.ElapsedMilliseconds;

            switch (result.Status)
            {
                case Status.Passing:
                    UpdateTestPassed(specification, duration);
                    break;
                case Status.NotImplemented:
                    UpdateTestNotImplemented(specification, duration);
                    break;
                case Status.Ignored:
                    UpdateTestIgnored(specification, duration);
                    break;
                default:
                    UpdateTestFailed(specification, duration, result.Exception);
                    _failureOccurred = true;
                    break;
            }
        }
コード例 #37
0
        public void OnSpecificationEnd(SpecificationInfo specification, Result result)
        {
            var notify = CreateTaskNotificationFor(specification);

            notify(task => _server.TaskProgress(task, null));

            notify(task => _server.TaskOutput(task, result.ConsoleOut, TaskOutputType.STDOUT));
            notify(task => _server.TaskOutput(task, result.ConsoleError, TaskOutputType.STDERR));

            TaskResult taskResult = TaskResult.Success;
            string     message    = null;

            switch (result.Status)
            {
            case Status.Failing:
                notify(task => _server.TaskExplain(task, result.Exception.Message));
                notify(task => _server.TaskException(task,
                                                     ExceptionResultConverter.ConvertExceptions(result.Exception, out message)));
                taskResult = TaskResult.Exception;
                break;

            case Status.Passing:
                taskResult = TaskResult.Success;
                break;

            case Status.NotImplemented:
                notify(task => _server.TaskExplain(task, "Not implemented"));
                message    = "Not implemented";
                taskResult = TaskResult.Skipped;
                break;

            case Status.Ignored:
                notify(task => _server.TaskExplain(task, "Ignored"));
                taskResult = TaskResult.Skipped;
                break;
            }

            notify(task => _server.TaskFinished(task, message, taskResult));
        }
コード例 #38
0
        public void OnSpecificationEnd(SpecificationInfo specification, Result result)
        {
            _specificationCount++;

            switch (result.Status)
            {
            case Status.Passing:
                _passedSpecificationCount++;
                break;

            case Status.NotImplemented:
                _unimplementedSpecificationCount++;
                _task.Log(Level.Verbose, "      (NOT IMPLEMENTED)");
                break;

            case Status.Ignored:
                _ignoredSpecificationCount++;
                _task.Log(Level.Verbose, "      (IGNORED)");
                break;

            default:
                _failedSpecificationCount++;

                StringBuilder line = new StringBuilder();

                if (!_task.Verbose)
                {
                    // If the task is not verbose, we did not log the specification start, so we include it here.
                    line.AppendLine(GetContextSpecNameWithFormat(_currentContext, specification));
                }

                line.AppendLine("      (FAIL)");
                line.AppendLine(result.Exception.ToString());

                _task.Log(Level.Error, line.ToString());
                break;
            }
        }
コード例 #39
0
        void UpdateTestFailed(SpecificationInfo specification, long executionTime, ExceptionResult exceptionResult = null)
        {
            _writer(string.Format("\x1B[31m* {0} (FAILED)\x1B[39m", specification.Name)); // red

            string errorMessage    = null;
            string errorStackTrace = null;

            if (exceptionResult != null)
            {
                errorMessage    = exceptionResult.Message;
                errorStackTrace = exceptionResult.ToString();
            }

            _apiClient.UpdateTest(GetSpecificationName(specification),
                                  FrameworkName,
                                  _currentAssembly.Name,
                                  "Failed",
                                  executionTime,
                                  errorMessage,
                                  errorStackTrace,
                                  specification.CapturedOutput,
                                  null);
        }
コード例 #40
0
 public virtual void OnSpecificationEnd(SpecificationInfo specification, Result result)
 {
 }
コード例 #41
0
 public virtual void OnSpecificationStart(SpecificationInfo specification)
 {
 }
コード例 #42
0
 void UpdateTestPassed(SpecificationInfo specification, long executionTime)
 {
     _writer(string.Format("\x1B[32m* {0}\x1B[39m", specification.Name)); // green
     _apiClient.UpdateTest(GetSpecificationName(specification),
                           FrameworkName,
                           _currentAssembly.Name,
                           "Passed",
                           executionTime,
                           null,
                           null,
                           specification.CapturedOutput,
                           null);
 }
 public void OnSpecificationStart(SpecificationInfo specification)
 {
     write.SpecificationStart(specification);
 }
コード例 #44
0
 protected string GetSpecificationName(SpecificationInfo specification)
 {
     return(_currentContext + " > " + specification.Name);
 }
コード例 #45
0
 public override void OnSpecificationEnd(SpecificationInfo specification, Result result)
 {
   _state.TearDownSpecification(specification);
 }
コード例 #46
0
 void UpdateTestNotImplemented(SpecificationInfo specification, long executionTime)
 {
     _writer(string.Format("\x1B[90m* {0} (NOT IMPLEMENTED)\x1B[39m", specification.Name)); // gray
     _apiClient.UpdateTest(GetSpecificationName(specification),
                           FrameworkName,
                           _currentAssembly.Name,
                           "NotImplemented",
                           executionTime,
                           null,
                           null,
                           null,
                           null);
 }
 public void OnSpecificationStart(SpecificationInfo specification)
 {
     if (currentContext == null) return;
     sink?.RecordStart(converter.GetVisualStudioTest(currentContext, specification));
 }
 public void OnSpecificationEnd(SpecificationInfo specification, Result result)
 {
     if (currentContext == null) return;
     sink?.RecordResult(converter.GetVisualStudioTestResult(currentContext, specification, result));
 }
コード例 #49
0
        public void OnSpecificationStart(SpecificationInfo specification)
        {
            var root = new XElement("listener", new XElement("onspecificationstart", specification.ToXml()));

            this._listener.SyncProcessMessage(new RemoteListenerMessage(root));
        }
コード例 #50
0
 public void OnSpecificationEnd(SpecificationInfo specification, Result result)
 {
   _listeners.ForEach(listener => listener.OnSpecificationEnd(specification, result));
 }
コード例 #51
0
        public void OnSpecificationEnd(SpecificationInfo specification, Result result)
        {
            var root = new XElement("listener", new XElement("onspecificationend", specification.ToXml(), result.ToXml()));

            this._listener.SyncProcessMessage(new RemoteListenerMessage(root));
        }
コード例 #52
0
 protected string GetSpecificationName(SpecificationInfo specification)
 {
     return _currentContext + " » " + specification.Name;
 }
コード例 #53
0
 public void OnSpecificationEnd(SpecificationInfo specification, Result result)
 {
   _specificationTimer.Stop();
   _specificationTimes[specification] = _specificationTimer.ElapsedMilliseconds;
 }
コード例 #54
0
 public void OnSpecificationStart(SpecificationInfo specification)
 {
   _listener.OnSpecificationStart(specification);
 }
コード例 #55
0
 public void OnSpecificationStart(SpecificationInfo specification)
 {
   _listeners.ForEach(listener => listener.OnSpecificationStart(specification));
 }
コード例 #56
0
 public void OnSpecificationEnd(SpecificationInfo specification, Result result)
 {
   _listener.OnSpecificationEnd(specification, result);
 }
コード例 #57
0
        public void OnSpecificationEnd(SpecificationInfo specification, Result result)
        {
            var root = new XElement("listener", new XElement("onspecificationend", specification.ToXml(), result.ToXml()));

            SendMessage(root);
        }
コード例 #58
0
        void UpdateTestFailed(SpecificationInfo specification, long executionTime, ExceptionResult exceptionResult = null)
        {
            _writer(string.Format("\x1B[31m* {0} (FAILED)\x1B[39m", specification.Name)); // red

            string errorMessage = null;
            string errorStackTrace = null;
            if (exceptionResult != null)
            {
                errorMessage = exceptionResult.Message;
                errorStackTrace = exceptionResult.ToString();
            }

            _apiClient.UpdateTest(GetSpecificationName(specification),
                                  FrameworkName,
                                  _currentAssembly.Name,
                                  "Failed",
                                  executionTime,
                                  errorMessage,
                                  errorStackTrace,
                                  specification.CapturedOutput,
                                  null);
        }
コード例 #59
0
 public void OnSpecificationStart(SpecificationInfo specification)
 {
     _writer.WriteTestStarted(GetSpecificationName(specification), false);
 }
コード例 #60
0
 void UpdateTestIgnored(SpecificationInfo specification, long executionTime)
 {
     _writer(string.Format("\x1B[33m* {0} (IGNORED)\x1B[39m", specification.Name)); // yellow
     _apiClient.UpdateTest(GetSpecificationName(specification),
                           FrameworkName,
                           _currentAssembly.Name,
                           "Skipped",
                           executionTime,
                           null,
                           null,
                           null,
                           null);
 }