javainterfacehp-quality-centercom4j

Add test object in Test set in QC through OTAClient in JAVA


I have a list of test ids which are to be added in a newly created test set. For getting test details [or test objects] i am using the following code:

 ITestFactory sTestFactory = (QCConnection.testFactory()).queryInterface(ITestFactory.class);
ITest iTest = (sTestFactory.item(63514)).queryInterface(ITest.class);

I am also able to get the test set object by using the interface ITestSet. Now I am stuck on how to add the test object in the test set. Tried with the following code and its not even throwing any exceptions but still is not so useful:

IBaseFactory testFactory = testSet.tsTestFactory().queryInterface(IBaseFactory.class);
IList testInstances = testFactory.newList(null);
testInstances.add(iTest);

Can anyone provide a quick help? Used JAVA - com4j with OTAClient jar. Thanks in advance


Solution

  • Well, I am feeling stupid at the moment. The answer is very simple and sorry i wasted a space on the forum. But might be helpful to someone with similar requirement. The code is as simple as :

    IBaseFactory testFactory = testSet.tsTestFactory().queryInterface(IBaseFactory.class);
    testFactory.addItem(iTest); 
    

    where iTest is the object from test plan

    ITestFactory sTestFactory = (QCConnection.testFactory()).queryInterface(ITestFactory.class);
    ITest iTest = (sTestFactory.item(63514)).queryInterface(ITest.class);
    

    I am sorry again for wastage of time and space!