Exemplo n.º 1
0
 void SetStartUpParameters(ITestRun testRun)
 {
     if (TestRunStartTypes.Immediately == testRun.StartType)
         testRun.Status = TestRunQueue.TestRuns.Any(tr => tr.TestLabId == testRun.TestLabId && tr.IsQueued()) ? TestRunStatuses.Pending : TestRunStatuses.Running;
     if (testRun.IsActive())
         testRun.SetStartTime();
 }
Exemplo n.º 2
0
 public void SetUp()
 {
     TestSettings.PrepareModuleTests();
     TestFactory.GetTestRunWithStatus(TestRunStatuses.Running);
     _workflow = WorkflowCollection.Workflows.First();
     _testRun = TestRunQueue.TestRuns.First();
 }
Exemplo n.º 3
0
 void SetCommonData(ITestRun testRun, IDictionary<string, object> formData)
 {
     if (null == formData || 0 >= formData.Count)
         return;
     foreach (var pair in formData)
         AddOrUpdateDataItem(testRun, formData, pair.Key);
 }
Exemplo n.º 4
0
 void AddOrUpdateDataItem(ITestRun testRun, IDictionary<string, object> formData, string key)
 {
     testRun.Data.AddOrUpdateDataItem(
         new CommonDataItem {
             Key = key,
             Value = (formData[key] ?? string.Empty).ToString()
         });
 }
Exemplo n.º 5
0
 public void CancelTestRun(ITestRun testRun)
 {
     TaskPool.TasksForClients.Where(task => task.TestRunId == testRun.Id && !task.IsFinished() && !task.IsActive()).ToList().ForEach(task => task.TaskStatus = TestTaskStatuses.Canceled);
     testRun.Status = TestRunStatuses.Cancelled;
     if (TaskPool.TasksForClients.Any(task => task.TestRunId == testRun.Id && task.IsActive())) {
         TaskPool.TasksForClients.Where(task => task.TestRunId == testRun.Id && task.IsActive()).ToList().ForEach(task => task.TaskStatus = TestTaskStatuses.Interrupted);
         testRun.Status = TestRunStatuses.Cancelling;
     }
     
     // disconnecting clients
     ClientsCollection.Clients.RemoveAll(client => client.TestRunId == testRun.Id);
     testRun.SetTimeTaken();
     RunNextInRowTestRun();
 }
Exemplo n.º 6
0
 public static TestResult Map(ITestRun testRun, double? coverage, string serverName)
 {
     return new TestResult()
     {
         ServerName = serverName,
         CompletedTime = testRun.DateCompleted,
         PassedTestCount = testRun.Statistics.PassedTests,
         FailedTestCount = testRun.Statistics.FailedTests,
         NotRunTestCount = testRun.Statistics.InconclusiveTests,
         TotalTestCount = testRun.Statistics.TotalTests,
         CodeCoverage = coverage != null ? new CodeCoverageResult()
             {
                 CompletedTime = testRun.DateCompleted,
                 Coverage =  coverage.Value
             } : null
     };
 }
Exemplo n.º 7
0
        public virtual void CancelTestRun(ITestRun testRun)
        {
            TaskPool.TasksForClients.Where(task => task.TestRunId == testRun.Id && !task.IsFinished() && !task.IsActive() && !task.IsCancel).ToList().ForEach(task => task.TaskStatus = TestTaskStatuses.Canceled);
            var activeTasks = TaskPool.TasksForClients.Where(task => task.TestRunId == testRun.Id && task.IsActive()).ToList();
            if (activeTasks.Any())
            {
                // 20150918
                // temporarily
                // until there'll be async execution of task here
                // linked lines of code 20150918-001
                // activeTasks.ForEach(task => { if (!task.IsCancel) task.TaskStatus = TestTaskStatuses.InterruptedByUser; });
                // TODO: provide all clients that ran active tasks with newly available tasks
                // however clients can't interrupt their tasks
                // 
                testRun.Status = TestRunStatuses.Canceling;
            }
            else
            {
                testRun.Status = TestRunStatuses.Canceled;
            }

            // TODO: set test run status Canceled after all isCancel tasks have finished
            
            // disconnecting clients
            // 20150807
            // ClientsCollection.Clients.RemoveAll(client => client.TestRunId == testRun.Id);

            // 20150909
            // no more unregistration of clients
            // testRun.UnregisterClients();
            // set time only for completely cancelled test runs
            // testRun.SetTimeTaken();
            if (TestRunStatuses.Canceled == testRun.Status)
                testRun.SetTimeTaken();

            // 20150909
            // RunNextInRowTestRun();
            if (TestRunStatuses.Canceled == testRun.Status)
                RunNextInRowTestRun();
        }
 void ThenTestRunIsRunning(ITestRun testRun)
 {
     Assert.Equal(true, testRun.IsActive());
 }
 void ThenTestRunIsCompleted(ITestRun testRun)
 {
     Assert.Equal(true, testRun.IsCompleted());
 }
