Ejemplo n.º 1
0
 public TestFixtureThread(int threadId, EdisonContext context, TestResultDictionary resultQueue, IEnumerable<Type> fixtures,
     Exception globalSetupEx, ConcurrencyType concurrenyType, int numberOfTestThreads)
 {
     ThreadId = threadId;
     Context = context;
     ResultQueue = resultQueue;
     GlobalSetupException = globalSetupEx;
     TestFixtures = fixtures;
     NumberOfTestThreads = numberOfTestThreads;
 }
Ejemplo n.º 2
0
 public TestThread(int threadId, TestResultDictionary resultQueue, IEnumerable<MethodInfo> tests, Type testFixture,
     int testFixtureRepeatIndex, TestCaseAttribute testFixtureCase, object activator, Exception globalSetupEx,
     Exception fixtureSetupEx, Exception activatorEx, EdisonContext context, ConcurrencyType concurrenyType)
 {
     ThreadId = threadId;
     Context = context;
     ResultQueue = resultQueue;
     TestFixture = testFixture;
     TestFixtureRepeatIndex = testFixtureRepeatIndex;
     Activator = activator;
     TestFixtureCase = testFixtureCase;
     GlobalSetupException = globalSetupEx;
     FixtureSetupException = fixtureSetupEx;
     ActivatorException = activatorEx;
     Tests = tests;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Runs this instance after passing validation, executing tests in the passed assemblies/solution.
        /// </summary>
        /// <returns></returns>
        public TestResultDictionary Run()
        {
            //run validation first
            Validate();

            //start timer
            var timer = new Stopwatch();
            timer.Start();

            //set logging output
            SetupLogging();

            //set output logging type
            Logger.Instance.ConsoleOutputType = ConsoleOutputType;

            //create queue
            ResultQueue = new TestResultDictionary(this);

            //bind test result events
            if (OnTestResult != default(TestResultEventHandler))
            {
                ResultQueue.OnTestResult += OnTestResult;
            }

            //loop through all assemblies, running their tests
            RunAssemblies();

            //stop the timer
            timer.Stop();

            //if we have single/none line logging, post the failed test messages
            if (Logger.Instance.IsSingleOrNoLined && ResultQueue.FailedTestResults.Any())
            {
                WriteFailedResultsToConsole();
            }

            //create result file and write
            WriteResultsToFile();

            //write results and timer
            Logger.Instance.WriteDoubleLine(Environment.NewLine);
            Logger.Instance.WriteMessage(ResultQueue.ToTotalString());
            Logger.Instance.WriteMessage(string.Format("Total time: {0}", timer.Elapsed));
            Logger.Instance.WriteDoubleLine(postcede: Environment.NewLine);

            IsRunning = false;
            return ResultQueue;
        }