示例#1
0
        internal static int Add_Queries(
            Excel.XlLocation insertAt,
            Options_AZDO_TFS options,
            ITestManagementTeamProject testManagementTeamProject)
        {
            Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_CATEGORY);

            int itemCount  = 0;
            int totalItems = testManagementTeamProject.Queries.Count;

            XlHlp.DisplayInWatchWindow($"Processing ({ totalItems } Queries");

            foreach (ITestCaseQuery query in testManagementTeamProject.Queries)
            {
                insertAt.ClearOffsets();

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), testManagementTeamProject.TeamProjectName);

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), query.Name);
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), query.Owner);
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), query.QueryText);

                insertAt.IncrementRows();
                itemCount++;

                AZDOHelper.ProcessItemDelay(options);
                AZDOHelper.DisplayLoopUpdates(startTicks, options, totalItems, itemCount);
            }

            Log.APPLICATION("Exit", Common.LOG_CATEGORY, startTicks);

            return(itemCount);
        }
示例#2
0
        internal static int Add_TestResolutionStates(
            Excel.XlLocation insertAt,
            Options_AZDO_TFS options,
            ITestManagementTeamProject testManagementTeamProject)
        {
            Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_CATEGORY);

            int itemCount = 0;

            IEnumerable <ITestResolutionState> testResolutionStates = testManagementTeamProject.TestResolutionStates.Query();
            int totalItems = testResolutionStates.Count();

            XlHlp.DisplayInWatchWindow($"Processing ({ totalItems } testResolutionStates");

            foreach (ITestResolutionState testResolutionState in testManagementTeamProject.TestResolutionStates.Query())
            {
                insertAt.ClearOffsets();

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), testManagementTeamProject.TeamProjectName);

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testResolutionState.Id}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testResolutionState.Name}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testResolutionState.Project.TeamProjectName}");

                insertAt.IncrementRows();
                itemCount++;

                //ProcessItemDelay(options);
                AZDOHelper.DisplayLoopUpdates(startTicks, options, totalItems, itemCount);
            }

            Log.APPLICATION("Exit", Common.LOG_CATEGORY, startTicks);

            return(itemCount);
        }
示例#3
0
        internal static void CreateWS_All_TPC_LastChangeset(Options_AZDO_TFS options,
                                                            VersionControlServer versionControlServer)
        {
            Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_CATEGORY);

            try
            {
                XlHlp.XlLocation insertAt = CreateNewWorksheet(string.Format("{0}_{1}", "All_TPC", "LastChangeset"),
                                                               options);

                XlHlp.AddLabeledInfoX(insertAt.AddRowX(), "Last Changeset All TeamProjects", AzureDevOpsExplorer.Presentation.Views.Server.TfsTeamProjectCollection.Name);

                insertAt.MarkStart(XlHlp.MarkType.GroupTable);

                Header_VersionControlServer.Add_Changesets(insertAt);

                //Body_VersionControlServer.Add_Changesets(insertAt, options, versionControlServer);

                foreach (var teamProjectName in options.TeamProjects)
                {
                    insertAt.ClearOffsets();

                    long loopTicks = Log.Trace($"Processing {teamProjectName}", Common.PROJECT_NAME);

                    TeamProject teamProject = VNCTFS.Helper.Get_TeamProject(versionControlServer, teamProjectName.Trim());

                    if (teamProject != null)
                    {
                        Globals.ThisAddIn.Application.StatusBar = $"Processing {teamProject.Name}";

                        Body_VersionControlServer.Add_TP_Changesets(insertAt, options,
                                                                    Presentation.Views.Server.VersionControlServer, teamProject);

                        AZDOHelper.ProcessLoopDelay(options);
                    }
                    else
                    {
                        XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), teamProjectName);
                        XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), "No VCS Project");
                        insertAt.IncrementRows();
                    }

                    Log.Trace($"EndProcessing {teamProjectName}", Common.PROJECT_NAME, loopTicks);
                }

                insertAt.MarkEnd(XlHlp.MarkType.GroupTable, string.Format("tbl_{0}", insertAt.workSheet.Name));

                insertAt.Group(insertAt.OrientVertical, hide: true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            Log.APPLICATION("Exit", Common.LOG_CATEGORY, startTicks);
        }