Exemplo n.º 10
0
 public static string GetFileName(this ITestRun testRun)
 {
     return(testRun.TestInfo.Finish.GetTestName());
 }
Exemplo n.º 11
0
 public static bool IsActive(this ITestRun testRun)
 {
     // 20150918
     // return TestRunStatuses.Running == testRun.Status;
     return(TestRunStatuses.Running == testRun.Status || TestRunStatuses.Canceling == testRun.Status);
 }
Exemplo n.º 12
0
 public static string GetTestLabName(this ITestRun testRun)
 {
     return(TestLabCollection.TestLabs.FirstOrDefault(testLab => testLab.Id == testRun.TestLabId).Name);
 }
Exemplo n.º 13
0
 public static void SetStartTime(this ITestRun testRun)
 {
     testRun.StartTime = DateTime.Now;
 }
Exemplo n.º 14
0
 public static void SetTimeTaken(this ITestRun testRun)
 {
     (testRun as TestRun).SetFinishTime();
 }
Exemplo n.º 15
0
 public static bool IsScheduled(this ITestRun testRun)
 {
     return(TestRunStatuses.Scheduled == testRun.Status);
 }
Exemplo n.º 16
0
 public static bool IsQueued(this ITestRun testRun)
 {
     return(TestRunStatuses.Running == testRun.Status || TestRunStatuses.Pending == testRun.Status);
 }
Exemplo n.º 17
0
 public static bool IsPending(this ITestRun testRun)
 {
     return(TestRunStatuses.Pending == testRun.Status);
 }
Exemplo n.º 18
0
 public static bool IsNotQuiet(this ITestRun testRun)
 {
     return(TestRunStatuses.Running == testRun.Status ||
            TestRunStatuses.Canceling == testRun.Status);
 }
Exemplo n.º 19
0
 public static bool IsAcceptingNewClients(this ITestRun testRun)
 {
     return(TestRunStatuses.Running == testRun.Status);
 }
Exemplo n.º 20
0
      /// <summary>
      /// Executes a test run. The ITestRun object specifies which tests to run 
      /// and how. If the tests write to the console (either Error or Out) this 
      /// output will be redirected to 'twConsole'.
      /// </summary>
      /// <param name="testRun">ITestRun object describing what tests to run and how.</param>
      /// <param name="twConsole">TextWriter to where Out and Error are redirected.</param>
      public void RunTests(ITestRun testRun, TextWriter twConsole) {
         SetUpConsoleAndWorkingDirectory(twConsole);

         if( _listener != null ) {
            _listener.OnAssemblyStarted(null, new AssemblyEventArgs(_testAssembly.FullName, _testAssembly.CodeBase));
         }

         try {
            _testAssembly.RunTests(testRun, _listener);
         }
         catch( Exception ex ) {
            if( _listener != null ) {
               _listener.OnTestsAborted(null, new AssemblyEventArgs(_testAssembly.FullName, _testAssembly.CodeBase));
            }
            CheckAndHandleCsUnitCrash(ex);
         }
         finally {
            if( _listener != null ) {
               _listener.OnAssemblyFinished(null, new AssemblyEventArgs(_testAssembly.FullName, _testAssembly.CodeBase));
            }
            RestoreConsoleAndWorkingDirectory();
         }
      }
Exemplo n.º 21
0
 public void RunTests(ITestRun testSelection)
 {
     RaiseAbortedEvent();
 }
Exemplo n.º 22
0
 void WhenCancelingTestRun(ITestRun testRun)
 {
     _response = _browser.Put(UrlList.TestRuns_Root + "/" + testRun.Id + "/cancelTestRun", with => {
                                  with.Accept("application/json");
                              });
 }
Exemplo n.º 23
0
 public void RunTests(ITestRun testSelection) {
    RaiseAbortedEvent();
 }
Exemplo n.º 24
0
 void THEN_testRun_is_completed(ITestRun testRun)
 {
     Assert.Equal(true, testRun.IsCompleted());
 }
