目前我正在尝试使用c#从HP ALM中提取数据。从ALM中提取数据时,一些文件显示“System .__ ComObject”而不是数据。
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;
}
有人可以帮我吗?