public void OnSpecificationEnd(SpecificationInfo specification, Result result)
        {
            string specName = GetContextSpecName(_currentContext, specification);

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

            case Status.Failing:
                _messageProvider.TestFailed(specName,
                                            result.Exception.Message,
                                            result.Exception.StackTrace,
                                            result.Exception.FullTypeName);
                break;

            case Status.Ignored:
                _messageProvider.TestIgnored(specName, null);
                break;

            case Status.NotImplemented:
                _messageProvider.TestIgnored(specName, "Not implemented");
                break;

            default:
                break;
            }

            _messageProvider.TestFinished(specName);
        }
		static void RecurseNameSpaces(ReportNamespace reportNamespace, ITeamCityMessageProvider messageProvider)
		{
			foreach (ReportFixture reportFixture in reportNamespace.Fixtures)
			{
				foreach (ReportRun run in reportFixture.Runs)
				{
					messageProvider.TestStarted(run.Name);

					if (run.Result == ReportRunResult.Ignore || run.Result == ReportRunResult.Skip)
					{
						messageProvider.TestIgnored(run.Name, run.Result.ToString());
					}
					else if (run.Result == ReportRunResult.Failure)
					{
						ExceptionInfo exceptionInfo = GetExceptionInfo(run.Exception);

						messageProvider.TestFailed(run.Name, exceptionInfo);
					}

					if (!string.IsNullOrEmpty(run.ConsoleOut))
					{
						messageProvider.TestOutputStream(run.Name, run.ConsoleOut);
					}
					if (!string.IsNullOrEmpty(run.ConsoleError))
					{
						messageProvider.TestErrorStream(run.Name, run.ConsoleError);
					}

					messageProvider.TestFinished(run.Name, TimeSpan.FromSeconds(run.Duration));
				}
			}

			foreach (ReportNamespace child in reportNamespace.Namespaces)
			{
				RecurseNameSpaces(child, messageProvider);
			}
		}
Exemple #3
0
        static void RecurseNameSpaces(ReportNamespace reportNamespace, ITeamCityMessageProvider messageProvider)
        {
            foreach (ReportFixture reportFixture in reportNamespace.Fixtures)
            {
                foreach (ReportRun run in reportFixture.Runs)
                {
                    messageProvider.TestStarted(run.Name);

                    if (run.Result == ReportRunResult.Ignore || run.Result == ReportRunResult.Skip)
                    {
                        messageProvider.TestIgnored(run.Name, run.Result.ToString());
                    }
                    else if (run.Result == ReportRunResult.Failure)
                    {
                        ExceptionInfo exceptionInfo = GetExceptionInfo(run.Exception);

                        messageProvider.TestFailed(run.Name, exceptionInfo);
                    }

                    if (!string.IsNullOrEmpty(run.ConsoleOut))
                    {
                        messageProvider.TestOutputStream(run.Name, run.ConsoleOut);
                    }
                    if (!string.IsNullOrEmpty(run.ConsoleError))
                    {
                        messageProvider.TestErrorStream(run.Name, run.ConsoleError);
                    }

                    messageProvider.TestFinished(run.Name, TimeSpan.FromSeconds(run.Duration));
                }
            }

            foreach (ReportNamespace child in reportNamespace.Namespaces)
            {
                RecurseNameSpaces(child, messageProvider);
            }
        }