Exemplo n.º 25
0
 /// <summary>
 /// Executes tests specified as a test run. The TestRun object contains
 /// information about what tests to execute and how.
 /// </summary>
 /// <param name="testRun">Information about the test run.</param>
 public void RunTests(ITestRun testRun) {
    if (_testAssemblies.Count > 0) {
       _testRun = testRun;
       PrepareTestRun();
       RunTests(_queuedAssemblies.Dequeue(), _testRun);
    }
 }
 void ThenTestRunIsPending(ITestRun testRun)
 {
     Assert.Equal(true, testRun.IsPending());
 }
Exemplo n.º 27
0
 private void RunTests(ITestAssembly testAssembly, ITestRun testRun) {
    if( testAssembly != null ) {
       try {
          //testAssembly.Refresh();
          testAssembly.RunTests(testRun);
       }
       catch( Exception ex ) {
          // Invoke the abort event b/c an exception that goes unhandled 
          // here is the equivalent of an aborted recipe.
          var recipeEventArgs = new RecipeEventArgs(ex.Message);
          TestsRunning = false;
          if( Aborted != null ) {
             Aborted(this, recipeEventArgs);
          }
       }
    }
 }
 void ThenTestRunStatusIsCanceled(ITestRun testRun)
 {
     Assert.Equal(TestRunStatuses.Canceled, testRun.Status);
 }
Exemplo n.º 29
0
 public void RunTests(ITestRun testRun)
 {
     throw new Exception("The method or operation is not implemented.");
 }
 void WhenCancelingTestRun(ITestRun testRun)
 {
     _response = _browser.Put(UrlList.TestRuns_Root + "/" + testRun.Id + "/cancelTestRun", with => {
         with.Accept("application/json");
     });
 }
Exemplo n.º 31
0
        /// <summary>
        /// This method is used to initiate execution in test manager, create test run and results and set required parameters
        /// </summary>
        /// <returns></returns>
        public bool InitExecution()
        {
            //Create a connection to tfs project
            ITestManagementTeamProject tfsProject = null;

            tfsProject = GetProject(ProjectUrl, ProjectName);

            if (tfsProject == null)
            {
                throw new Exception("Unabled to connect to test project: " + ProjectName);
            }
            //Retrieve test plan details
            ITestPlanCollection testPlans = tfsProject.TestPlans.Query("select * from TestPlan where PlanName ='" +
                                                                       TestPlanName + "'");

            if (testPlans.Count == 0)
            {
                throw new Exception("Unabled to locate test plan: " + TestPlanName + " in Test Manager.");
            }

            ITestPlan tfsTestPlan = testPlans.First();

            //Retrieve test suite details
            ITestSuiteCollection testSuites = null;

            //Optionally, test suite id of test manager can be passed as an command line arguments
            //This helps when same test case has been added to multiple test suites
            if (TestSuiteId.ToLower().Equals(string.Empty) ||
                TestSuiteId.ToLower().Equals(string.Empty) ||
                TestSuiteId.ToLower().Equals("testsuiteid", StringComparison.OrdinalIgnoreCase))
            {
                testSuites = tfsProject.TestSuites.Query("Select * from TestSuite where Title='" +
                                                         TestSuiteName + "' and PlanID='" + tfsTestPlan.Id + "'");
            }
            else
            {
                testSuites = tfsProject.TestSuites.Query("Select * from TestSuite where Id='" +
                                                         TestSuiteId + "' and PlanID='" + tfsTestPlan.Id + "'");
            }


            IStaticTestSuite tfsTestSuite = testSuites.Cast <IStaticTestSuite>().FirstOrDefault(testSuite => testSuite.Title.ToLower().Equals(TestSuiteName.ToLower()) || testSuite.Id.ToString().Equals(TestSuiteId));

            if (tfsTestSuite == null)
            {
                throw new Exception("Unabled to locate test suite: " + TestSuiteName + " in Test Manager Test Plan: " + TestPlanName);
            }

            //Get handle to a specific test case in the test suite
            ITestCase tfsTestCase = tfsTestSuite.AllTestCases.FirstOrDefault(testcase => testcase.Id.Equals(TestCaseId));

            if (tfsTestCase == null)
            {
                throw new Exception("Unabled to locate test case id: " + TestCaseId + " in Test Manager");
            }

            //Create a test run
            ITestPoint tfsTestPoint = CreateTestPoints(tfsTestPlan, tfsTestSuite, tfsTestCase);
            ITestRun   tfsTestRun   = CreateTestRun(tfsProject, tfsTestPlan, tfsTestPoint);

            tfsTestRun.Refresh();

            //Suprisingly, most recently created test results should be available in last, but test manager returns it at first position
            //Find test results that were create by the test run
            ITestCaseResultCollection tfsTestCaseResults = tfsProject.TestResults.ByTestId(tfsTestCase.Id);
            ITestCaseResult           tfsTestResult      = tfsTestCaseResults.Last(); //Default assignment

            foreach (ITestCaseResult testResult in tfsTestCaseResults)
            {
                if (testResult.DateCreated.CompareTo(tfsTestRun.DateCreated) == 1)
                {
                    tfsTestResult = testResult;
                    break;
                }
            }

            //Set test run and result id to property variable for usage while uploading results
            Property.RcTestRunId    = tfsTestRun.Id;
            Property.RcTestResultId = tfsTestResult.TestResultId;

            //Set status of test case execution

            //Set other details on test execution
            tfsTestResult.ComputerName = Property.RcMachineId;
            tfsTestResult.DateStarted  = DateTime.Now;
            tfsTestResult.State        = TestResultState.InProgress;
            tfsTestResult.Save();
            return(true);
        }