示例#4
0
        internal static int Add_TestVariables(
            Excel.XlLocation insertAt,
            Options_AZDO_TFS options,
            ITestManagementTeamProject testManagementTeamProject)
        {
            Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_CATEGORY);

            int itemCount = 0;

            string query = String.Format(
                "SELECT *"
                + " FROM TestVariable");

            IEnumerable <ITestVariable> testVariables = testManagementTeamProject.TestVariables.Query();
            int totalItems = testVariables.Count();

            XlHlp.DisplayInWatchWindow($"Processing ({ totalItems } testVariables");

            foreach (ITestVariable testVariable in testVariables)
            {
                insertAt.ClearOffsets();

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testManagementTeamProject.TeamProjectName}");

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testVariable.Id}");

                StringBuilder allowedValues = new StringBuilder();

                foreach (var item in testVariable.AllowedValues)
                {
                    if (allowedValues.Length == 0)
                    {
                        allowedValues.Append($"{item.Value}");
                    }
                    else
                    {
                        allowedValues.Append($"; {item.Value}");
                    }
                }

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{allowedValues}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testVariable.Description}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testVariable.Name}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testVariable.Revision}");

                insertAt.IncrementRows();
                itemCount++;

                AZDOHelper.ProcessItemDelay(options);
                AZDOHelper.DisplayLoopUpdates(startTicks, options, totalItems, itemCount);
            }

            Log.APPLICATION("Exit", Common.LOG_CATEGORY, startTicks);

            return(itemCount);
        }
示例#5
0
        internal static int Add_TestSuites(
            Excel.XlLocation insertAt,
            Options_AZDO_TFS options,
            ITestManagementTeamProject testManagementTeamProject)
        {
            Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_CATEGORY);

            int itemCount = 0;

            //string query = String.Format(
            //    "SELECT [System.Id], [System.Title]"
            //    + " FROM WorkItems"
            //    + " WHERE [System.WorkItemType] = 'Test Suite'"
            //    + " AND [Team Project] = '{0}'", testManagementTeamProject.TeamProjectName);

            string query = String.Format(
                "SELECT *"
                + " FROM TestSuite"
                );

            ITestSuiteCollection testSuites = testManagementTeamProject.TestSuites.Query(query);
            int totalItems = testSuites.Count;

            XlHlp.DisplayInWatchWindow($"Processing ({ totalItems } testSuites");

            foreach (var testSuite in testSuites)
            {
                insertAt.ClearOffsets();

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testManagementTeamProject.TeamProjectName}");

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSuite.Id}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSuite.Title}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSuite.Description}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSuite.State}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSuite.LastUpdated}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSuite.LastUpdatedByName}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSuite.TestCaseCount}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSuite.TestSuiteType}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSuite.AllTestCases.Count}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSuite.Revision}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSuite.Plan.Id}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSuite.Plan.Name}");

                insertAt.IncrementRows();
                itemCount++;

                AZDOHelper.ProcessItemDelay(options);
                AZDOHelper.DisplayLoopUpdates(startTicks, options, totalItems, itemCount);
            }

            Log.APPLICATION("Exit", Common.LOG_CATEGORY, startTicks);

            return(itemCount);
        }
示例#6
0
        internal static int Add_TestResults(
            Excel.XlLocation insertAt,
            Options_AZDO_TFS options,
            ITestManagementTeamProject testManagementTeamProject)
        {
            Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_CATEGORY);

            int itemCount = 0;

            string query = String.Format(
                "SELECT *"
                + " FROM TestResult"
                + " WHERE [DateCreated] > '1/1/2021'");

            ITestCaseResultCollection testCaseResults = testManagementTeamProject.TestResults.Query(query);
            int totalItems = testCaseResults.Count;

            int[] associatedWIs = testCaseResults.QueryAssociatedWorkItems();

            XlHlp.DisplayInWatchWindow($"Processing ({ totalItems }) testCaseResults");

            foreach (ITestResult testResult in testCaseResults)
            {
                insertAt.ClearOffsets();

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), testManagementTeamProject.TeamProjectName);

                // IAttachmentOwner

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testResult.Attachments.Count}");

                // ITestResult
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testResult.CollectorsEnabled.Count}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testResult.Comment}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testResult.DateCreated}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testResult.DateStarted}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testResult.DateCompleted}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testResult.Duration}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testResult.ErrorMessage}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testResult.Outcome}");



                insertAt.IncrementRows();
                itemCount++;

                AZDOHelper.ProcessItemDelay(options);
                AZDOHelper.DisplayLoopUpdates(startTicks, options, totalItems, itemCount);
            }

            Log.APPLICATION("Exit", Common.LOG_CATEGORY, startTicks);

            return(itemCount);
        }
