Beispiel #1
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            TCAPI.CreateInstance(new Tricentis.TCAPIObjects.TCAPIConnectionInfo());

            TCWorkspace workspace = TCAPI.Instance.OpenWorkspace(txtPath.Text, txtUser.Text, txtPassword.Text);
            TCProject   project   = workspace.GetProject();

            TestCase testCase = (TestCase)project.Search($"=>SUBPARTS:TestCase[Name==\"{txtTestCase.Text}\"]").FirstOrDefault();

            if (testCase != null)
            {
                TCFolder executionListFolder = (TCFolder)project.Search("=>SUBPARTS:TCFolder[PossibleContent==\"Folder;ExecutionList\"]").First();
                if (executionListFolder.IsTaskApplicable(TCTasks.Checkout))
                {
                    executionListFolder.Checkout();
                }
                ExecutionList executionList = executionListFolder.CreateExecutionList();
                executionList.Name = txtTestCase.Text;
                executionList.CreateExecutionEntry(testCase);
                if (executionListFolder.CheckOutState.Equals(CheckOutState.CheckedOut))
                {
                    workspace.CheckInAll("Execution list created from code!");
                }
                workspace.Save();
                MessageBox.Show("Execution list created successfully");
            }
            else
            {
                MessageBox.Show("TestCase not found!");
            }
            TCAPI.Instance.CloseWorkspace();
            TCAPI.CloseInstance();
        }
Beispiel #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            ExecutionList executionList = db.ExecutionLists.Find(id);

            db.ExecutionLists.Remove(executionList);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #3
0
 public ActionResult Edit([Bind(Include = "lcmID,currentServerName,cmo,newServerName,fmo,status,status27Date,notes,waveNum,grouping,CRQ_CHG_WO,CRQ_CHG_WOStatus,HandoverDate,region,country,site,siteComments,appName,appOwner,monsantoPM,atosPM,escalationNotes,personContacted,contactedDate,serialNum,pmNotes,environment,supportGroupCmdb,operatingSystem,skyfall,skyfallNum,skyfallIndex,atosTeamID,decomType,decomStartDate,retirementCrq,retirementChg,retirementWo,decomData,forecastedStatusDate,cabApprovalDate,database,java,middleware,citrix,lcmWeek,platforms,complianceAssetID,screamTest,serverInCorral,corralPlannedDisposition,AppTeamTurnoverDate,managedBy,currentOsVersion,futureOsVersion,dateEnteredCorral,followupMonth,transformation,afqOsVersion,fiscalYear,ResourceID,CreatedDate,ModifiedDate,CreatedBy,ModifiedBy,NZEVOverlap,ServerRequiresOSLicense,NumCores,NumProcessors,NZEVRemediationPlanned,ISOExceptionNumber,COGSupported,LcmType")] ExecutionList executionList)
 {
     if (ModelState.IsValid)
     {
         db.Entry(executionList).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(executionList));
 }
        public void AddNewPage(string page)
        {
            var position = Memory.Select(x => ExecutionList.IndexOf(x)).ToList();

            NewPage(() =>
            {
                var p                  = position.FindIndex(x => x == -1);
                TradingPostion         = p == -1 ? Memory.IndexOf(ExecutionList[position.Max()]) : p;
                Memory[TradingPostion] = NewValue;
                OldValue               = Fila[TradingPostion];
            },
                    page);
        }
Beispiel #5
0
        // GET: ExecutionLists/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ExecutionList executionList = db.ExecutionLists.Find(id);

            if (executionList == null)
            {
                return(HttpNotFound());
            }
            return(View(executionList));
        }
Beispiel #6
0
 private void GetSubLists(ExecutionList el)
 {
     Helper.Schrijf(el.Name, "GetSubLists", 3);
     foreach (TCObject subitem in el.Items)
     {
         if (subitem is ExecutionEntryFolder)
         {
             AddExecutionEntryFolder(subitem);
             GetSubItems(subitem as ExecutionEntryFolder);
         }
         if (subitem is ExecutionEntry)
         {
             AddExectionEntry(subitem as ExecutionEntry, exList);
             Helper.Schrijf((subitem as ExecutionEntry).Name, "GetSubLists_Entry", 4);
         }
     }
 }
