예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TestResultReportModel"/> class for the console extension
        /// </summary>
        /// <param name="syncServiceDocumentModel">The <see cref="ISyncServiceDocumentModel"/> to obtain document settings.</param>
        /// <param name="testAdapter"><see cref="ITfsTestAdapter"/> to examine test information.</param>
        /// <param name="testReportingProgressCancellationService">The <see cref="ITestReportingProgressCancellationService"/> indicating that a cancellation is requested.</param>
        protected TestReportModel(ISyncServiceDocumentModel syncServiceDocumentModel, ITfsTestAdapter testAdapter, ITestReportingProgressCancellationService testReportingProgressCancellationService)
        {
            if (syncServiceDocumentModel == null)
            {
                throw new ArgumentNullException("syncServiceDocumentModel");
            }
            if (testAdapter == null)
            {
                throw new ArgumentNullException("testAdapter");
            }
            if (testReportingProgressCancellationService == null)
            {
                throw new ArgumentNullException("testReportingProgressCancellationService");
            }

            SyncServiceDocumentModel = syncServiceDocumentModel;
            TestAdapter = testAdapter;

            Document = syncServiceDocumentModel.WordDocument as Document;

            _modelKey   = GetType().Name;
            _storedData = new Dictionary <string, string>();
            ParseStoredData(SyncServiceDocumentModel.ReadTestReportData(_modelKey));

            _generatingActive = SyncServiceDocumentModel.TestReportRunning;
            _operationActive  = SyncServiceDocumentModel.TestReportRunning;
            TestReportingProgressCancellationService = testReportingProgressCancellationService;
        }
