Esempio n. 1
1
        public TDConnection Connect(string qcUrl, string qcDomain, string qcProject, string qcLoginName, string qcPassword)
        {
            connection = new TDConnection();
            connection.InitConnectionEx(qcUrl);
            connection.ConnectProjectEx(qcDomain, qcProject, qcLoginName, qcPassword);

            return connection;
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="tf"></param>
 public QCOTAClass(TestConfigFile tf)
 {
     isConnectToQC = false;
     isConnectProject = false;
     tdConn = new TDAPIOLELib.TDConnection();
     tconf = tf;
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="tf"></param>
 public QCOTAClass(TestConfigFile tf)
 {
     isConnectToQC    = false;
     isConnectProject = false;
     tdConn           = new TDAPIOLELib.TDConnection();
     tconf            = tf;
 }
Esempio n. 4
0
        public static void Main()
        {
            String qcUrl       = "http://qcurl.com:8080/qcbin";
            String qcDomain    = "";                                                   // Nearly all our projects are under DEFAULT domain
            String qcProject   = "";                                                   // Project we want to log a defect to
            String qcLoginName = "";                                                   // User account we'll use to log it
            String qcPassword  = "";                                                   // Password for user account

            TDConnection connection = new TDConnection();                              // Open blank connection

            connection.InitConnectionEx(qcUrl);                                        // Go to qcUrl
            connection.ConnectProjectEx(qcDomain, qcProject, qcLoginName, qcPassword); // Validate credentials through API

            BugFactory bugFactory = connection.BugFactory;                             // Create an object from BugFactory
            Bug        newBug     = bugFactory.AddItem(System.DBNull.Value);           // Create a new blank bug, must convert C# Null object type into value of Null type

            // Set values for mandatory fields in new bug
            // Values are arbitrary
            newBug.Status                 = "New";
            newBug.AssignedTo             = qcLoginName;
            newBug.DetectedBy             = qcLoginName;
            newBug.Summary                = "This is a test defect";
            newBug["BG_SEVERITY"]         = "3-Test";
            newBug["BG_DESCRIPTION"]      = "This is a test defect";
            newBug["BG_DETECTED_IN_RCYC"] = 1002; // This takes the Release ID from release module, not the string value of its name, unlike every other field.
            newBug["BG_DETECTION_DATE"]   = System.DateTime.Today;

            // Post the bug
            newBug.Post();
        }
Esempio n. 5
0
        public TDConnection Connect(string qcUrl, string qcDomain, string qcProject, string qcLoginName, string qcPassword)
        {
            connection = new TDConnection();
            connection.InitConnectionEx(qcUrl);
            connection.ConnectProjectEx(qcDomain, qcProject, qcLoginName, qcPassword);

            return(connection);
        }
Esempio n. 6
0
    public void OnConnected(NetworkMessage netMsg)
    {
        int connectionID = netMsg.conn.connectionId;

        NetworkServer.SetClientReady(netMsg.conn);
        TDConnection newTDConnection = new TDConnection();

        newTDConnection._connectionID = connectionID;
        _connectionList.Add(connectionID, newTDConnection);
    }
Esempio n. 7
0
 public ALMEntity(string ServerUrl, string Username, string Password, string Domain, string Project)
 {
     this.ServerUrl = ServerUrl;
     this.Username  = Username;
     this.Password  = Password;
     this.Domain    = Domain;
     this.Project   = Project;
     rr             = new ReturnResult();
     tdc            = new TDConnection();
 }
Esempio n. 8
0
        /// <exception cref="COMException">Server connection error.</exception>
        protected bool Connect(String serverUrl, String username, string password, string domain, string project)
        {
            tdc = new TDConnection();
            try { tdc.InitConnectionEx(serverUrl); }
            catch (System.Runtime.InteropServices.COMException ce)
            {
                rr.AddErrorLine(HandleException(ce));
                //Environment.Exit(0);
            }

            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);
            }
        }
 /**
  * Constructor creates the Connection object
  *
  */
 public QCController()
 {
     try
     {
         this.tdConn = createTDConnection();
     }
     catch (QCException e)
     {
         log.Error(e.Message);
         throw;
     }
 }
