コード例 #1
0
        public void TestSuiteSearcher_SearchTestSuiteWithinTestPlan_ByNameDeep()
        {
            var searchTitle        = "SubSuite_2_2";
            var myPreparedTestPlan = GetPreparedTestPlanWithSuites();
            var mySearcher         = new TestSuiteSearcher(myPreparedTestPlan);
            var foundSuite         = mySearcher.SearchTestSuiteWithinTestPlan(searchTitle);

            Assert.IsTrue(foundSuite.Title == searchTitle);
        }
コード例 #2
0
        public void TestSuiteSearcher_SearchTestSuiteWithinTestPlan_ByPath()
        {
            var searchPath         = "RootSuite/SubSuite_2/SubSuite_2_2";
            var myPreparedTestPlan = GetPreparedTestPlanWithSuites();
            var mySearcher         = new TestSuiteSearcher(myPreparedTestPlan);
            var foundSuite         = mySearcher.SearchTestSuiteWithinTestPlan(searchPath);

            Assert.IsTrue(foundSuite.Title == "SubSuite_2_2");
        }
コード例 #3
0
        /// <summary>
        /// This method creates a word document with the TestResultReport-Command
        /// </summary>
        public void CreateTestResultDocument(DocumentConfiguration documentConfiguration)
        {
            try
            {
                SyncServiceTrace.D(Resources.CreateTestResultDoc);
                _documentConfiguration = documentConfiguration;
                Initialize();
                var testResultSettings = _documentConfiguration.TestResultSettings;
                var testAdapter        = SyncServiceFactory.CreateTfsTestAdapter(_documentModel.TfsServer, _documentModel.TfsProject, _documentModel.Configuration);
                TestCaseSortType testCaseSortType;
                Enum.TryParse(testResultSettings.SortTestCasesBy, out testCaseSortType);
                DocumentStructureType documentStructure;
                Enum.TryParse(testResultSettings.DocumentStructure, out documentStructure);
                ConfigurationPositionType configurationPositionType;
                Enum.TryParse(testResultSettings.TestConfigurationsPosition, out configurationPositionType);
                var testPlan = testAdapter.GetTestPlans(null).Where(plan => plan.Name == testResultSettings.TestPlan).FirstOrDefault();
                if (testPlan == null)
                {
                    SyncServiceTrace.D(Resources.TestSettingsInvalidTestPlan);
                    throw new ArgumentException(Resources.TestSettingsInvalidTestPlan);
                }
                var testSuiteSearcher = new TestSuiteSearcher(testPlan);
                var testSuite         = testSuiteSearcher.SearchTestSuiteWithinTestPlan(testResultSettings.TestSuite);

                var reportModel = new TestResultReportModel(_documentModel,
                                                            testAdapter,
                                                            testPlan,
                                                            testSuite,
                                                            testResultSettings.CreateDocumentStructure,
                                                            testResultSettings.SkipLevels,
                                                            documentStructure,
                                                            testCaseSortType,
                                                            testResultSettings.IncludeTestConfigurations,
                                                            configurationPositionType,
                                                            testResultSettings.IncludeOnlyMostRecentResults,
                                                            testResultSettings.MostRecentForAllConfigurations,
                                                            testResultSettings.Build,
                                                            testResultSettings.TestConfiguration,
                                                            new TestReportingProgressCancellationService(false));

                reportModel.CreateReport();
                FinalizeDocument();
            }
            catch
            {
                if (_wordApplication != null)
                {
                    _wordApplication.Quit();
                }
                // ReSharper disable once PossibleIntendedRethrow
                throw;
            }
        }