Beispiel #7
0
        public void AddNewPage(string page)
        {
            var index = GetNumberFormBinary(Matriz);
            var i     = Memory.IndexOf(ExecutionList.FirstOrDefault());

            ManipulaMatriz(i);

            NewPage(() =>
            {
                TradingPostion         = index;
                OldValue               = Memory[TradingPostion];
                Memory[TradingPostion] = NewValue;
            },
                    page);

            if (i == -1)
            {
                ManipulaMatriz(Memory.IndexOf(NewValue));
            }
        }
 private void GetSubLists(ExecutionList el)
 {
     Helper.Schrijf(el.Name, "GetSubLists", 3);
     foreach (TCObject subitem in el.Items)
     {
         if (subitem is ExecutionEntryFolder)
         {
             AddExecutionEntryFolder(subitem);
             GetSubItems(subitem as ExecutionEntryFolder);
         }
         if (subitem is ExecutionEntry)
         {
             AddExectionEntry(subitem as ExecutionEntry, exList);
             Helper.Schrijf((subitem as ExecutionEntry).Name, "GetSubLists_Entry", 4);
         }
     }
 }
 public ExecutionListTaskInterceptor(ExecutionList obj)
 {
 }
Beispiel #10
0
        static async Task RunAsync(TCObject objectToExecuteOn)
        {
            HttpClient client = new HttpClient();

            System.Net.ServicePointManager.ServerCertificateValidationCallback +=
                delegate(object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate,
                         System.Security.Cryptography.X509Certificates.X509Chain chain,
                         System.Net.Security.SslPolicyErrors sslPolicyErrors)
            {
                return(true);
            };



            //assign BaseUrl into http client
            client.BaseAddress = new Uri(ZUtil.BASE_URL);
            //client.DefaultRequestHeaders.Accept.Clear();
            //client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            var RELATIVE_PATH = "flex/services/rest/latest/execution/create";


            String encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(ZUtil.USER + ":" + ZUtil.PASSWORD));

            client.DefaultRequestHeaders.Add("Authorization", "Basic " + encoded);

            ExecutionListItem    executionListItem    = (ExecutionListItem)objectToExecuteOn;
            ExecutionList        executionEntryList   = executionListItem.ExecutionList;
            ExecutionEntryFolder executionEntryFolder = (ExecutionEntryFolder)executionEntryList.Items.First();
            List <Object>        testCase             = new List <Object>();

            string execStatus = "-1";

            for (int i = 0; i < executionEntryFolder.Items.Count(); i++)
            {
                ExecutionEntry  execItem   = (ExecutionEntry)executionEntryFolder.Items.ElementAt(i);
                ExecutionResult execResult = execItem.ActualResult;
                if (execResult.Equals("Passed"))
                {
                    execStatus = "1";
                }
                else
                {
                    execStatus = "2";
                }
                List <Object> testSteps    = new List <Object>();
                TestCase      testCaseItem = (TestCase)execItem.TestCase;
                for (int j = 0; j < testCaseItem.Items.Count(); j++)
                {
                    TestStep ts    = (TestStep)testCaseItem.Items.ElementAt(j);
                    var      tsObj = new { name = ts.DisplayedName };
                    testSteps.Add(tsObj);
                }
                var tc = new
                {
                    name            = execItem.DisplayedName,
                    executionResult = execStatus,
                    testSteps       = testSteps.ToArray()
                };
                testCase.Add(tc);
            }
            var jsonContent = new
            {
                testCases     = testCase.ToArray(),
                executionName = executionListItem.DisplayedName,
                releaseId     = "1",
                folderName    = executionListItem.DisplayedName
            };


            try
            {
                HttpResponseMessage response = await client.PostAsync(ZUtil.CONTEXT_PATH + RELATIVE_PATH,
                                                                      new StringContent(JsonConvert.SerializeObject(jsonContent).ToString(),
                                                                                        Encoding.UTF8, ZUtil.CONTENT_TYPE_JSON));

                response.EnsureSuccessStatusCode();

                //write response in console
                // Console.WriteLine(response);

                // Deserialize the updated product from the response body.
                string result = await response.Content.ReadAsStringAsync();

                //write Response in console
                //Console.WriteLine(result);

                //response.Dispose();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Beispiel #11
0
        private void AddExecutionEntries(ExecutionList el)
        {
            if (!el.ChangesAllowed)
            {
                return;
            }
            foreach (var elItem in el.Items)
            {
                AddExecutionEntries(elItem);

                if (elItem is ExecutionEntryFolder)
                {
                    AddExecutionEntries(elItem as ExecutionEntryFolder);
                }
            }
        }