示例#7
0
        internal static int Add_TestEnvironments(
            Excel.XlLocation insertAt,
            Options_AZDO_TFS options,
            ITestManagementTeamProject testManagementTeamProject)
        {
            Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_CATEGORY);

            int itemCount = 0;

            string query = String.Format(
                "SELECT *"
                + " FROM TestEnvironment");

            var testEnvironments = testManagementTeamProject.TestEnvironments.Query();
            var totalItems       = testEnvironments.Count();

            XlHlp.DisplayInWatchWindow($"Processing ({ totalItems } testEnvironments");

            foreach (ITestEnvironment testEnvironment in testEnvironments)
            {
                insertAt.ClearOffsets();
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), testManagementTeamProject.TeamProjectName);

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), testEnvironment.Id.ToString());
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.Name}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.ControllerDisplayName}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.ControllerEnvironmentId}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.ControllerName}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.DateCreated}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.Description}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.DisplayName}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.EnvironmentType}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.Error}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.InvalidProperties.Count()}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.IsDirty}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.LabEnvironmentUri}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.LabServerUri}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.MachineRoles.Count}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.Owner}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.TeamProject.TeamProjectName}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.TestController.Name}");

                insertAt.IncrementRows();
                itemCount++;

                //ProcessItemDelay(options);
                AZDOHelper.DisplayLoopUpdates(startTicks, options, totalItems, itemCount);
            }

            Log.APPLICATION("Exit", Common.LOG_CATEGORY, startTicks);

            return(itemCount);
        }
示例#8
0
        internal static int Add_TestConfigurations(Excel.XlLocation insertAt,
                                                   Options_AZDO_TFS options,
                                                   ITestManagementTeamProject testManagementTeamProject)
        {
            Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_CATEGORY);

            int itemCount = 0;

            string query = String.Format(
                "SELECT *"
                + " FROM TestConfiguration");

            ITestConfigurationCollection testConfigurations = testManagementTeamProject.TestConfigurations.Query(query);
            int totalItems = testConfigurations.Count;

            XlHlp.DisplayInWatchWindow($"Processing ({ totalItems } testConfigurations");

            foreach (ITestConfiguration testConfiguration in testConfigurations)
            {
                insertAt.ClearOffsets();
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testManagementTeamProject.TeamProjectName}");

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testConfiguration.Id}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testConfiguration.Name}");

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testConfiguration.AreaPath}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testConfiguration.Description}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testConfiguration.IsDefault}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testConfiguration.LastUpdated}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testConfiguration.LastUpdatedByName}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testConfiguration.Revision}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testConfiguration.State}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testConfiguration.Values.Count}");

                insertAt.IncrementRows();
                itemCount++;

                //ProcessItemDelay(options);
                AZDOHelper.DisplayLoopUpdates(startTicks, options, totalItems, itemCount);
            }

            Log.APPLICATION("Exit", Common.LOG_CATEGORY, startTicks);

            return(itemCount);
        }
示例#9
0
        internal static int Add_TestSettings(
            Excel.XlLocation insertAt,
            Options_AZDO_TFS options,
            ITestManagementTeamProject testManagementTeamProject)
        {
            Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_CATEGORY);

            int itemCount = 0;

            string query = String.Format(
                "SELECT *"
                + " FROM TestSettings");

            IEnumerable <ITestSettings> testSettings = testManagementTeamProject.TestSettings.Query(query);
            int totalItems = testSettings.Count();

            XlHlp.DisplayInWatchWindow($"Processing ({ totalItems } testRuns");

            foreach (ITestSettings testSetting in testSettings)
            {
                insertAt.ClearOffsets();

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testManagementTeamProject.TeamProjectName}");

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSetting.Id}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSetting.IsAutomated}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSetting.LastUpdated}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSetting.LastUpdatedBy}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSetting.MachineRoles.Count}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSetting.Name}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSetting.Revision}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSetting.Settings}");

                insertAt.IncrementRows();
                itemCount++;

                AZDOHelper.ProcessItemDelay(options);
                AZDOHelper.DisplayLoopUpdates(startTicks, options, totalItems, itemCount);
            }

            Log.APPLICATION("Exit", Common.LOG_CATEGORY, startTicks);

            return(itemCount);
        }
