コード例 #1
0
        private async Task <int> GetNumberOfTestCasesInPlan()
        {
            int res = 0;

            TFSCommonFunctions commonFunctions = new TFSCommonFunctions(_props);
            string             wiqlId          = await commonFunctions.GatherWiqlId("/Shared Queries/Reporting/NumberOfTestCases");

            var requestUri = "/APHP/" + _project + "/_apis/wit/wiql/" + wiqlId + "?api-version=3.0";
            var method     = new HttpMethod("GET");
            var request    = new HttpRequestMessage(method, requestUri)
            {
            };
            var response = await _client.SendAsync(request);

            if (response.IsSuccessStatusCode)
            {
                string workItem = await response.Content.ReadAsStringAsync();

                JObject jo = JObject.Parse(workItem);

                res = jo["workItems"].Count <JToken>();
            }

            return(res);
        }
コード例 #2
0
        public GetDefectWithTestCaseCount(Properties props)
        {
            _project      = props.Project;
            _fileLocation = props.SaveLocation;
            _testPlanId   = props.TestPlanId;
            _testSuite    = props.TestSuiteId;

            _logger = props.Logger;
            HttpClientInitiator clientInitator = new HttpClientInitiator(props.Uri, props.PersonalAccessToken);

            _client = clientInitator.CreateHttpClient();
            _client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));

            _testCaseIdToResults = new Dictionary <int, List <TestCaseResult> >();

            _tfsCommonFunctions = new TFSCommonFunctions(props);

            if (props.UseWebApi == 1)
            {
                _allTestCaseId = GetTestCasesWebApi.GetAllTestCaseIds().Result;
            }
            else
            {
                GetTestCasesInSuite getTestCaseInSuite = new GetTestCasesInSuite(props);
                List <TestCase>     allTestCases       = getTestCaseInSuite.GatherTestCases();
                _allTestCaseId = new List <int>();
                foreach (TestCase currTestCase in allTestCases)
                {
                    _allTestCaseId.Add(currTestCase.TestCaseId);
                }
            }
        }
コード例 #3
0
        public Properties GetProps(Properties props)
        {
            //Excel.Application _xlApp = new Excel.Application();
            //Excel.Workbook _xlWorkbook = null;
            //_xlWorkbook = null;

            //try
            //{
            //    //xlWorkbook = xlApp.Workbooks.Open(_fileLocation);
            //    _xlWorkbook = _xlApp.Workbooks.Open(_fileLocation);
            //}
            //catch
            //{
            //    Console.Write("File Location/Name is not valid. Please press Enter and run the program again.");
            //    Console.ReadLine();
            //    Environment.Exit(0);
            //}

            ////Excel._Worksheet xlWorksheet = xlWorkbook.Sheets[1];
            //_xlWorksheet = _xlWorkbook.Sheets[1];
            //Excel.Range xlRange = xlWorksheet.UsedRange;

            Console.WriteLine("Upload properties are currently being read.");

            Dictionary <string, string> res = new Dictionary <string, string>();

            //for (int i = 1; i <= 3; i++)
            //{
            //    res.Add(_xlRange.Cells[i, 1].Value2, _xlRange.Cells[i, 2].Value2);
            //}

            res["Server"]  = _xlWorksheet.Cells[1, 2].Value2.ToString();
            res["Project"] = _xlWorksheet.Cells[2, 2].Value2.ToString();
            res["Personal Access Token"] = _xlWorksheet.Cells[3, 2].Value2.ToString();
            res["Test Plan ID"]          = _xlWorksheet.Cells[4, 2].Value2.ToString();
            res["Test Suite ID"]         = _xlWorksheet.Cells[5, 2].Value2.ToString();
            res["Iteration"]             = _xlWorksheet.Cells[1, 4].Value2.ToString();

            //Properties props = new Properties();
            props.PersonalAccessToken = res["Personal Access Token"];
            props.Project             = res["Project"];
            props.Uri         = res["Server"];
            props.TestPlanId  = Convert.ToInt32(res["Test Plan ID"]);
            props.TestSuiteId = Convert.ToInt32(res["Test Suite ID"]);
            props.Iteration   = Convert.ToInt32(res["Iteration"]);

            TFSCommonFunctions commonFunctions = new TFSCommonFunctions(props);

            //_userName = commonFunctions.GetUserName();

            return(props);
        }