Getting System.__ComObject instead of data while pulling data from HP ALM?

淺唱寂寞╮ 提交于 2019-12-11 15:03:17

问题


Currently im trying to pull the data from HP ALM by using c#. While pulling the data from ALM some fileds are showing "System.__ComObject" instead of data.

   public DataSet methodALM(TDConnection qccTDConnection)
    {

    DataSet dsTC= new DataSet();

        TDConnection qcc = qccTDConnection;
        //Decaler test set factory
        TestSetFactory testSetFactory = (TestSetFactory)qcc.TestSetFactory;

        //Define filter
        TDFilter filter = (TDFilter)testSetFactory.Filter;


        filter["CY_FOLDER_ID"] = "1";
        //get all the list of test cases
        List testSets = (List)testSetFactory.NewList(filter.Text);

        // List testSets = (List)testSetFactory.NewList(testSetFolderPath);


        string strTestCaseStatus = "Not Completed;No Run;Failed;Passed;Accepted Failure;Blocked;N/A;Repair;Unsupported";
        if (testSets != null)
        {
            //Read all the testcases status from appconfig files.
            string[] arrValueNames = strTestCaseStatus.Split(';');
            //Define dataset to hold all the values for testcases execution

            dsTC.Tables.Add("TestCaseExecutionReport");
            dsTC.Tables[0].Columns.Add("TestName");
            dsTC.Tables[0].Columns.Add("TestStatus");
            dsTC.Tables[0].Columns.Add("Type");
            dsTC.Tables[0].Columns.Add("PlannedHostName");
            dsTC.Tables[0].Columns.Add("ExecDate");
            dsTC.Tables[0].Columns.Add("Time");
            dsTC.Tables[0].Columns.Add("Iterations");
            dsTC.Tables[0].Columns.Add("PlannedExecDate");
            dsTC.Tables[0].Columns.Add("ResponsibleTester");


            //Read the Test cases status one by one from the folder location provided by the user.


            foreach (TDAPIOLELib.TestSet tst in testSets)
            {
               // string nameOfTestSuit = tst.Name;
                TSTestFactory tstf = (TSTestFactory)tst.TSTestFactory;
                List ftest = (List)tstf.NewList(" ");
                //integer value to hold the total status count
                int[] TCStatus = new int[arrValueNames.Length];

                    try
                     {
                        //trace trough each test cases to get the status
                         foreach (TDAPIOLELib.TSTest test in ftest)
                          {
                           //store that value in to dataset
                              string a1 = test.TestName.ToString();
                              string a2 = test.Status.ToString();
                              string a3 = test.Type.ToString();
                              string a4 = test.HostName.ToString();


                              string a6 = test.Instance.ToString();
                              string a7 = test.Modified.ToString();
                              var a8 = test.RunFactory.ToString();  // ---> showing "System.__ComObject"                             
                              var a9 = test.LastRun; // -----> showing "System.__ComObject"


                           dsTC.Tables[0].Rows.Add(a1, a2, a3, a4, a5, a6, a7, a8,a9);
                           //   (test.Name, test.Status, test.Type, test.HostName, test.TestName, test.LastRun, test.Modified, test.TestId);

                           }
                     //Get the total row
                     int totalRow = dsTC.Tables[0].Rows.Count;

                     }

                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);

                }



            }


        }


        return dsTC;
    }

Can anyone help me please?

来源:https://stackoverflow.com/questions/24256718/getting-system-comobject-instead-of-data-while-pulling-data-from-hp-alm

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!