示例#1
0
        public virtual TestRunState Run(IEnumerable <ITestCase> testCases = null, TestRunState initialRunState = TestRunState.NoTests)
        {
            try
            {
                if (testCases != null)
                {
                    testCases = testCases.ToList();
                }

                var visitor = new ResultVisitor(testListener)
                {
                    TestRunState = initialRunState
                };
                toDispose.Push(visitor);

                if (testCases == null)
                {
                    xunit.Run(visitor, new XunitDiscoveryOptions(configuration), new XunitExecutionOptions(configuration));
                }
                else
                {
                    xunit.Run(testCases, visitor, new XunitExecutionOptions(configuration));
                }

                visitor.Finished.WaitOne();

                return(visitor.TestRunState);
            }
            catch (Exception ex)
            {
                testListener.WriteLine("Error during test execution:\r\n" + ex, Category.Error);
                return(TestRunState.Error);
            }
        }
示例#2
0
        public virtual TestRunState Run(IReadOnlyList <ITestCase> testCases = null, TestRunState initialRunState = TestRunState.NoTests)
        {
            try
            {
                if (testCases == null)
                {
                    testCases = Discover();
                }

                var visitor = new ResultVisitor(testListener, testCases.Count)
                {
                    TestRunState = initialRunState
                };
                toDispose.Push(visitor);

                var executionOptions = TestFrameworkOptions.ForExecution(configuration);
                xunit.RunTests(testCases, visitor, executionOptions);

                visitor.Finished.WaitOne();

                return(visitor.TestRunState);
            }
            catch (Exception ex)
            {
                testListener.WriteLine("Error during test execution:\r\n" + ex, Category.Error);
                return(TestRunState.Error);
            }
        }
示例#3
0
        public virtual TestRunState Run(IEnumerable <ITestCase> testCases = null, TestRunState initialRunState = TestRunState.NoTests)
        {
            try
            {
                if (testCases != null)
                {
                    testCases = testCases.ToList();
                }

                var visitor = new ResultVisitor(testListener)
                {
                    TestRunState = initialRunState
                };
                toDispose.Push(visitor);
                frontController.Run(testCases, visitor);
                visitor.Finished.WaitOne();

                return(visitor.TestRunState);
            }
            catch (Exception ex)
            {
                testListener.WriteLine("Error during test execution:\r\n" + ex, Category.Error);
                return(TestRunState.Error);
            }
        }