Skip to main content

Getting Test Case List from QC using Com4j

No replies
vivek122in
Offline
Joined: 2013-02-03
Points: 0

have written the following code to retrieve the list of Test Cases from QC, but the tsTestFactory is null, whereas when I evaluate qcConnect.testSetFactory() it returns a Com4j object.

What am i doing wrong here

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());
}