示例#10
0
        internal static int Add_TestRuns(
            Excel.XlLocation insertAt,
            Options_AZDO_TFS options,
            ITestManagementTeamProject testManagementTeamProject)
        {
            Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_CATEGORY);

            int itemCount = 0;

            string query = String.Format(
                "SELECT *"
                + " FROM TestRun");
            //+ " WHERE [DateCreated] > '1/1/2021'");

            IEnumerable <ITestRun> testRuns = testManagementTeamProject.TestRuns.Query(query);
            int totalItems = testRuns.Count();

            XlHlp.DisplayInWatchWindow($"Processing ({ totalItems } testRuns");

            foreach (ITestRun testRun in testRuns)
            {
                insertAt.ClearOffsets();

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), testManagementTeamProject.TeamProjectName);

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.Title}");

                // IAttachmentOwner

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.Attachments.Count}");

                // ITestRun

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.BuildConfigurationId}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.BuildDirectory}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.BuildFlavor}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.BuildNumber}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.BuildPlatform}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.BuildUri}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.IsBvt}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.Iteration}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.LastUpdated}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.LastUpdatedByName}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.LinkedWorkItemCount}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.NotApplicableTests}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.OwnerName}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.PassedTests}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.PostProcessState}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.Project.TeamProjectName}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.Revision}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.State}");

                try
                {
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.Statistics.CompletedTests}");
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.Statistics.FailedTests}");
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.Statistics.InconclusiveTests}");
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.Statistics.InProgressTests}");
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.Statistics.PassedTests}");
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.Statistics.PendingTests}");
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.Statistics.TotalTests}");
                }
                catch (Exception ex)
                {
                    var message = ex.ToString();
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), "<Exception>");
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), "<Exception>");
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), "<Exception>");
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), "<Exception>");
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), "<Exception>");
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), "<Exception>");
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), "<Exception>");
                }

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.TestEnvironmentId}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.TestMessageLogEntries.Count}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.TestPlanId}");

                string testSettingsName = "<null>";
                string testSettingsId   = "<null>";

                if (testRun.TestSettings != null)
                {
                    testSettingsName = $"{testRun.TestSettings.Name}";
                    testSettingsId   = $"{testRun.TestSettings.Id}";
                }

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), testSettingsName);
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), testSettingsId);

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.TestSettingsId}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.TotalTests}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.Type}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.UnanalyzedTests}");
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testRun.Version}");

                insertAt.IncrementRows();
                itemCount++;

                AZDOHelper.ProcessItemDelay(options);
                AZDOHelper.DisplayLoopUpdates(startTicks, options, totalItems, itemCount);
            }

            Log.APPLICATION("Exit", Common.LOG_CATEGORY, startTicks);

            return(itemCount);
        }
示例#11
0
        internal static int Add_TestPlans(
            Excel.XlLocation insertAt,
            Options_AZDO_TFS options,
            ITestManagementTeamProject testManagementTeamProject)
        {
            Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_CATEGORY);

            int itemCount = 0;

            //string query = String.Format(
            //    "SELECT [System.Id]"
            //    + " FROM TestPlan"
            //    + " WHERE [Team Project] = '{0}'", testManagementTeamProject.TeamProjectName);

            string query = String.Format(
                "SELECT *"
                + " FROM TestPlan");

            ITestPlanCollection testPlans = testManagementTeamProject.TestPlans.Query(query);
            int totalItems = testPlans.Count;

            XlHlp.DisplayInWatchWindow($"Processing ({ totalItems } testPlans");

            foreach (var testPlan in testPlans)
            {
                insertAt.ClearOffsets();

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testManagementTeamProject.TeamProjectName}");

                try
                {
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testPlan.Id}");
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testPlan.Name}");
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testPlan.Description}");
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testPlan.State}");
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testPlan.AreaPath}");
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testPlan.Iteration}");
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testPlan.StartDate}");
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testPlan.EndDate}");

                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testPlan.OwnerName}");
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testPlan.LastUpdated}");
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testPlan.LastUpdatedByName}");
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testPlan.Revision}");
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testPlan.Links.Count}");
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testPlan.RootSuite.Id}");
                }
                catch (Exception ex)
                {
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{ex}");
                }

                insertAt.IncrementRows();
                itemCount++;

                AZDOHelper.ProcessItemDelay(options);
                AZDOHelper.DisplayLoopUpdates(startTicks, options, totalItems, itemCount);
            }

            Log.APPLICATION("Exit", Common.LOG_CATEGORY, startTicks);

            return(itemCount);
        }