Esempio n. 10
0
 /**
  * Constructor creates the Connection object
  *
  */
 public QCController()
 {
     try
     {
         this.tdConn = createTDConnection();
     }
     catch (QCException e)
     {
         log.Error(e.Message);
         throw;
     }
 }
Esempio n. 11
0
        /// <summary>
        /// This method will download an attachment from a folder in Quality Center
        /// </summary>
        /// <param name="qcFolderLocation">Folder Location from where attachment needs to be downloaded</param>
        /// <param name="strFileName">Name of the file that needs to be downloaded from specified location.
        /// Name should be specified along with extenstion </param>
        /// <returns>Location of local (usually temp) path where file has been downloaded. Returns empty string if file could not be downloaded.</returns>
        public string DownloadAttachment(string qcFolderLocation, string strFileName)
        {
            //Connect with Quality Center
            TDConnection qctd = new TDConnection();

            qctd.InitConnectionEx(qcServer);
            qctd.ConnectProjectEx(strDomainName, strProjectName, strQCUserName, strQCUserPassword);

            if (qctd.Connected)
            {
                //Define objects that will be used to download files
                SubjectNode       otaSysTreeNode       = new SubjectNode();
                AttachmentFactory otaAttachmentFactory = new AttachmentFactory();
                TDFilter          otaAttachmentFilter  = new TDFilter();
                List            otaAttachmentList      = new List();
                ExtendedStorage attStorage             = new ExtendedStorage();

                otaSysTreeNode       = qctd.TreeManager.NodeByPath(qcFolderLocation); //Returns node object from test plan in Quality Center
                otaAttachmentFactory = otaSysTreeNode.Attachments();                  //Returns all attachments for the folder in QC
                otaAttachmentFilter  = otaAttachmentFactory.Filter();                 //Can be used to filter list of attachments
                otaAttachmentList    = otaAttachmentFilter.NewList();                 //Creates list of attached files

                //Check if there is any attachment available for the specified folder
                if (otaAttachmentList.Count > 0)
                {
                    foreach (Attachment otaAttachment in otaAttachmentList)
                    {
                        //Check if file names are same
                        if (otaAttachment.FileName.ToLower() == strFileName.ToLower())
                        {
                            attStorage         = otaAttachment.AttachmentStorage();
                            _localFileLocation = otaAttachment.DirectLink;

                            //Load method will download file to local workstation. true to used for synchronised download.
                            attStorage.Load(_localFileLocation, true);

                            //Client path refers to local path where file has been downloaded
                            _localFileLocation = attStorage.ClientPath;
                            break;
                        }
                    }
                }
            }

            //Return empty string if connection to QC was not successfull.
            else
            {
                _localFileLocation = string.Empty;
            }

            return(_localFileLocation);
        }
 public QCOTAClass()
 {
     isConnectToQC = false;
     isConnectProject = false;
     tdConn = new TDAPIOLELib.TDConnection();
     /*
     //tconf = new TestConfigFile();
     //tconf.QCConnect.ServerAddr = "http://localhost:8080/qcbin";
     //tconf.QCConnect.Domain = "Default";
     //tconf.QCConnect.Project = "Test";
     //tconf.QCConnect.LoginName = "Administrator";
     //tconf.QCConnect.Password = "";*/
 }