예제 #2
0
        public void MyTestInitialize()
        {
            var config = CommonConfiguration.GetSimpleFieldConfiguration("Requirement", Direction.OtherToTfs, FieldValueType.PlainText, "System.Title");
            var serverConfiguration = CommonConfiguration.TfsTestServerConfiguration(_testContext);

            _testAdapter = SyncServiceFactory.CreateTfsTestAdapter(serverConfiguration.TeamProjectCollectionUrl, serverConfiguration.TeamProjectName, config);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="TestSpecificationReportByQueryModel" /> class for the console extension.
        /// </summary>
        /// <param name="tfsService">Team foundation service.</param>
        /// <param name="documentModel">Model of word document to work with.</param>
        /// <param name="testAdapter">The test adapter.</param>
        /// <param name="workitems">The work items.</param>
        public TestSpecificationReportByQueryModel(ITfsService tfsService, ISyncServiceDocumentModel documentModel,
                                                   ITfsTestAdapter testAdapter, List <int> workitems)
        {
            if (tfsService == null)
            {
                throw new ArgumentNullException("tfsService");
            }
            if (documentModel == null)
            {
                throw new ArgumentNullException("documentModel");
            }

            TfsService   = tfsService;
            _testAdapter = testAdapter;

            WordDocument  = documentModel.WordDocument as Document;
            DocumentModel = documentModel;
            DocumentModel.PropertyChanged += DocumentModelOnPropertyChanged;

            _queryConfiguration = new QueryConfiguration
            {
                UseLinkedWorkItems = false
            };
            _queryConfiguration.ImportOption = QueryImportOption.IDs;
            _queryConfiguration.ByIDs        = workitems;

            LinkTypes = TfsService.GetLinkTypes().Select(
                x => new DataItemModel <ITFSWorkItemLinkType>(x)
            {
                IsChecked = QueryConfiguration.LinkTypes.Contains(x.ReferenceName)
            }).ToList();
        }
예제 #4
0
        public static void ClassInitialize(TestContext testContext)
        {
            AIT.TFS.SyncService.Service.AssemblyInit.Instance.Init();
            AIT.TFS.SyncService.Adapter.TFS2012.AssemblyInit.Instance.Init();
            var projectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(CommonConfiguration.Tfs2013ServerConfiguration(testContext).ServerName, true, false);

            testManagement = projectCollection.GetService <ITestManagementService>().GetTeamProject(CommonConfiguration.Tfs2013ServerConfiguration(testContext).ProjectName);
            var config = CommonConfiguration.GetSimpleFieldConfiguration("Requirement", Direction.OtherToTfs, FieldValueType.PlainText, "System.Title");

            testAdapter = SyncServiceFactory.CreateTfsTestAdapter(CommonConfiguration.Tfs2013ServerConfiguration(testContext).ServerName, CommonConfiguration.Tfs2013ServerConfiguration(testContext).ProjectName, config);
        }
예제 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TestSpecificationReportModel"/> class.
        /// </summary>
        /// <param name="syncServiceDocumentModel">The <see cref="ISyncServiceModel"/> to obtain document settings.</param>
        /// <param name="dispatcher">Dispatcher of associated view.</param>
        /// <param name="testAdapter"><see cref="ITfsTestAdapter"/> to examine test information.</param>
        /// <param name="wordRibbon">Interface to the word ribbon</param>
        /// <param name="testReportingProgressCancellationService">The progess cancellation service used to check at certain points if a cancellation has been triggered and further steps should be skipped.</param>
        public TestSpecificationReportModel(ISyncServiceDocumentModel syncServiceDocumentModel, IViewDispatcher dispatcher,
                                            ITfsTestAdapter testAdapter, IWordRibbon wordRibbon, ITestReportingProgressCancellationService testReportingProgressCancellationService)
            : base(syncServiceDocumentModel, dispatcher, testAdapter, wordRibbon, testReportingProgressCancellationService)
        {
            CreateDocumentStructure = StoredCreateDocumentStructure;
            SkipLevels = StoredSkipLevels;
            SelectedDocumentStructureType = StoredSelectedDocumentStructureType;
            SelectedTestCaseSortType      = StoredSelectedTestCaseSortType;
            CreateReportCommand           = new ViewCommand(ExecuteCreateReportCommand, CanExecuteCreateReportCommand);
            SetTestReportDefaults(syncServiceDocumentModel.Configuration.ConfigurationTest.ConfigurationTestSpecification.DefaultValues);

            WordDocument = syncServiceDocumentModel.WordDocument as Document;
        }
예제 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TestCaseHelper"/> class.
 /// </summary>
 /// <param name="testAdapter">Adapter to obtain information.</param>
 /// <param name="testPlan"><see cref="ITfsTestPlan"/> is the source of test cases to write out.</param>
 /// <param name="testConfiguration">Configuration filter used to determine test results for test case. <c>null</c> - all configurations.</param>
 /// <param name="serverBuild">Build filter used to determine test result for test case.</param>
 /// <param name="testCases">Collection of test cases - data source.</param>
 /// <param name="pathType">Path of test cases to use by all operations in this class.
 /// (Supported is <see cref="DocumentStructureType.IterationPath"/> and <see cref="DocumentStructureType.AreaPath"/>.)</param>
 public TestCaseHelper(ITfsTestAdapter testAdapter, ITfsTestPlan testPlan, ITfsTestConfiguration testConfiguration, ITfsServerBuild serverBuild,
                       IEnumerable <ITfsTestCaseDetail> testCases, DocumentStructureType pathType)
 {
     if (testAdapter == null)
     {
         throw new ArgumentNullException("testAdapter");
     }
     if (testCases == null)
     {
         throw new ArgumentNullException("testCases");
     }
     CheckTestResults  = true;
     TestAdapter       = testAdapter;
     TestPlan          = testPlan;
     TestConfiguration = testConfiguration;
     ServerBuild       = serverBuild;
     TestCases         = testCases;
     PathType          = pathType;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="TestSpecificationReportByQueryModel" /> class.
        /// </summary>
        /// <param name="tfsService">Team foundation service.</param>
        /// <param name="documentModel">Model of word document to work with.</param>
        /// <param name="wordRibbon">Word ribbon.</param>
        /// <param name="testAdapter">The test adapter.</param>
        public TestSpecificationReportByQueryModel(ITfsService tfsService, ISyncServiceDocumentModel documentModel, IWordRibbon wordRibbon,
                                                   ITfsTestAdapter testAdapter)
        {
            if (tfsService == null)
            {
                throw new ArgumentNullException("tfsService");
            }
            if (documentModel == null)
            {
                throw new ArgumentNullException("documentModel");
            }
            if (wordRibbon == null)
            {
                throw new ArgumentNullException("wordRibbon");
            }

            TfsService = tfsService;
            WordRibbon = wordRibbon;

            _testAdapter = testAdapter;

            WordDocument  = documentModel.WordDocument as Document;
            DocumentModel = documentModel;
            DocumentModel.PropertyChanged += DocumentModelOnPropertyChanged;

            _queryConfiguration = new QueryConfiguration
            {
                UseLinkedWorkItems = false
            };
            DocumentModel.ReadQueryConfiguration(_queryConfiguration);
            SelectedQuery = FindQueryInHierarchy(QueryHierarchy, _queryConfiguration.QueryPath);

            LinkTypes = TfsService.GetLinkTypes().Select(
                x => new DataItemModel <ITFSWorkItemLinkType>(x)
            {
                IsChecked = QueryConfiguration.LinkTypes.Contains(x.ReferenceName)
            }).ToList();

            CollapseQueryTree = DocumentModel.Configuration.CollapsQueryTree;
        }
예제 #8
0
        public static void MyClassInitialize(TestContext testContext)
        {
            _testContext = testContext;

            AIT.TFS.SyncService.Service.AssemblyInit.Instance.Init();
            AIT.TFS.SyncService.Adapter.TFS2012.AssemblyInit.Instance.Init();

            var serverConfig = CommonConfiguration.TfsTestServerConfiguration(_testContext);

            CommonConfiguration.ReplaceConfigFileTokens(_testContext);
            var config = CommonConfiguration.GetSimpleFieldConfiguration("Requirement", Direction.OtherToTfs, FieldValueType.PlainText, "System.Title");

            _testAdapter = SyncServiceFactory.CreateTfsTestAdapter(serverConfig.TeamProjectCollectionUrl, serverConfig.TeamProjectName, config);
            var projectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(serverConfig.TeamProjectCollectionUrl));

            _testManagement = projectCollection.GetService <ITestManagementService>().GetTeamProject(serverConfig.TeamProjectName);

            var sharedSteps = _testManagement.SharedSteps.Query("SELECT * FROM WorkItems WHERE System.Title='UnitTest_SharedStep'");

            _sharedStep = sharedSteps.FirstOrDefault();

            if (_sharedStep == null)
            {
                _sharedStep = _testManagement.SharedSteps.Create();
                var sharedStep1 = _sharedStep.CreateTestStep();
                sharedStep1.Title          = "First Shared Step";
                sharedStep1.ExpectedResult = "Result of first shared step";

                var sharedStep2 = _sharedStep.CreateTestStep();
                sharedStep2.Title          = "Second Shared Step .: @ParametersDontLikeSpecialChars";
                sharedStep2.ExpectedResult = "Result of second shared step";

                _sharedStep.Actions.Add(sharedStep1);
                _sharedStep.Actions.Add(sharedStep2);

                _sharedStep.Title = "UnitTest_SharedStep_1";
                _sharedStep.Save();
            }
            else
            {
                var sharedStep1 = _sharedStep.Actions[0] as ITestStep;
                if (sharedStep1 != null)
                {
                    sharedStep1.Title          = "First Shared Step";
                    sharedStep1.ExpectedResult = "Result of first shared step";
                }

                var sharedStep2 = _sharedStep.Actions[1] as ITestStep;
                if (sharedStep2 != null)
                {
                    sharedStep2.Title          = "Second Shared Step .: @ParametersDontLikeSpecialChars";
                    sharedStep2.ExpectedResult = "Result of second shared step";
                }

                _sharedStep.WorkItem.Open();
                _sharedStep.Save();
            }

            var testCases = _testManagement.TestCases.Query("SELECT * FROM WorkItems WHERE System.Title='UnitTest_TestCase'");

            _testCase = testCases.FirstOrDefault();

            if (_testCase == null)
            {
                _testCase       = _testManagement.TestCases.Create();
                _testCase.Title = "UnitTest_TestCase";

                var step1 = _testCase.CreateTestStep();
                step1.Title          = "First Step";
                step1.ExpectedResult = "Result of first step";

                var step2 = _testCase.CreateTestStep();
                step2.Title          = "Second Step";
                step2.ExpectedResult = "Result of second step";

                var step3 = _testCase.CreateTestStep();
                step3.Title          = "@DescriptionParameter";
                step3.ExpectedResult = "@ExpectedResultParameter";

                var ssr = _testCase.CreateSharedStepReference();
                ssr.SharedStepId = _sharedStep.Id;

                _testCase.Actions.Add(step1);
                _testCase.Actions.Add(step2);
                _testCase.Actions.Add(ssr);
                _testCase.Actions.Add(step3);
                _testCase.Save();
            }

            var testConfigurations = _testManagement.TestConfigurations.Query("Select * from TestConfiguration where Name='UnitTest_TestConfiguration'");

            _testConfiguration = testConfigurations.FirstOrDefault();

            if (_testConfiguration == null)
            {
                _testConfiguration      = _testManagement.TestConfigurations.Create();
                _testConfiguration.Name = "UnitTest_TestConfiguration";
                _testConfiguration.Save();
            }
        }
예제 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TestSpecificationReportModel"/> class for the console extension
 /// </summary>
 /// <param name="syncServiceDocumentModel">The <see cref="ISyncServiceModel"/> to obtain document settings.</param>
 /// <param name="testAdapter"><see cref="ITfsTestAdapter"/> to examine test information.</param>
 /// <param name="sort"></param>
 /// <param name="testReportingProgressCancellationService">The progess cancellation service used to check at certain points if a cancellation has been triggered and further steps should be skipped.</param>
 /// <param name="plan">The selected <see cref="ITfsTestPlan"/> used for the report generation.</param>
 /// <param name="suite">The selected <see cref="ITfsTestSuite"/> used for the report generation.</param>
 /// <param name="documentStructure">The information if a document structure should be created.</param>
 /// <param name="skipLevels">The level count to ignore generation.</param>
 /// <param name="structureType"></param>
 public TestSpecificationReportModel(ISyncServiceDocumentModel syncServiceDocumentModel, ITfsTestAdapter testAdapter, ITfsTestPlan plan, ITfsTestSuite suite, bool documentStructure, int skipLevels, DocumentStructureType structureType, TestCaseSortType sort, ITestReportingProgressCancellationService testReportingProgressCancellationService)
     : base(syncServiceDocumentModel, testAdapter, testReportingProgressCancellationService)
 {
     SelectedTestPlan        = plan;
     SelectedTestSuite       = suite;
     CreateDocumentStructure = documentStructure;
     SkipLevels = skipLevels;
     SelectedDocumentStructureType = structureType;
     SelectedTestCaseSortType      = sort;
     CreateReportCommand           = new ViewCommand(ExecuteCreateReportCommand, CanExecuteCreateReportCommand);
     WordDocument = syncServiceDocumentModel.WordDocument as Document;
 }