예제 #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_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);
        }
예제 #3
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);
        }
예제 #4
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);
        }
예제 #5
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);
        }
예제 #6
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);
        }
예제 #7
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);
        }