Esempio n. 13
0
        /// <summary>
        /// This method will download an attachment from a folder in Quality Center
        /// </summary>
        /// <param name="qcFolderLocation">Folder Location from where attachment needs to be downloaded</param>
        /// <param name="strFileName">Name of the file that needs to be downloaded from specified location. 
        /// Name should be specified along with extenstion </param>
        /// <returns>Location of local (usually temp) path where file has been downloaded. Returns empty string if file could not be downloaded.</returns>
        public string DownloadAttachment(string qcFolderLocation, string strFileName)
        {
            //Connect with Quality Center
            TDConnection qctd = new TDConnection();
            qctd.InitConnectionEx(qcServer);
            qctd.ConnectProjectEx(strDomainName, strProjectName, strQCUserName, strQCUserPassword);

            if (qctd.Connected)
            {
                //Define objects that will be used to download files
                SubjectNode otaSysTreeNode = new SubjectNode();
                AttachmentFactory otaAttachmentFactory = new AttachmentFactory();
                TDFilter otaAttachmentFilter = new TDFilter();
                List otaAttachmentList = new List();
                ExtendedStorage attStorage = new ExtendedStorage();

                otaSysTreeNode = qctd.TreeManager.NodeByPath(qcFolderLocation);     //Returns node object from test plan in Quality Center
                otaAttachmentFactory = otaSysTreeNode.Attachments();                //Returns all attachments for the folder in QC
                otaAttachmentFilter = otaAttachmentFactory.Filter();                //Can be used to filter list of attachments
                otaAttachmentList = otaAttachmentFilter.NewList();                  //Creates list of attached files

                //Check if there is any attachment available for the specified folder
                if (otaAttachmentList.Count > 0)
                {
                    foreach (Attachment otaAttachment in otaAttachmentList)
                    {
                        //Check if file names are same
                        if (otaAttachment.FileName.ToLower() == strFileName.ToLower())
                        {
                            attStorage = otaAttachment.AttachmentStorage();
                            _localFileLocation = otaAttachment.DirectLink;

                            //Load method will download file to local workstation. true to used for synchronised download.
                            attStorage.Load(_localFileLocation, true);

                            //Client path refers to local path where file has been downloaded
                            _localFileLocation = attStorage.ClientPath;
                            break;
                        }
                    }
                }
            }

            //Return empty string if connection to QC was not successfull.
            else
            {
                _localFileLocation = string.Empty;
            }

            return _localFileLocation;
        }
Esempio n. 14
0
        /**
         * create a new TDConnection object or throw QCException on failure
         *
         */
        public TDConnection createTDConnection()
        {
            log.Debug("Creating TD connection.");

            TDConnection tdConn = new TDConnection();

            if (tdConn == null)
            {
                message = "Can't create TDConnection object -- maybe you need to reference TDAPIOLELib?";
                throw new QCException(message);
            }

            return(tdConn);
        }
        public QCOTAClass()
        {
            isConnectToQC    = false;
            isConnectProject = false;
            tdConn           = new TDAPIOLELib.TDConnection();

            /*
             * //tconf = new TestConfigFile();
             * //tconf.QCConnect.ServerAddr = "http://localhost:8080/qcbin";
             * //tconf.QCConnect.Domain = "Default";
             * //tconf.QCConnect.Project = "Test";
             * //tconf.QCConnect.LoginName = "Administrator";
             * //tconf.QCConnect.Password = "";*/
        }
Esempio n. 16
0
 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");
     }
 }
Esempio n. 17
0
        public CreateDefect()
        {
            TDConnection connection = Connect("qcUrl", "qcDomain", "qcProject", "qcLoginName", "qcPassword");

            BugFactory bugFactory = connection.BugFactory;
            Bug        bug        = bugFactory.AddItem(null);

            bug.Status     = "New";
            bug.Project    = "QCIntegration";
            bug.Summary    = "Short description of the bug";
            bug.DetectedBy = "Aaron Evans";
            bug.AssignedTo = "Nobody";
            bug.Priority   = "Low";

            bug.Post();
        }
Esempio n. 18
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");
            }
        }
Esempio n. 19
0
        /// <summary>
        /// The ConnectToServer.
        /// </summary>
        /// <returns>The <see cref="bool"/>.</returns>
        public bool ConnectToServer()
        {
            // initialize new TDConnection
            this.connection = new TDConnection();
            bool connected = false; // initializes returning result

            // conn.InitConnectionEx(almurl);
            // Console.WriteLine("Checking Server Compatibility: " + connection.InitAndCheckServerCompatibility(almUrl));
            this.connection.InitAndCheckServerCompatibility(this.AlmUrl);

            // Authentication
            // Console.WriteLine("Logging in...");
            try
            {
                this.connection.Login(this.Username, this.Password);
            }
            catch (Exception)
            {
                Console.WriteLine("Login Failed");
                return(false);
            }

            // Connect to a project
            // Console.WriteLine("Connecting to Project...");
            try
            {
                this.connection.Connect(this.Domain, this.Project);
            }
            catch (Exception)
            {
                Console.WriteLine("Connecting to Project Failed");
                return(false);
            }

            // check connected status
            connected = this.connection.ProjectConnected && this.connection.Connected && this.connection.LoggedIn;

            // Console.WriteLine("Connected: " + connected);
            return(connected);
        }
