2013-02-03 50 views
1

我已經編寫了以下代碼以從QC檢索測試用例列表,但tsTestFactory爲空,而當我評估qcConnect.testSetFactory()時,它將返回Com4j對象。從QC使用Com4j獲取測試用例列表

我在做什麼錯在這裏

ITestSetFactory tsFactory = (qcConnect.testSetFactory()).queryInterface(ITestSetFactory.class); 
ITestSetTreeManager tsTreeMgr = (qcConnect.testSetTreeManager()).queryInterface(ITestSetTreeManager.class); 

ITestSetFolder tsFolder = (tsTreeMgr.nodeByPath(nodePath)).queryInterface(ITestSetFolder.class); 
IList its1 = tsFolder.findTestSets(testSetName, false, ""); 

Iterator itr = its1.iterator(); 
while (itr.hasNext()) 
{ 
    Com4jObject comObj = (Com4jObject) itr.next(); 
    ITestSet sTestSet = comObj.queryInterface(ITestSet.class); 
    System.out.println(sTestSet.name()); 
    System.out.println(sTestSet.id()); 

    ITestFactory tsTestFactory = (qcConnect.testSetFactory()).queryInterface(ITestFactory.class); 
    ITSTest sTSTest = (tsTestFactory.item(sTestSet.id())).queryInterface(ITSTest.class); 

    System.out.println(sTSTest.name()); 
} 

回答

2

的TestFactory中是不一樣的TestSetFactory,所以你不能做到這一點:

ITestFactory tsTestFactory =(qcConnect.testSetFactory())。的QueryInterface(ITestFactory.class);

嘗試qcConnect.testFactory而不是qcConnect.testSetFactory。

相關問題