Exemplo n.º 32
0
 private void AddTestResultByTestoutcome(ITestRun testRun, IList<TestOutcome> outcomeList, ref IList<TestResult> list)
 {
     foreach (var outcome in outcomeList)
     {
         foreach (var tr in testRun.QueryResultsByOutcome(outcome))
         {
             TestResult instance = new TestResult
             {
                 TestCaseId = tr.TestCaseId,
                 TestCaseTitle = tr.TestCaseTitle,
                 State = tr.State,
                 Outcome = tr.Outcome,
                 DateStarted = tr.DateStarted,
                 DateCompleted = tr.DateCompleted,
                 ErrorMsg = tr.ErrorMessage,
                 LogUri = tr.Attachments.FirstOrDefault().Uri.AbsoluteUri,
             };
             list.Add(instance);
         }
     }
 }
Exemplo n.º 33
0
 void ThenTestRunIsPending(ITestRun testRun)
 {
     Assert.Equal(true, testRun.IsPending());
 }
Exemplo n.º 34
0
 string GIVEN_url_to_testRun_data()
 {
     _testRun = new TestRun();
     ClientSettings.Instance.CurrentClient = new TestClient {
         TestRunId = _testRun.Id
     };
     return UrlList.TestData_Root + "/" + _testRun.Id + UrlList.TestData_CommonData_forClient_relPath;
 }
Exemplo n.º 35
0
 void ThenTestRunStatusIsCanceled(ITestRun testRun)
 {
     Assert.Equal(TestRunStatuses.Canceled, testRun.Status);
 }
Exemplo n.º 36
0
 public void RunTests(ITestRun selection) {
    if( Started != null ) {
       Started(this, new RecipeEventArgs());
    }
 }
Exemplo n.º 37
0
 public static void UnregisterClients(this ITestRun testRun)
 {
     // TODO: send command to unregister to clients
     ClientsCollection.Clients.RemoveAll(client => client.TestRunId == testRun.Id);
 }
