Example #1
0
        private void ExecuteSuite_Click(object sender, EventArgs e)
        {
            TCMParameters tcmParams = new TCMParameters();

            tcmParams.projectName = TFSProj.SelectedItem.ToString().Trim();
            tcmParams.definition  = GetKeyFromKeyValuePair(TFSDefs);
            tcmParams.collection  = XML.GetCollectionURL(TFSColls.SelectedItem.ToString().Trim());
            tcmParams.configId    = GetValueFromKeyValuePair(ConfigID);
            tcmParams.buildPath   = TFSFunctions.GetBuildPath(GetKeyFromKeyValuePair(Builds), tcmParams.projectName, tcmParams.definition);
            tcmParams.suiteId     = SuiteTextBox.Text.ToString().Trim();
            tcmParams.planId      = GetKeyFromKeyValuePair(TFSPln);
            tcmParams.runTitle    = "TCM Executor Suite/s Run " + DateTime.Now.ToString("MM-dd-yyyy hh:mm:ss tt");
            TCMFunctions.TCMSuiteExecutionCreateAndExecute(tcmParams);
        }
Example #2
0
        public static string TCMTestExecutionExecutionCreateAndExecute(TCMParameters tcmParam)
        {
            string tIdQuery       = null; tIdQuery = ExtractQueryForSuiteIDsAndTestIDs(tcmParam.suiteId, tcmParam.testCaseId, tcmParam.configId, tcmParam.planId, tIdQuery);
            string buildPath      = tcmParam.buildPath;
            string col            = tcmParam.collection;
            string proj           = tcmParam.projectName;
            string runId          = null;
            string tcmTestExecBat = tempPath + Program.tmp + "tcmTestExecCreate_" + DateTime.Now.ToString("MM_dd_yyyy_hh_mm_ss_tt") + ".bat";

            if (tcmParam.settingsName != null)
            {
                string[] lines = { "cd /",
                                   "cd " + Program.tcmPath,
                                   "tcm run /create /title:" + "\"" + tcmParam.runTitle + "\"" + " /planid:"
                                   + tcmParam.planId + " /querytext:" + tIdQuery + " /builddir:" + "\"" + buildPath + "\"" + " /collection:\"" + col + "\" /teamproject:"
                                   + "\"" + proj + "\"" + " /settingsname:" + "\"" + tcmParam.settingsName + "\"" + " /include" };
                System.IO.File.WriteAllLines(tcmTestExecBat, lines);
                LogBatFileOutput(lines, tcmTestExecBat);
            }
            else
            {
                string[] lines = { "cd /",
                                   "cd " + Program.tcmPath,
                                   "tcm run /create /title:" + "\"" + tcmParam.runTitle + "\"" + " /planid:"
                                   + tcmParam.planId + " /querytext:" + tIdQuery + " /builddir:" + "\"" + buildPath + "\"" + " /collection:\"" + col + "\" /teamproject:"
                                   + "\"" + proj + "\" /include" };
                System.IO.File.WriteAllLines(tcmTestExecBat, lines);
                LogBatFileOutput(lines, tcmTestExecBat);
            }

            string strTmp = Utils.GetCmdOut(tcmTestExecBat);

            File.Delete(tcmTestExecBat);
            if (strTmp.Contains("created with ID: "))
            {
                LogMessageToFile("Run Id for TestCasaeExecution Function was created successfully using TCM create command line");
                runId = strTmp.Split(new string[] { "created with ID: " }, StringSplitOptions.None)[1].Split('.')[0].Trim();
                Console.WriteLine("Run ID generated is : " + runId);
                LogMessageToFile("Run ID generated is : " + runId);
            }
            TCMExecute(runId, col, proj);
            return(runId);
        }