Example #1
0
        public List <Tests> GetTests(string LastUpdateDate)
        {
            var client = new RestClient(conFIG.QACompleteEndPoint + "v1/projects/{projectID}/tests");

            var request = new RestRequest(Method.GET);

            request.AddUrlSegment("projectID", Project);
            request.AddQueryParameter("Filter", "(active=true) AND (DateUpdated >= '" + LastUpdateDate + "')");
            request.AddQueryParameter("limit", "2000");
            request.AddHeader("Authorization", Auth);

            var    response = client.Execute(request);
            string L        = response.Content;


            QACDataModel.TestsReturn testsReturn = JsonConvert.DeserializeObject <QACDataModel.TestsReturn>(L);

            return(testsReturn.results);
        }
Example #2
0
        public void SyncTestFromQACtoBPTestingApp(string Client_ShortName, string LastUpdateDate)
        {
            string Failed = "";
            List <QACDataModel.Tests> tests = new List <QACDataModel.Tests>();


            var client = new RestClient(conFIG.QACompleteEndPoint + "v1/projects/{projectID}/tests");

            var request = new RestRequest(Method.GET);

            request.AddUrlSegment("projectID", Project);
            request.AddQueryParameter("Filter", "(active=true) AND (DateUpdated >= '" + LastUpdateDate + "')");
            request.AddQueryParameter("limit", "2000");
            request.AddHeader("Authorization", Auth);

            var    response = client.Execute(request);
            string L        = response.Content;


            QACDataModel.TestsReturn testsReturn = JsonConvert.DeserializeObject <QACDataModel.TestsReturn>(L);

            string TC_IDNum, Title, Status, Desc, TestCase_Folder, TestCase_Folder_ID, TestCase_UpDated_Date;

            foreach (var Line in testsReturn.results)
            {
                TC_IDNum = " "; Title = " "; Status = " "; Desc = " "; TestCase_Folder = " "; TestCase_Folder_ID = " "; TestCase_UpDated_Date = " ";
                int ID = Line.id;
                TC_IDNum        = Convert.ToString(Line.id);
                Title           = Convert.ToString(Line.title);
                Status          = Convert.ToString(Line.status);
                Desc            = Convert.ToString(Line.description);
                TestCase_Folder = Convert.ToString(Line.folder_name);
                if (TestCase_Folder == null)
                {
                    TestCase_Folder = "";
                }
                if (Desc == null)
                {
                    Desc = "";
                }

                TestCase_Folder_ID = Convert.ToString(Line.folder_id);
                if (TestCase_Folder_ID == string.Empty || TestCase_Folder_ID == "")
                {
                    TestCase_Folder_ID = " ";
                }
                TestCase_UpDated_Date = Convert.ToString(Line.date_updated);
                try
                {
                    QADataModel.qac.TestCase TC = new QADataModel.qac.TestCase();
                    TC.Description = Desc;
                    TC.Folder      = TestCase_Folder;
                    try { TC.Folder_ID = Line.folder_id; } catch { }
                    TC.ID                = Convert.ToString(ID);
                    TC.Client_Short      = Client_ShortName;
                    TC.QAC_Updated_Date  = TestCase_UpDated_Date;
                    TC.Status            = 1;
                    TC.TestCase_IDNumber = Guid.NewGuid();
                    TC.Title             = Title;
                    var QADATAclient  = new RestClient(conFIG.QADataRestEndpoint + "api/QAComplete/TestCase");
                    var QADATArequest = new RestRequest(Method.POST);
                    QADATArequest.AddQueryParameter("loggedInas", "kconners");
                    QADATArequest.AddJsonBody(TC);
                    var QADATAresponse = QADATAclient.Execute(QADATArequest);
                }
                catch { Failed = Failed + "," + TC_IDNum; }
            }
        }