Пример #1
0
        private TestResult SkipTest()
        {
            TestResult testResult = new TestResult(this);

            switch (this.RunState)
            {
            case RunState.Skipped:
            default:
                testResult.Skip(IgnoreReason);
                break;

            case RunState.NotRunnable:
                if (BuilderException != null)
                {
                    testResult.Invalid(BuilderException);
                }
                else
                {
                    testResult.Invalid(IgnoreReason);
                }
                break;

            case RunState.Ignored:
                testResult.Ignore(IgnoreReason);
                break;
            }

            return(testResult);
        }
Пример #2
0
        public override TestResult Run(EventListener listener, ITestFilter filter)
        {
            using (new global::NUnit.Core.TestContext())
            {
                var testResult = new TestResult(this);
                Log.Debug("Test Starting: " + TestName.FullName);
                listener.TestStarted(TestName);
                var stopwatch = new Stopwatch();
                stopwatch.Start();

                switch (RunState)
                {
                    case RunState.Runnable:
                    case RunState.Explicit:
                        DoTest(_test, testResult);
                        break;
                    case RunState.NotRunnable:
                        testResult.Invalid(IgnoreReason);
                        break;
                    case RunState.Ignored:
                        testResult.Ignore(IgnoreReason);
                        break;
                    default:
                        testResult.Skip(IgnoreReason);
                        break;

                }

                stopwatch.Stop();
                testResult.Time = stopwatch.Elapsed.Seconds;

                listener.TestFinished(testResult);
                return testResult;
            }
        }
Пример #3
0
        public override TestResult Run(EventListener listener, ITestFilter filter)
        {
            using (new TestContext())
            {
                TestResult testResult = new TestResult(this);

                ContextDictionary context = Context;
                context._testResult   = testResult;
                context["TestName"]   = this.TestName.Name;
                context["Properties"] = this.Properties;

                CallContext.SetData("NUnit.Framework.TestContext", context);

                log.Debug("Test Starting: " + this.TestName.FullName);
                listener.TestStarted(this.TestName);
                long startTime = DateTime.Now.Ticks;

                switch (this.RunState)
                {
                case RunState.Runnable:
                case RunState.Explicit:
                    Run(testResult);
                    break;

                case RunState.Skipped:
                default:
                    testResult.Skip(IgnoreReason);
                    break;

                case RunState.NotRunnable:
                    if (BuilderException != null)
                    {
                        testResult.Invalid(BuilderException);
                    }
                    else
                    {
                        testResult.Invalid(IgnoreReason);
                    }
                    break;

                case RunState.Ignored:
                    testResult.Ignore(IgnoreReason);
                    break;
                }

                long   stopTime = DateTime.Now.Ticks;
                double time     = ((double)(stopTime - startTime)) / (double)TimeSpan.TicksPerSecond;
                testResult.Time = time;

                listener.TestFinished(testResult);
                return(testResult);
            }
        }
Пример #4
0
		private TestResult SkipTest()
		{
			TestResult testResult = new TestResult(this);
			
            switch (this.RunState)
            {
                case RunState.Skipped:
                default:
                    testResult.Skip(IgnoreReason);
                    break;
                case RunState.NotRunnable:
                    if (BuilderException != null)
                        testResult.Invalid(BuilderException);
                    else
                        testResult.Invalid(IgnoreReason);
                    break;
                case RunState.Ignored:
                    testResult.Ignore(IgnoreReason);
                    break;
            }
			
			return testResult;
		}
		public void SetResult_Skipped()
		{
			TestSuiteTreeNode node = new TestSuiteTreeNode( testCaseInfo );
			TestResult result = new TestResult( testCaseInfo );

            result.Skip("");
			node.Result = result;
			Assert.AreEqual( TestSuiteTreeNode.SkippedIndex, node.ImageIndex );
			Assert.AreEqual( TestSuiteTreeNode.SkippedIndex, node.SelectedImageIndex );
			Assert.AreEqual( "Skipped", node.StatusText );
		}
Пример #6
0
 private void SkipAllTests(TestResult suiteResult, EventListener listener, ITestFilter filter)
 {
     suiteResult.Skip(this.IgnoreReason);
     MarkTestsNotRun(this.Tests, ResultState.Skipped, this.IgnoreReason, suiteResult, listener, filter);
 }
Пример #7
0
 private void SkipAllTests(TestResult suiteResult, EventListener listener, ITestFilter filter)
 {
     suiteResult.Skip(this.IgnoreReason);
     MarkTestsNotRun(this.Tests, ResultState.Skipped, this.IgnoreReason, suiteResult, listener, filter);
 }
Пример #8
0
        public override TestResult Run(EventListener listener, ITestFilter filter)
        {
            using (new TestContext())
            {
                TestResult testResult = new TestResult(this);

                log.Debug("Test Starting: " + this.TestName.FullName);
                listener.TestStarted(this.TestName);
                long startTime = DateTime.Now.Ticks;

                switch (this.RunState)
                {
                    case RunState.Runnable:
                    case RunState.Explicit:
                        Run(testResult);
                        break;
                    case RunState.Skipped:
                    default:
                        testResult.Skip(IgnoreReason);
                        break;
                    case RunState.NotRunnable:
                        if (BuilderException != null)
                            testResult.Invalid(BuilderException);
                        else
                            testResult.Invalid(IgnoreReason);
                        break;
                    case RunState.Ignored:
                        testResult.Ignore(IgnoreReason);
                        break;
                }

                long stopTime = DateTime.Now.Ticks;
                double time = ((double)(stopTime - startTime)) / (double)TimeSpan.TicksPerSecond;
                testResult.Time = time;

                listener.TestFinished(testResult);
                return testResult;
            }
        }