Esempio n. 20
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());
     }
 }
Esempio n. 21
0
 public QualityCenter()
 {
     TDConnection connection = new TDConnection();
     connection.InitConnection();
 }
Esempio n. 22
0
 public TestLabManagement(TDConnect tdc)
 {
     tdconn = tdc.getTDConnection;
 }
Esempio n. 23
0
        /**
         * create a new TDConnection object or throw QCException on failure
         *
         */
        public TDConnection createTDConnection()
        {
            log.Debug("Creating TD connection.");

            TDConnection tdConn = new TDConnection();

            if (tdConn == null)
            {
                message = "Can't create TDConnection object -- maybe you need to reference TDAPIOLELib?";
                throw new QCException(message);
            }

            return tdConn;
        }
Esempio n. 24
0
        public void ParseDataSet(params object[] parameters)
        {
            lstTestPlanSteps = new List <string[]>();
            lstStrEvidenceID = new List <string>();
            try
            {
                string       strQCURL             = (string)parameters[0];
                string       strTargetFolderPath  = (string)parameters[1];
                string       strproject           = (string)parameters[2];
                string       strdomain            = (string)parameters[3];
                string       strpass              = (string)parameters[4];
                string       strTestPlanFileName  = Path.GetFileNameWithoutExtension((string)parameters[5]);
                bool         bIsCandidateEvidence = false;
                string       strscreenprint       = string.Empty;
                TDConnection qctd = new TDConnection();
                Test         tst;

                qctd.InitConnectionEx(strQCURL);
                qctd.ConnectProjectEx(strdomain, strproject, Environment.UserName, strpass);
                if (qctd.Connected)
                {
                    TestFactory testFactory = (TestFactory)qctd.TestFactory;
                    TDFilter    testFilter  = testFactory.Filter;

                    TDAPIOLELib.List testList;

                    testFilter["TS_NAME"] = "\"" + strTestPlanFileName + "\"";
                    // testFilter["TS_PATH"] = "\"" + strTargetFolderPath + "\"";
                    TDAPIOLELib.List listOfTests = testFilter.NewList();

                    testList = (TDAPIOLELib.List)testFactory.NewList(testFilter.Text);
                    string strdescription = string.Empty;
                    int    itestcount     = testList.Count;
                    int    stepscount     = 0;
                    if (testList.Count == 0)
                    {
                        throw new FileNotFoundException("No test plans Found .Check the testplan name");
                    }
                    else if (testList.Count > 1)
                    {
                        MessageBox.Show("Multiple Test plans found , Click Ok to view and select the Right Test Plan", "Mutiple Test Plans");
                        DisplayListOFTestPlan(testList, testFactory);
                        tst             = SelectedTest;
                        strTestplanPath = testFactory[tst.ID]["TS_SUBJECT"].Path;
                    }
                    else
                    {
                        tst = testList[1];
                    }
                    if (tst == null)
                    {
                        throw new Exception("No Test plans selected ");
                    }
                    strTestPlanName = tst.Name;
                    //   string noHTML = Regex.Replace(tst["TS_DESCRIPTION"], @"<[^>]+>|&nbsp;", "").Trim();
                    //  noHTML = WebUtility.HtmlDecode(noHTML);
                    string noHTML = RemoveHTML(tst["TS_DESCRIPTION"]);
                    //  Match m = Regex.Match(noHTML, "(?s)[Pp]rerequisites.*[Cc]hange [Cc]ontrol");
                    Match m = Regex.Match(noHTML, "(?s)[Pp]rerequisites.*");
                    strPrerequisites = m.Value;
                    DesignStepFactory dsf      = tst.DesignStepFactory;
                    TDAPIOLELib.List  dslflist = dsf.NewList("");
                    stepscount = dslflist.Count;
                    foreach (DesignStep ds in dslflist)
                    {
                        arrStepData    = new string[3];
                        arrStepData[0] = ds.StepName;
                        arrStepData[1] = RemoveHTML(ds.StepDescription);
                        arrStepData[2] = RemoveHTML(ds.StepExpectedResult);
                        lstTestPlanSteps.Add(arrStepData);
                        bIsCandidateEvidence = false;
                        strscreenprint       = (string)ds["DS_USER_01"];
                        if (!string.IsNullOrEmpty(strscreenprint))
                        {
                            if (string.Compare(strscreenprint.ToLower(), "none") != 0)
                            {
                                foreach (char ch in strscreenprint)
                                {
                                    if ((int)ch >= 33 && (int)ch <= 126)
                                    {
                                        bIsCandidateEvidence = true;
                                        break;
                                    }
                                }
                                if (bIsCandidateEvidence)
                                {
                                    lstStrEvidenceID.Add(ds.StepName);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 25
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;
    }
Esempio n. 26
0
        private static void ConnectALMQCAndUpdateTestRuns(string testFolderPath, string testSetName, string Test_Name)
        {
            TDConnection qcConn;
            string       url = "https://abc.com";

            try
            {
                qcConn = new TDConnection();
                qcConn.InitConnection(url, almDomain, GeneralMethods.Decrypt(almPassword));
                qcConn.ConnectProject(almProjectName, almUserName, GeneralMethods.Decrypt(almPassword));
                //qcConn.InitConnectionEx(url);
                //qcConn.ConnectProjectEx(domain, projectName, userName, Password.Decrypt(KeyFunctions.GetConfigData("LAN.EncPassword"), userDomain + "-" + userName));
                ////qcConn.ConnectProjectEx(domain, projectName, userName, password, userDomain + "-" + userName));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return;
            }


            if (qcConn.ProjectConnected)
            {
                var testInfo  = new List <string>();
                var tsTreeMgr = (TestSetTreeManager)qcConn.TestSetTreeManager;
                var tsFolder  = (TestSetFolder)tsTreeMgr.get_NodeByPath(almFolderPath);
                //var tsFolder = (TestSetFolder)tsTreeMgr.get_NodeById(22703);
                //var tsFolder = (TestSetFolder)tsTreeMgr.get_NodeByPath(testFolderPath);
                var attchFactory = (AttachmentFactory)tsFolder.Attachments;
                //string testname1 = tsFolder.Name;
                //var set1 = tsFolder.get_Child(1);
                int nodeid = tsFolder.NodeID;
                var tsList = tsFolder.FindTestSets(testSetName, false, null);
                //var tsList = tsFolder.FindTestSets(testSetName, true,null);
                foreach (TestSet ts in tsList)
                {
                    var tstFolder     = (TestSetFolder)ts.TestSetFolder;
                    var tsTestFactory = (TSTestFactory)ts.TSTestFactory;
                    var mylist        = tsTestFactory.NewList("");
                    foreach (TSTest tsTest in mylist)
                    {
                        if (tsTest.Name.Equals(Test_Name))
                        {
                            var runFactory = (RunFactory)tsTest.RunFactory;

                            var run = (Run)runFactory.AddItem("AutRun_" + Reports.starttime);
                            run.CopyDesignSteps();

                            //runResult just tells me if overall my test run passes or fails - it's not built in. It was my way of tracking things though the code.
                            run.Status = almTestStatus;
                            run.Post();
                            AttachmentFactory      attachmentFactory = (AttachmentFactory)tsTest.Attachments;
                            TDAPIOLELib.Attachment attachment        = (TDAPIOLELib.Attachment)attachmentFactory.AddItem(System.DBNull.Value);
                            attachment.Description = "Attached Automation execution result";
                            attachment.Type        = 1;
                            if (almReportAttachmentType.ToLower() == "word" && Reports.isWordReport)
                            {
                                attachment.FileName = WordReport.reportpath;
                            }
                            if (almReportAttachmentType.ToLower() == "pdf" && Reports.isPdfReport)
                            {
                                attachment.FileName = PDFReport.reportpath;
                            }
                            attachment.Post();

                            StepFactory rsFactory      = (StepFactory)run.StepFactory;
                            dynamic     rdata_stepList = rsFactory.NewList("");
                            var         rstepList      = (TDAPIOLELib.List)rdata_stepList;
                            foreach (dynamic rstep in rstepList)
                            {
                                rstep.Status = almTestStatus;
                                rstep.Post();
                            }
                        }
                    }
                }
            }
        }
Esempio n. 27
0
 public TestRun(TDConnect tdc)
 {
     tdconn = tdc.getTDConnection;
 }
Esempio n. 28
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            try
            {
                TDConnection tdConn = new TDConnection();
                tdConn.InitConnectionEx(qcUrl.Text);
                tdConn.ConnectProjectEx(qcDomain.Text, qcProject.Text, qcLogin.Text, qcPassword.Password);

                //MessageBox.Show((string)qcUrl.Text);
                //MessageBox.Show((string)qcDomain.Text);
                //MessageBox.Show((string)qcProject.Text);
                //MessageBox.Show((string)qcLogin.Text);
                //MessageBox.Show((string)qcPassword.Password);
                //MessageBox.Show((string)qcDomain.Text);
                //MessageBox.Show((string)testFolder.Text);
                //MessageBox.Show((string)testSet.Text);
                //RunFactory runFactory = (RunFactory)test.RunFactory;//

                //string testFolder = "^" + @"Root\MULTUM\Monthly Testing\SDK v4\";
                //string testSet = "BNF SDKv4 Server and Update";

                TestSetFactory     tsFactory = (TestSetFactory)tdConn.TestSetFactory;
                TestSetTreeManager tsTreeMgr = (TestSetTreeManager)tdConn.TestSetTreeManager;
                TestSetFolder      tsFolder  = (TestSetFolder)tsTreeMgr.get_NodeByPath(testFolder.Text);


                TDAPIOLELib.List tsList = (TDAPIOLELib.List)tsFolder.FindTestSets((string)testSet.Text, false, null);
                //TDAPIOLELib.List tsTestList = tsFactory.NewList("");

                //List tsList = tsFolder.FindTestSets(testSet, false, "status=No Run");
                //Feature\Multum\Black Box\Monthly Testing\SDK v4

                foreach (TestSet testset in tsList)
                {
                    Console.WriteLine("Test Set Folder Path: {0}", testFolder);
                    Console.WriteLine("Test Set:  {0}", testset.Name);

                    TestSetFolder tsfolder = (TestSetFolder)testset.TestSetFolder;
                    //string testFolder = "^" + @"Root\MULTUM\Monthly Testing\SDK v4\";
                    TSTestFactory    tsTestFactory = (TSTestFactory)testset.TSTestFactory;
                    TDAPIOLELib.List tsTestList    = tsTestFactory.NewList("");
                    //}

                    foreach (TSTest tsTest in tsTestList)//no such interface supported
                    {
                        Console.WriteLine("Test Set:  {0}", tsTest.Name);
                        //Console.ReadLine();

                        string status = (string)tsTest.Status;
                        Console.WriteLine("STATUS {0}", status);
                        //Console.WriteLine("PARAMS {0}",tsTest.Params);

                        Console.WriteLine("PARAMS {0}", tsTest.History);


                        TDAPIOLELib.Run lastRun = (TDAPIOLELib.Run)tsTest.LastRun;

                        // don't update test if it may have been modified by someone else
                        if (lastRun == null)
                        {
                            RunFactory runFactory = (RunFactory)tsTest.RunFactory;

                            TDAPIOLELib.List runs = runFactory.NewList("");
                            Console.WriteLine("test runs:  {0}", runs.Count);
                            String          date = DateTime.Now.ToString("MM-dd_hh-mm-ss");
                            TDAPIOLELib.Run run  = (TDAPIOLELib.Run)runFactory.AddItem("Run_" + date); //Run_5-23_14-49-52

                            var oRunInstance = (RunFactory)tsTest.RunFactory;
                            //var oRun = (Run)oRunInstance.AddItem("Performance Test");

                            //run.Status = "Passed";
                            //run.Post();
                            //run.Refresh();


                            var oTest            = (Test)tsTest.Test;
                            var tsDesignStepList = oTest.DesignStepFactory.NewList("");
                            var oStepFactory     = (StepFactory)run.StepFactory;
                            foreach (DesignStep oDesignStep in tsDesignStepList)
                            {
                                var oStep = (Step)oStepFactory.AddItem(oDesignStep.StepName);

                                //oStep.Status = "Passed";
                                //oStep.Post();
                            }
                        }
                    }
                }

                tdConn.DisconnectProject();
                tdConn.Disconnect();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                MessageBox.Show(ex.StackTrace);
            }
        }
Esempio n. 29
0
        private static void ExportRequirements()
        {
            string server_url = ConfigurationManager.AppSettings["SERVER_URL"];
            string username = ConfigurationManager.AppSettings["USER_NAME"];
            string password = ConfigurationManager.AppSettings["PASSWORD"];
            string domain = ConfigurationManager.AppSettings["DOMAIN"];
            string project = ConfigurationManager.AppSettings["PROJECT"];

            string req_file = ConfigurationManager.AppSettings["REQUIREMENTS_FILE"];
            string att_file = ConfigurationManager.AppSettings["ATTACHMENTS_FILE"];
            string att_path = ConfigurationManager.AppSettings["ATTACHMENTS_PATH"];

            if (!Directory.Exists(att_path))
            {
                Directory.CreateDirectory(att_path);
            }

            TDConnection tdc = new TDConnection();
            tdc.InitConnectionEx(server_url);
            tdc.ConnectProjectEx(domain, project, username, password);

            Console.WriteLine("Connected to QC Server");

            ReqFactory req_factory = (ReqFactory)tdc.ReqFactory;
            TDFilter req_filter = (TDFilter)req_factory.Filter;

            /**
             			 *  Set your own filters for requirements below
             */

            // req_filter["RQ_REQ_PATH"] = "AAAAAGAAE*";

            StreamWriter rfs = new StreamWriter(File.Open(req_file, FileMode.Create),
                                                       Encoding.Default,
                                                       1024);

            StreamWriter afs = new StreamWriter(File.Open(att_file, FileMode.Create),
                                                       Encoding.Default,
                                                       1024);

            foreach (Req r in req_filter.NewList())
            {
                string name = r.Name.Replace("\"","").Replace("\t","").Trim();

                Console.WriteLine("Req \"{0}\"", name);

                rfs.WriteLine(String.Join("\t", new String[]{
                                          	r.ID.ToString(),
                                          	r.ParentId.ToString(),
                                          	r["RQ_REQ_PATH"],
                                          	name,
                                          	r["RQ_VTS"].ToString()
                                          }));

                if (!r.HasAttachment)
                    continue;

                AttachmentFactory att_factory = r.Attachments;

                foreach (Attachment a in att_factory.NewList(""))
                {
                    Console.WriteLine("Attachment \"{0}\"", a.Name);

                    afs.WriteLine(String.Join("\t", new String[]{
                                              	r.ID.ToString(),
                                              	a.ID.ToString(),
                                              	a.Name,
                                              	a.FileSize.ToString(),
                                              	a.LastModified.ToShortDateString()
                                              }));

                    IExtendedStorage storage = a.AttachmentStorage;
                    storage.ClientPath = Path.GetFullPath(att_path) + "\\";
                    storage.Load(a.Name, true);
                }

            }

            rfs.Close();
            afs.Close();

            tdc.Disconnect();
            tdc.Logout();

            Console.WriteLine("Disconnected.");
        }
Esempio n. 30
0
        private static void ExportRequirements()
        {
            string server_url = ConfigurationManager.AppSettings["SERVER_URL"];
            string username   = ConfigurationManager.AppSettings["USER_NAME"];
            string password   = ConfigurationManager.AppSettings["PASSWORD"];
            string domain     = ConfigurationManager.AppSettings["DOMAIN"];
            string project    = ConfigurationManager.AppSettings["PROJECT"];

            string req_file = ConfigurationManager.AppSettings["REQUIREMENTS_FILE"];
            string att_file = ConfigurationManager.AppSettings["ATTACHMENTS_FILE"];
            string att_path = ConfigurationManager.AppSettings["ATTACHMENTS_PATH"];

            if (!Directory.Exists(att_path))
            {
                Directory.CreateDirectory(att_path);
            }

            TDConnection tdc = new TDConnection();

            tdc.InitConnectionEx(server_url);
            tdc.ConnectProjectEx(domain, project, username, password);

            Console.WriteLine("Connected to QC Server");

            ReqFactory req_factory = (ReqFactory)tdc.ReqFactory;
            TDFilter   req_filter  = (TDFilter)req_factory.Filter;


            /**
             *  Set your own filters for requirements below
             */

            // req_filter["RQ_REQ_PATH"] = "AAAAAGAAE*";


            StreamWriter rfs = new StreamWriter(File.Open(req_file, FileMode.Create),
                                                Encoding.Default,
                                                1024);

            StreamWriter afs = new StreamWriter(File.Open(att_file, FileMode.Create),
                                                Encoding.Default,
                                                1024);

            foreach (Req r in req_filter.NewList())
            {
                string name = r.Name.Replace("\"", "").Replace("\t", "").Trim();

                Console.WriteLine("Req \"{0}\"", name);

                rfs.WriteLine(String.Join("\t", new String[] {
                    r.ID.ToString(),
                    r.ParentId.ToString(),
                    r["RQ_REQ_PATH"],
                    name,
                    r["RQ_VTS"].ToString()
                }));

                if (!r.HasAttachment)
                {
                    continue;
                }

                AttachmentFactory att_factory = r.Attachments;

                foreach (Attachment a in att_factory.NewList(""))
                {
                    Console.WriteLine("Attachment \"{0}\"", a.Name);

                    afs.WriteLine(String.Join("\t", new String[] {
                        r.ID.ToString(),
                        a.ID.ToString(),
                        a.Name,
                        a.FileSize.ToString(),
                        a.LastModified.ToShortDateString()
                    }));

                    IExtendedStorage storage = a.AttachmentStorage;
                    storage.ClientPath = Path.GetFullPath(att_path) + "\\";
                    storage.Load(a.Name, true);
                }
            }

            rfs.Close();
            afs.Close();

            tdc.Disconnect();
            tdc.Logout();

            Console.WriteLine("Disconnected.");
        }
Esempio n. 31
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)
            {

            }
        }
Esempio n. 32
0
 public void Dispose()
 {
     _conn.DisconnectProject();
     _conn.Logout();
     _conn.ReleaseConnection();
     _conn = null;
 }
Esempio n. 33
0
 public CreateEntities(TDConnection connection)
 {
     _connection = connection;
 }
Esempio n. 34
0
        /// <summary>
        /// OVERRIDE FUNCTIONS
        /// </summary>
        /// <returns></returns>
        public override bool Connect()
        {
            bool blnResult = false;
            this.Message = "";

            try
            {
                td = new TDConnection();
                td.InitConnectionEx(this.Settings.Address);
                td.ConnectProjectEx(this.Settings.Domain, this.Settings.Database, this.Settings.User, this.Settings.Password);
                blnResult = td.Connected;

            }
            catch (Exception ex)
            {
                Framework.Log.AddError("Cannot connect to QC / ALM", ex.Message, ex.StackTrace);
            }

            if (blnResult)
            {
                Framework.Log.AddCorrect("Connected with HP QC / ALM");
            }
            else
            {
                Framework.Log.AddIssue("Cannot connect to QC / ALM");
            }

            return blnResult;
        }