Exemplo n.º 38
0
//        [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
//        public void Should_add_one_task_to_the_common_pool_on_imporing_one_task()
//        {
//            Xunit.Assert.Equal(0, 1);
//        }
//        
//        [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
//        public void Should_add_all_tasks_to_the_common_pool_on_importing_several_tasks()
//        {
//            Xunit.Assert.Equal(0, 1);
//        }
//        
//        // ==========================================================================================
//        [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
//        public void Should_add_one_task_to_one_client_pool()
//        {
//            Xunit.Assert.Equal(0, 1);
//        }
//        
//        [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
//        public void Should_add_all_tasks_to_one_client_pool()
//        {
//            Xunit.Assert.Equal(0, 1);
//        }
//        
//        // ==========================================================================================
//        [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
//        public void Should_add_one_task_to_all_client_pools()
//        {
//            Xunit.Assert.Equal(0, 1);
//        }
//        
//        [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
//        public void Should_add_all_tasks_to_all_client_pools()
//        {
//            Xunit.Assert.Equal(0, 1);
//        }
//        
//        // ==========================================================================================
//        [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
//        public void Should_add_no_tasks_to_not_matching_client_pools()
//        {
//            Xunit.Assert.Equal(0, 1);
//        }
//        
//        [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
//        public void Should_add_one_task_to_matching_client_pools()
//        {
//            Xunit.Assert.Equal(0, 1);
//        }
//        
//        [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
//        public void Should_add_all_tasks_to_matching_client_pools()
//        {
//            Xunit.Assert.Equal(0, 1);
//        }

        void GivenTasksForRule(ITestRun testRun, string rule)
        {
            TaskPool.TasksForClients.AddRange(
                new[] {
                    new TestTask {
                        Id = 1,
                        TaskStatus = TestTaskStatuses.Running,
                        Rule = rule,
                        TestRunId = testRun.Id,
                        WorkflowId = testRun.WorkflowId
                    },
                    new TestTask {
                        Id = 2,
                        TaskStatus = TestTaskStatuses.New,
                        IsCancel = true,
                        Rule = rule,
                        TestRunId = testRun.Id,
                        WorkflowId = testRun.WorkflowId
                    },
                    new TestTask {
                        Id = 2,
                        TaskStatus = TestTaskStatuses.New,
                        Rule = rule,
                        TestRunId = testRun.Id,
                        WorkflowId = testRun.WorkflowId
                    }
                }
               );
        }
Exemplo n.º 39
0
 void THEN_testRun_is_running(ITestRun testRun)
 {
     Assert.Equal(true, testRun.IsActive());
 }
Exemplo n.º 40
0
 void ThenTestRunIsRunning(ITestRun testRun)
 {
     Assert.Equal(true, testRun.IsActive());
 }
Exemplo n.º 41
0
 public void RunTests(ITestRun selection) {
    FireFinishedEvent();
 }
Exemplo n.º 42
0
 void ThenTestRunIsCompleted(ITestRun testRun)
 {
     Assert.Equal(true, testRun.IsCompleted());
 }
Exemplo n.º 43
0
        public Task SaveResults(string runId, int suiteId)
        {
            return(Task.Factory.StartNew(() =>
            {
                // tell the spinner this task is starting
                ViewModelLocator.MainWindowViewModel.TaskManager.AddTask();

                // retrieve the info for the specified run
                RunInfo rfRunInfo = Services.Rainforest.Runs.GetSingle(runId);

                // check to see if the run is finished
                if (rfRunInfo.state != "complete" && rfRunInfo.state != "aborted")
                {
                    ViewModelLocator.MainWindowViewModel.TaskManager.RemoveTask();
                    throw new Core.ServiceException(Core.Error.RunNotComplete, runId);
                }

                // run has completed or has been aborted and is being processed, tag can be removed
                this.TFS.RemoveTag(suiteId, $"RUNID{runId}");

                // if run was aborted then drop results
                if (rfRunInfo.state == "aborted")
                {
                    ViewModelLocator.MainWindowViewModel.TaskManager.RemoveTask();
                    throw new Core.ServiceException(Core.Error.RunAborted, runId);
                }

                // Run was completed successfully
                // deserialize the RF tests info that were in the run, ids here are all rfIds, these are NOT JsonObjects.Test objects
                var anon = new[] { new { id = 0, result = "" } };
                var rfTestResults = JsonConvert.DeserializeAnonymousType(rfRunInfo.extras["tests"].ToString(), anon);

                // Get all the testpoints from the suite
                var testPointDict = TFS.Session.workingPlan
                                    .QueryTestPoints(String.Format("SELECT * FROM TestPoint WHERE SuiteId = {0}", suiteId))
                                    .ToDictionary(tp => tp.TestCaseId, tp => tp);

                // create a run in tfs to create results against
                ITestRun tfsTestRun = Session.workingPlan.CreateTestRun(false);

                // map the RF test results to a new enumerable with stored TFS id
                var refinedRFTestResults = rfTestResults.Select(r =>
                {
                    // retrieve the test from RF, need to search tag for matching TFS id
                    // each should have a tag already as it was ensured before the run was created
                    // TOEXPAND -> could possible add redundant check for no tags found in case manually removed
                    Test rfTest = Services.Rainforest.Tests.GetSingle(r.id.ToString());
                    string tfsId = Parse.ExtractIdFromTags("TFSID", rfTest.tags);
                    return new { rfid = r.id, verdict = r.result, tfsId = Int32.Parse(tfsId) };
                })
                                           .ToList();

                // go through RF results once to find the needed testpoints and add to run
                foreach (var result in refinedRFTestResults)
                {
                    // find test point for the matching TFS tc and add to run
                    ITestPoint testPoint = testPointDict[result.tfsId];
                    tfsTestRun.AddTestPoint(testPoint, testPoint.TestCaseWorkItem.Owner);
                }
                tfsTestRun.Save();

                // retrieve all the TFS results from the run
                Dictionary <int, ITestCaseResult> tfsTestResults = tfsTestRun.QueryResults().ToDictionary(r => r.TestCaseId, r => r);

                // go through RF results again to save the outcomes to the tfs results
                foreach (var result in refinedRFTestResults)
                {
                    ITestCaseResult tfsResult = tfsTestResults[result.tfsId];

                    switch (result.verdict)
                    {
                    case "passed":
                        tfsResult.Outcome = TestOutcome.Passed;
                        tfsResult.State = TestResultState.Completed;
                        break;

                    case "failed":
                        tfsResult.Outcome = TestOutcome.Failed;
                        tfsResult.State = TestResultState.Completed;
                        break;

                    default:
                        // TOEXPAND -> should never get here, verdict will always have a value
                        break;
                    }
                    tfsResult.State = TestResultState.Completed;
                    tfsResult.RunBy = Session.userTFId;
                    tfsResult.Save();
                }
                tfsTestRun.Save();
                tfsTestRun.Refresh();

                // tell the spinner this task is done
                ViewModelLocator.MainWindowViewModel.TaskManager.RemoveTask();
            }));
        }