示例#12
0
        internal static XlHlp.XlLocation Add_Members(
            XlHlp.XlLocation insertAt,
            Options_AZDO_TFS options)
        {
            long startTicks = XlHlp.DisplayInWatchWindow(insertAt);

            TeamFoundationIdentity everyone = AzureDevOpsExplorer.Presentation.Views.Server.IdentityManagementService.ReadIdentity(
                GroupWellKnownDescriptors.EveryoneGroup, MembershipQuery.Direct, ReadIdentityOptions.None);

            TeamFoundationIdentity licensees = AzureDevOpsExplorer.Presentation.Views.Server.IdentityManagementService.ReadIdentity(
                GroupWellKnownDescriptors.LicenseesGroup, MembershipQuery.Direct, ReadIdentityOptions.None);

            TeamFoundationIdentity namespaceAdministrators = AzureDevOpsExplorer.Presentation.Views.Server.IdentityManagementService.ReadIdentity(
                GroupWellKnownDescriptors.NamespaceAdministratorsGroup, MembershipQuery.Direct, ReadIdentityOptions.None);

            TeamFoundationIdentity serviceUsers = AzureDevOpsExplorer.Presentation.Views.Server.IdentityManagementService.ReadIdentity(
                GroupWellKnownDescriptors.ServiceUsersGroup, MembershipQuery.Direct, ReadIdentityOptions.None);

            if (everyone != null)
            {
                insertAt.ClearOffsets();

                XlHlp.AddLabeledInfo(insertAt.AddRow(), "Everyone", everyone.Members.Count().ToString());

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), everyone.DisplayName);
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), everyone.UniqueName);
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), everyone.Descriptor.IdentityType);

                insertAt.IncrementRows();
            }
            else
            {
                XlHlp.AddLabeledInfo(insertAt.AddRow(), "Everyone", "null");
            }

            if (licensees != null)
            {
                insertAt.ClearOffsets();

                XlHlp.AddLabeledInfo(insertAt.AddRow(), "Licensees", licensees.Members.Count().ToString());

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), licensees.DisplayName);
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), licensees.UniqueName);
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), licensees.Descriptor.IdentityType);

                insertAt.IncrementRows();
            }
            else
            {
                XlHlp.AddLabeledInfoX(insertAt.AddRowX(), "Licensees", "null");
            }

            if (namespaceAdministrators != null)
            {
                insertAt.ClearOffsets();

                XlHlp.AddLabeledInfo(insertAt.AddRow(), "NamespaceAdministrators", namespaceAdministrators.Members.Count().ToString());

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), namespaceAdministrators.DisplayName);
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), namespaceAdministrators.UniqueName);
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), namespaceAdministrators.Descriptor.IdentityType);

                insertAt.IncrementRows();
            }
            else
            {
                XlHlp.AddLabeledInfo(insertAt.AddRow(), "NamespaceAdministrators", "null");
            }

            if (serviceUsers != null)
            {
                insertAt.ClearOffsets();

                XlHlp.AddLabeledInfo(insertAt.AddRow(), "ServiceUsers", serviceUsers.Members.Count().ToString());

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), serviceUsers.DisplayName);
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), serviceUsers.UniqueName);
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), serviceUsers.Descriptor.IdentityType);

                insertAt.IncrementRows();
            }
            else
            {
                XlHlp.AddLabeledInfoX(insertAt.AddRowX(), "ServiceUsers", "null");
            }

            TeamFoundationIdentity everyoneExpanded = AzureDevOpsExplorer.Presentation.Views.Server.IdentityManagementService.ReadIdentity(
                GroupWellKnownDescriptors.EveryoneGroup, MembershipQuery.Expanded, ReadIdentityOptions.None);

            TeamFoundationIdentity everyoneExpanded2 = AzureDevOpsExplorer.Presentation.Views.Server.IdentityManagementService.ReadIdentity(
                GroupWellKnownDescriptors.EveryoneGroup, MembershipQuery.Expanded, ReadIdentityOptions.IncludeReadFromSource);

            if (everyoneExpanded != null)
            {
                AZDOHelper.FetchIdentities(everyoneExpanded.Members, _Global_Groups, _Global_Identities);
            }

            TeamFoundationIdentity licenseesExpanded = AzureDevOpsExplorer.Presentation.Views.Server.IdentityManagementService.ReadIdentity(
                GroupWellKnownDescriptors.LicenseesGroup, MembershipQuery.Expanded, ReadIdentityOptions.None);

            if (licenseesExpanded != null)
            {
                AZDOHelper.FetchIdentities(licenseesExpanded.Members, _Global_Groups, _Global_Identities);
            }

            TeamFoundationIdentity serviceUsersExpanded = AzureDevOpsExplorer.Presentation.Views.Server.IdentityManagementService.ReadIdentity(
                GroupWellKnownDescriptors.ServiceUsersGroup, MembershipQuery.Expanded, ReadIdentityOptions.None);

            if (serviceUsersExpanded != null)
            {
                AZDOHelper.FetchIdentities(serviceUsersExpanded.Members, _Global_Groups, _Global_Identities);
            }

            TeamFoundationIdentity namespaceAdministratorsExpanded = AzureDevOpsExplorer.Presentation.Views.Server.IdentityManagementService.ReadIdentity(
                GroupWellKnownDescriptors.NamespaceAdministratorsGroup, MembershipQuery.Expanded, ReadIdentityOptions.None);

            if (namespaceAdministratorsExpanded != null)
            {
                AZDOHelper.FetchIdentities(namespaceAdministratorsExpanded.Members, _Global_Groups, _Global_Identities);
            }

            XlHlp.AddLabeledInfoX(insertAt.AddRowX(), "All Groups and Identities", "Lots");

            insertAt.MarkStart(XlHlp.MarkType.GroupTable);

            // Keep in same order as fields, infra.

            // Group

            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 50, "Top Level");

            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 50, "Group Identifier");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 50, "Group Identity");

            // Members

            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 15, "IsContainer");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 30, "TeamFoundationId");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 50, "DisplayName");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 80, "UniqueName");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 40, "IdentityType");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 40, "Identity");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "UniqueUserId");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 10, "IsActive");


            insertAt.IncrementRows();

            foreach (TeamFoundationIdentity identity in _Global_Groups)
            {
                Globals.ThisAddIn.Application.StatusBar = "Processing " + identity.DisplayName;

                foreach (IdentityDescriptor member in identity.Members)
                {
                    insertAt.ClearOffsets();

                    // Top Level

                    string topLevel = "";

                    MatchCollection matches = Regex.Matches(identity.DisplayName, @"\[.*\]");

                    if (matches.Count == 1)
                    {
                        topLevel = matches[0].Value;
                    }
                    else
                    {
                        topLevel = identity.DisplayName;
                    }

                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), topLevel);

                    // Group

                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), identity.Descriptor.Identifier);
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), identity.DisplayName);

                    // Members

                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), _Global_Identities[member].IsContainer.ToString());
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), _Global_Identities[member].TeamFoundationId.ToString());
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), _Global_Identities[member].DisplayName);
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), _Global_Identities[member].UniqueName);
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), _Global_Identities[member].Descriptor.IdentityType);
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), _Global_Identities[member].Descriptor.Identifier);
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), _Global_Identities[member].UniqueUserId.ToString());
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), _Global_Identities[member].IsActive.ToString());

                    insertAt.IncrementRows();
                }
            }

            insertAt.MarkEnd(XlHlp.MarkType.GroupTable, string.Format("tblMembers_{0}", insertAt.workSheet.Name));

            insertAt.Group(insertAt.OrientVertical);

            if (!insertAt.OrientVertical)
            {
                // Skip past the info just added.
                insertAt.SetLocation(insertAt.RowStart, insertAt.MarkEndColumn + 1);
            }

            XlHlp.DisplayInWatchWindow(insertAt, startTicks, "End");

            return(insertAt);
        }
