public void Connect(string domain, string project)
 {
     try
     {
         tdConn.Connect(domain, project);
         if (tdConn.ProjectConnected)
         {
             isConnectProject = true;
         }
     }
     catch { }
 }
Beispiel #2
0
        //protected static TDConnection tdc = new TDConnection();

        /// <exception cref="COMException">Server connection error.</exception>
        protected bool Connect(String serverUrl, String username, string password, string domain, string project)
        {
            try { tdc.InitConnectionEx(serverUrl); }
            catch (System.Runtime.InteropServices.COMException ce)
            {
                rr.AddErrorLine(HandleException(ce));
                //Environment.Exit(0);
            }
            catch (Exception e)
            {
                rr.AddErrorLine("Error: " + e.Message);
            }

            if (tdc.Connected)
            {
                try
                {
                    tdc.Login(username, password);
                }
                catch (System.Runtime.InteropServices.COMException ce)
                {
                    rr.AddErrorLine(HandleException(ce));
                    return(false);
                    //Environment.Exit(0);
                }

                if (tdc.LoggedIn)
                {
                    try
                    {
                        tdc.Connect(domain, project);
                    }
                    catch (COMException ce)
                    {
                        rr.AddErrorLine(HandleException(ce));
                        //Environment.Exit(0);
                    }

                    if (tdc.ProjectConnected)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
 public QCHelperTest()
 {
     qcConnect = new TDConnection();
     qcConnect.InitConnectionEx("http://qualitycenter-v10.homedepot.com/qcbin");
     qcConnect.Login("PXS8677", "tree$123");
     qcConnect.Connect("ONLINE", "EBWCS");
     if (qcConnect.Connected)
     {
         Console.WriteLine("Connected to QC");
     }
     else
     {
         Console.WriteLine("Not Connected to QC");
     }
 }
Beispiel #4
0
        public TDConnect(string UserName, string PWD, string Domain, string Project, string Address)
        {
            _UserName = UserName;
            _PWD      = PWD;
            _Domain   = Domain;
            _Project  = Project;
            _Address  = Address;

            qc = new TDConnection();
            qc.InitConnectionEx(Address);
            qc.Login(UserName, PWD);
            qc.Connect(Domain, Project);
            if (qc.Connected)
            {
                Console.WriteLine("Login Success");
            }
        }
Beispiel #5
0
 // QC Login Function
 public static bool ConnectQCProject(string QCDomain, string QCProject)
 {
     try
     {
         mTDConn.Connect(QCDomain, QCProject);
     }
     catch (Exception ex)
     {
         Reporter.ToLog(eLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {ex.Message}", ex);
         return(false);
     }
     if (mTDConn.Connected == true)
     {
         return(true);
     }
     else //testTDConn.Disconnect();
     {
         return(false);
     }
 }
Beispiel #6
0
 public QCHelper()
 {
     try
     {
         qcConnect = new TDConnection();
         qcConnect.InitConnectionEx("http://qualitycenter-v10.homedepot.com/qcbin");
         qcConnect.Login(HelperClass.QCUserName, HelperClass.QCPassword);
         qcConnect.Connect("ONLINE", "EBWCS");
         if (qcConnect.Connected)
         {
             Console.WriteLine("Connected to QC");
         }
         else
         {
             Console.WriteLine("Not Connected to QC");
         }
     }
     catch (Exception ex)
     {
         Logger.Log(ex.ToString());
     }
 }
Beispiel #7
0
    public static string ReportResults(List<Results> results, string runName, string userName, string password)
    {
        string rc = "Nothing Reported";
        if (runName != null && userName != null && password != null)
        {
            TDConnection connection = null;
            try
            {
                connection = new TDConnection();

                String URL = "http://hpqualitycenter/qcbin/";
                String domainName = "Default";
                String projectName = "Production";

                //Response.Write("Server:" + URL + "  Domain:" + domainName + "  Project:" + projectName + "<br/>");
                //Prompt for QC credentials.

                connection.InitConnectionEx(URL);
                connection.Login(userName, password);
                connection.Connect(domainName, projectName);
                //Response.Write("Opening Connection <br/>");
                //Response.Write("Connection Status: " + (connection.Connected ? "connected" : "not connected") + "<br/>");
                if (connection != null && connection.Connected)
                {
                    foreach (Results r in results)
                    {
                        TestSetTreeManager treeManager = (TestSetTreeManager)connection.TestSetTreeManager;

                        //Response.Write("Folder: " + rootPathPrefix + path + " <br/>");

                        TestSetFolder folder = (TestSetFolder)treeManager.get_NodeByPath(rootPathPrefix + r.Path);
                        TestSetFactory tFactory = (TestSetFactory)folder.TestSetFactory;
                        TDFilter tFilter = (TDFilter)tFactory.Filter;
                        tFilter["TS_TEST_ID"] = r.Id;

                        //http://atg05-yyz/YUI/ReportResultToQC.aspx?id=2367453&path=BlackBerry%20Developer%20Tools\Sandbox&result=0
                        if (r.Id != null)
                        {
                            //Response.Write("testId= " + testId + "  result= " + result + "<br/>");
                            List tests = folder.FindTestInstances("", false, tFilter.Text);

                            if (tests.Count == 1)
                            {
                                TSTest t = (TSTest)tests[1];
                                //Response.Write(t.ID + " " + t.Status + " " + t.Name + " " + "<br/>");
                                RunFactory runFactory = (RunFactory)t.RunFactory;
                                Run newRun = (Run)runFactory.AddItem(runName);

                                switch (r.Result)
                                {
                                    case 0:
                                        newRun.Status = @"FAILED";
                                        break;
                                    case 1:
                                        newRun.Status = @"PASSED";
                                        break;
                                    case 2:
                                        newRun.Status = @"N/A";
                                        break;
                                }
                                //Response.Write("Status = " + newRun.Status + "<br/>");
                                newRun.Post();
                                rc = "Success";
                            }
                            else
                            {
                                rc = "Error: Multiple Tests Returned for ID # " + r.Id;
                                break;
                            }
                        }
                        else
                        {
                            rc = "No Test Specified";
                            break;
                        }
                    }//foreach result
                }//if connection
                else
                    rc =  "Connection to QC could not be established";
            }
            catch (Exception ex)
            {
                rc = ex.Message;
            }
            finally
            {
                if (connection != null)
                {
                    if (connection.Connected)
                        connection.Disconnect();

                    if (connection.LoggedIn)
                        connection.Logout();

                    connection.ReleaseConnection();
                    connection = null;
                }
            }
        }
        return rc;
    }
Beispiel #8
0
        private void ConnectToQC()
        {
            _conn= new TDConnectionClass();
            try
            {
                _conn.InitConnectionEx(_config.QCAddress);
                _conn.Login(_config.UserName, _config.Pwd);
                _conn.Connect(_config.Domain, _config.Project);
            }
            catch(Exception e)
            {

            }
        }