Exemplo n.º 44
0
 public void RunTests(ITestRun testRun) {
    throw new Exception("The method or operation is not implemented.");
 }
Exemplo n.º 45
0
 private MyTestListener ExecuteLoaderAndListen(ITestRun testRun) {
    var loader = new Loader(_assemblyPathName);
    var listener = new MyTestListener(loader);
    loader.RunTests(testRun);
    do {
       Thread.Sleep(200);
    } while (listener.TestsRunning);
    loader.Dispose();
    Thread.SpinWait(20);
    return listener;
 }
Exemplo n.º 46
0
        // TODO: remove duplication
//        void SetCommonData(ITestRun testRun, ICommonData commonData)
//        {
//            if (null == commonData || 0 >= commonData.Data.Count)
//                return;
//            foreach (var pair in commonData.Data)
//                AddOrUpdateDataItem(testRun, commonData.Data, pair.Key);
//        }
        
        void SetCreatedTime(ITestRun testRun)
        {
            testRun.CreatedTime = DateTime.Now;
        }
Exemplo n.º 47
0
 public void RunTests(ITestRun testRun) {
    _testRun = testRun;
    StartWorkerThread();
 }
Exemplo n.º 48
0
 void THEN_testRun_is_pending(ITestRun testRun)
 {
     Assert.Equal(true, testRun.IsPending());
 }
Exemplo n.º 49
0
 public void Execute(ITestRun testRun, ITestListener listener) {
    Use(listener);
    try {
       SafeCurrentDirectory();
       if( CreateObject()
          && FixtureSetUp() ) {
          foreach( var testMethod in _testMethods ) {
             if( !testMethod.Ignore ) {
                if( testRun.Contains(testMethod)
                   && SetUp(testMethod) ) {
                   testMethod.Execute(_testListener);
                   TearDown(testMethod);
                }
             }
             else {
                _testListener.OnTestSkipped(new TestFixtureInfo(this),
                                            new TestResultEventArgs(
                                               AssemblyName,
                                               FullName,
                                               testMethod.Name,
                                               testMethod.IgnoreReason,
                                               0){TestResult = TestResultCategory.Skipped});
             }
          }
          FixtureTearDown();
       }
    }
    finally {
       RestoreCurrentDirectory();
    }
 }
Exemplo n.º 50
0
 public void RunTests(ITestRun testSelection, ITestListener listener) {
    SetUp();
    foreach( var tc in TestFixtures ) {
       if( testSelection.Contains(tc) ) {
          if(!tc.IsIgnored) {
             tc.Execute(testSelection, listener);
          }
          else {
             listener.OnTestSkipped(this, new TestResultEventArgs(
                                             FullName, tc.FullName, string.Empty, tc.IgnoreReason, 0));
          }
       }
    }
    TearDown();
 }
Exemplo n.º 51
0
 public void RunTests(ITestRun testRun)
 {
     _testRun = testRun;
     StartWorkerThread();
 }