Ejemplo n.º 1
0
 private void btnExecute_Click(object sender, EventArgs e)
 {
     btnExecute.Enabled = false;
     txtInfo.Text       = "";
     if (validate().Length > 0)
     {
         txtInfo.Text      = validate();
         txtInfo.ForeColor = Color.Red;
     }
     else
     {
         if (issueType == IssueType.TestExecution)
         {
             List <FieldsTestExecution> fieldsIssues  = ExcelUtils.getDataTestExecution(txtDataPath.Text, txtProjectKey.Text);
             List <ResponseInfo>        responseInfos = new List <ResponseInfo>();
             foreach (var p in fieldsIssues)
             {
                 TestExecution issue = new TestExecution {
                     fields = p
                 };
                 ResponseInfo responseInfo = RestShapUtils.getInstance().doRequestCreateTestExecution(issue);
                 responseInfos.Add(responseInfo);
                 txtInfo.Text += "\n" + responseInfo.message;
             }
             saveFile(responseInfos);
         }
         else
         {
             List <FieldsSubTestExecution> fieldsSubTests = ExcelUtils.getDataSubTestExecution(txtDataPath.Text, txtProjectKey.Text);
             List <ResponseInfo>           responseInfos  = new List <ResponseInfo>();
             foreach (var p in fieldsSubTests)
             {
                 SubTestExecution issue = new SubTestExecution {
                     fields = p
                 };
                 ResponseInfo responseInfo = RestShapUtils.getInstance().doRequestCreateSubTestExecution(issue);
                 responseInfos.Add(responseInfo);
                 txtInfo.Text += "\n" + responseInfo.message;
             }
             saveFile(responseInfos);
         }
     }
     btnExecute.Enabled = true;
 }
Ejemplo n.º 2
0
        public ResponseInfo doRequestAddTestEnvironment(String projectKey, String testExecutionId, String testenvironment)
        {
            ResponseInfo responseInfo = new ResponseInfo();
            String       projectId    = doRequestGetProjectId(projectKey);
            String       enpoint      = TEST_ENVIRONMENT_ENDPOINT + "/" + testExecutionId + "/testEnvironments";
            String       body         = "{\"testEnvironments\":[\"" + testenvironment + "\"],\"projectId\":\"" + projectId + "\"}";
            var          client       = new RestClient(enpoint);
            var          request      = new RestRequest();
            String       xrayToken    = doRequestGeneraterXrayToken();

            request.AddHeader("Content-Type", ContentType.Json);
            request.AddHeader("X-acpt", xrayToken);
            request.AddJsonBody(body);
            IRestResponse response = client.Post(request);

            responseInfo.isSuccess = response.IsSuccessful;
            responseInfo.message   = response.Content;
            return(responseInfo);
        }
Ejemplo n.º 3
0
        public ResponseInfo doRequestAddTestExecutionToTestPlan(String testPlanKey, String testExecutionId)
        {
            ResponseInfo responseInfo = new ResponseInfo();
            String       testPlanId   = doRequestGetIssueId(testPlanKey);
            String       enpoint      = XRAY_BASE_URL + "api/internal/testplan/" + testPlanId + "/addTestExecs";
            String       xrayToken    = doRequestGeneraterXrayToken();
            var          client       = new RestClient(enpoint);
            var          request      = new RestRequest();

            request.AddHeader("Content-Type", ContentType.Json);
            request.AddHeader("X-acpt", xrayToken);
            String arrTestExec = "";

            arrTestExec += "\"" + testExecutionId + "\",";
            String arrTestExecBody = "[" + arrTestExec.Substring(0, arrTestExec.Length - 1) + "]";

            request.AddParameter("application/json", arrTestExecBody, ParameterType.RequestBody);
            IRestResponse response = client.Post(request);

            responseInfo.isSuccess = response.IsSuccessful;
            responseInfo.message   = response.Content;
            return(responseInfo);
        }