public static void MyClassInitialize(TestContext testContext)
 {
     _testContext = testContext;
     CommonConfiguration.ReplaceConfigFileTokens(_testContext);
     Server           = CommonConfiguration.TfsTestServerConfiguration(_testContext).TeamProjectCollectionUrl;
     Project          = CommonConfiguration.TfsTestServerConfiguration(_testContext).TeamProjectName;
     WorkItemToImport = CommonConfiguration.TfsTestServerConfiguration(_testContext).HtmlRequirementId.ToString();
 }
示例#2
0
        public static void MyClassInitialize(TestContext testContext)
        {
            _testContext = testContext;
            CommonConfiguration.ReplaceConfigFileTokens(_testContext);

            // ReSharper disable once UnusedVariable
            var projectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(CommonConfiguration.TfsTestServerConfiguration(_testContext).TeamProjectCollectionUrl));

            AIT.TFS.SyncService.Service.AssemblyInit.Instance.Init();
        }
        public static void MyClassInitialize(TestContext testContext)
        {
            _testContext = testContext;
            CommonConfiguration.ReplaceConfigFileTokens(_testContext);

            // ReSharper disable once CSharpWarnings::CS0618
            projectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(CommonConfiguration.TfsTestServerConfiguration(_testContext).TeamProjectCollectionUrl));

            AIT.TFS.SyncService.Service.AssemblyInit.Instance.Init();
            AIT.TFS.SyncService.Adapter.TFS2012.AssemblyInit.Instance.Init();
            AIT.TFS.SyncService.Adapter.Word2007.AssemblyInit.Instance.Init();
        }
示例#4
0
        public static void MyClassInitialize(TestContext testContext)
        {
            _testContext = testContext;
            CommonConfiguration.ReplaceConfigFileTokens(_testContext);

            //Init the assemblies
            AIT.TFS.SyncService.Service.AssemblyInit.Instance.Init();
            AIT.TFS.SyncService.Adapter.TFS2012.AssemblyInit.Instance.Init();
            var serverConfiguration = CommonConfiguration.TfsTestServerConfiguration(_testContext);

            projectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(serverConfiguration.TeamProjectCollectionUrl));
            testManagement    = projectCollection.GetService <ITestManagementService>().GetTeamProject(serverConfiguration.TeamProjectName);

            InitializeTestData();
        }
        public void CreateBasicDocumentByIdWithValidConfigFile_EnsureThatConnectionInformationisSavedInDocumentMode_ShouldCreateDocumentWithValidConnectionInfo()
        {
            Assert.IsTrue(File.Exists("Config\\ConfigurationNew1.xml"));
            CommonConfiguration.ReplaceConfigFileTokens(_testContext);
            var fileName = GetTempDocumentNameAndCreateTempFolder();

            //Create Doc conf
            var documentConfiguration = new DocumentConfiguration(null, null, null, null, false, false, "Config\\ConfigurationNew1.xml", false, null, TraceLevel.Verbose);

            documentConfiguration.Settings.Filename = fileName;

            var crm = new ConsoleExtensionHelper(new TestReportingProgressCancellationService(false));

            crm.CreateWorkItemDocument(documentConfiguration, WorkItemToImport, "ByID");

            //Wait for the import to finish
            Assert.IsTrue(File.Exists(fileName));
        }
        public void CreateBasicDocumentByIdWithValidConfigFileWithoutTestConfiguratioNsettings_ShouldCreateDocument()
        {
            Assert.IsTrue(File.Exists("Config/ConfigurationWithoutTestConfiguration.xml"));
            CommonConfiguration.ReplaceConfigFileTokens(_testContext);
            var fileName = GetTempDocumentNameAndCreateTempFolder();

            //Create Doc conf
            var documentConfiguration = new DocumentConfiguration(null, null, null, null, false, false, "Config/ConfigurationWithoutTestConfiguration.xml", false, null, TraceLevel.Verbose);

            documentConfiguration.Settings.Filename = fileName;

            var crm = new ConsoleExtensionHelper(new TestReportingProgressCancellationService(false));

            crm.CreateWorkItemDocument(documentConfiguration, WorkItemToImport, "ByID");

            //Wait for the import to finish
            while (crm.IsImporting)
            {
                Thread.CurrentThread.Join(50);
            }
            Assert.IsTrue(File.Exists(fileName));
        }
示例#7
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();
            }
        }
示例#8
0
 public static void ClassInitialize(TestContext testContext)
 {
     _testContext = testContext;
     CommonConfiguration.ReplaceConfigFileTokens(_testContext);
     AIT.TFS.SyncService.Service.AssemblyInit.Instance.Init();
 }