Пример #1
0
 /// <summary>
 /// Method for Posting the Test status and failure information(if any) to Test Rail
 /// </summary>
 /// <param name="client"></param>
 /// <param name="RunId"></param>
 /// <param name="TestCaseId"></param>
 /// <param name="testResult"></param>
 public void PostResultToTestRail(Gurock.TestRail.APIClient client, string RunId, Dictionary <string, Object> testResult)
 {
     //RunId = GetRunId();
     TestCaseId = GetTestCase();
     try
     {
         client.SendPost("add_result_for_case/" + RunId + "/" + TestCaseId + "", testResult);
         _testRailUtilsLog.Info("Client Post is successfull");
     }
     catch (Exception ex)
     {
         _testRailUtilsLog.Error("Unable to Post the result to Test rail" + ex);
     }
 }
Пример #2
0
        /// <summary>
        /// Method for adding new MileStone to the project specfied in the Config File
        /// </summary>
        public string AddNewMileStone()
        {
            try
            {
                Gurock.TestRail.APIClient   client = GetTestRailClientConfig();
                Dictionary <string, object> data   = new Dictionary <string, object>();
                string MileStoneName = GenerateTestRunName("MileStone--");
                string Project_Id    = GetProjectID();
                data.Add("name", MileStoneName);
                string SuiteId = GetSuiteId();
                data.Add("include_all", 1);
                data.Add("suite_id", SuiteId);
                client.SendPost("add_milestone/" + Project_Id, data);//2
                _testRailUtilsLog.Info("Added New Milestone for Project ID : " + Project_Id + " Named as : " + MileStoneName);
                return(MileStoneName);
            }

            catch (Exception ex)
            {
                _testRailUtilsLog.Error("Unable to add new Milestone " + ex);
                return("");
            }
        }
Пример #3
0
        /// <summary>
        /// Method for generating a New Test Run Configuration at run time and Posting to the
        /// TestRail
        /// </summary>
        /// <returns>string</returns>

        public string AddTestRun()
        {
            try
            {
                Gurock.TestRail.APIClient   client = GetTestRailClientConfig();
                Dictionary <string, object> data   = new Dictionary <string, object>();
                string RunName     = GenerateTestRunName("TestRun-");
                string Project_Id  = GetProjectID();
                string MileStoneID = GetMileStone();
                string SuiteId     = GetSuiteId();
                data.Add("milestone_id", MileStoneID);
                data.Add("name", RunName);
                data.Add("include_all", 1);
                data.Add("suite_id", SuiteId);
                client.SendPost("add_run/" + Project_Id, data);//2
                return(RunName);
            }
            catch (Exception ex)
            {
                _testRailUtilsLog.Error("Unable to Add new Test Run " + ex);
                return(null);
            }
        }
Пример #4
0
        public void PostResultToTestRailUsingMileStones(Gurock.TestRail.APIClient client, Dictionary <string, Object> testResult)
        {
            string         MileStoneId = GetMileStoneId();
            IList <string> RunIds      = new List <string>();

            RunIds = GetRunIdsForProjectAndMileStone(MileStoneId);
            _testRailUtilsLog.Info("=====>>>>" + RunIds.ToString());
            _testRailUtilsLog.Info("size:=>" + RunIds.Count);
            foreach (string RunId in RunIds)
            {
                _testRailUtilsLog.Info("==>" + RunId);
                // _testRailUtilsLog.Info("&&" + RunId + "/" + TestCaseId);
                IList <string> TestCaseId = getCaseIdsForRun(RunId);
                foreach (string CaseId in TestCaseId)
                {
                    if (CaseId.Equals(GetTestCase()))
                    {
                        client.SendPost("add_result_for_case/" + RunId + "/" + CaseId + "", testResult);
                    }
                }
                _testRailUtilsLog.Info("Client Post is successfull");
            }
        }