示例#13
0
        internal static XlHlp.XlLocation Add_Members(
            XlHlp.XlLocation insertAt,
            TeamProject teamProject)
        {
            long startTicks = XlHlp.DisplayInWatchWindow(insertAt);

            try
            {
                int currentRows = insertAt.RowsAdded;

                // Save the location of the count so we can update later after have traversed all items.

                Range rngTitle = insertAt.GetCurrentRange();

                if (insertAt.OrientVertical)
                {
                    XlHlp.AddSectionInfo(insertAt.AddRow(),
                                         "Members Group", "");
                }
                else
                {
                    XlHlp.AddSectionInfo(insertAt.AddRow(),
                                         "Members Group", "",
                                         orientation: XlOrientation.xlUpward);
                    insertAt.IncrementColumns();
                }

                TeamFoundationIdentity[] projectGroups = AzureDevOpsExplorer.Presentation.Views.Server.IdentityManagementService.ListApplicationGroups(
                    teamProject.ArtifactUri.AbsoluteUri, ReadIdentityOptions.None);

                Dictionary <IdentityDescriptor, object> descriptorSet = new Dictionary <IdentityDescriptor, object>(IdentityDescriptorComparer.Instance);

                foreach (TeamFoundationIdentity projectGroup in projectGroups)
                {
                    descriptorSet[projectGroup.Descriptor] = projectGroup.Descriptor;
                }

                // Expanded membership of project groups
                projectGroups = AzureDevOpsExplorer.Presentation.Views.Server.IdentityManagementService.ReadIdentities(descriptorSet.Keys.ToArray(), MembershipQuery.Expanded, ReadIdentityOptions.None);

                // Collect all descriptors
                foreach (TeamFoundationIdentity projectGroup in projectGroups)
                {
                    foreach (IdentityDescriptor mem in projectGroup.Members)
                    {
                        descriptorSet[mem] = mem;
                    }
                }

                // NOTE(crhodes)
                // Might need to ensure that _Global_Groups and _Global_Identities already populated.

                if (Section_TeamProjectCollection._Global_Identities.Count == 0)
                {
                    TeamFoundationIdentity everyoneExpanded = AzureDevOpsExplorer.Presentation.Views.Server.IdentityManagementService.ReadIdentity(
                        GroupWellKnownDescriptors.EveryoneGroup, MembershipQuery.Expanded, ReadIdentityOptions.None);
                    AZDOHelper.FetchIdentities(everyoneExpanded.Members, Section_TeamProjectCollection._Global_Groups, Section_TeamProjectCollection._Global_Identities);
                }


                _TeamProject_Groups.Clear();
                _TeamProject_Identities.Clear();

                AZDOHelper.FetchIdentities(descriptorSet.Keys.ToArray(), _TeamProject_Groups, _TeamProject_Identities);

                insertAt.MarkStart(XlHlp.MarkType.GroupTable);
                // Keep in same order as fields, infra.

                // Group

                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 50, "Identifier");
                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 50, "Identity");

                // Members

                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 15, "IsContainer");
                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 50, "DisplayName");
                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 80, "UniqueName");
                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 40, "IdentityType");
                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "UniqueUserId");
                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 10, "IsActive");

                insertAt.IncrementRows();

                foreach (TeamFoundationIdentity identity in _TeamProject_Groups)
                {
                    foreach (IdentityDescriptor member in identity.Members)
                    {
                        insertAt.ClearOffsets();

                        try
                        {
                            // Group

                            XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), identity.Descriptor.Identifier);
                            XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), identity.DisplayName);

                            // Members

                            // NOTE(crhodes)
                            // This line is throwing exception.  Why?

                            XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), Section_TeamProjectCollection._Global_Identities[member].IsContainer.ToString());
                            XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), Section_TeamProjectCollection._Global_Identities[member].DisplayName);
                            XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), Section_TeamProjectCollection._Global_Identities[member].UniqueName);
                            XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), Section_TeamProjectCollection._Global_Identities[member].Descriptor.IdentityType);
                            XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), Section_TeamProjectCollection._Global_Identities[member].UniqueUserId.ToString());
                            XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), Section_TeamProjectCollection._Global_Identities[member].IsActive.ToString());
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.ToString());
                        }

                        insertAt.IncrementRows();
                    }
                }

                insertAt.MarkEnd(XlHlp.MarkType.GroupTable, string.Format("tblTPMembers_{0}", insertAt.workSheet.Name));

                insertAt.Group(insertAt.OrientVertical);

                // Update counts.  -2 covers Header and Table Column Header

                if (insertAt.OrientVertical)
                {
                    XlHlp.AddLabeledInfoX(rngTitle, "Members Group", (insertAt.RowsAdded - currentRows - 2).ToString());
                }
                else
                {
                    XlHlp.AddLabeledInfoX(rngTitle, "Members Group", (insertAt.RowsAdded - currentRows - 2).ToString(), orientation: XlOrientation.xlUpward);
                }

                insertAt.EndSectionAndSetNextLocation(insertAt.OrientVertical);

                //insertAt.AddRow();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            XlHlp.DisplayInWatchWindow(insertAt, startTicks, "End");

            return(insertAt);
        }