2

Which is the Interface used to access all the test cases in test plan in QC? For Test set details in Test lab we have ITestSetFactory. But how can we get all the test details from QC in some collection object in Key-Value pair?

The data retrieval is more crucial for now. Using OTAClient.dll converted in Java jar and using com4j as a bridge!

Thanks in advance!

Vinay Gupta
  • 213
  • 3
  • 16

2 Answers2

2

For the test plan structure (tree and folders) there are the ITreeManager and the ITestFolder/ITestFolderFactory Interfaces, for the tests there is the ITestFactory Interface.

With the NewList methods of the TestFolder and the TestFactory objects, you can create a recursive function which gets you all the tests in the test plan.

Roland
  • 1,220
  • 1
  • 14
  • 29
  • Well, this was helpful in understanding the structure but in code, found out that there is no interface as ITestFolder/ITestFolderFactory. I am not able to get the object for folder list now, leaving my code with classcastexceptions: ITreeManager iTreeManager = QCConnection.treeManager().queryInterface(ITreeManager.class); IList ilist1 = iTreeManager.rootList((short)2); Iterator> itr = ilist1.iterator(); while (itr.hasNext()){ Com4jObject comObj = (Com4jObject) itr.next(); ITestFactory iTestfactory = (ITestFactory)comObj; } – Vinay Gupta Apr 30 '14 at 09:50
2
ITDConnection QCConnection =null;
try{
  QCConnection = ClassFactory.createTDConnection();
  QCConnection.initConnection("QC URL", domain, domainPswd);
  IList domains = QCConnection.domainsList();
  IList projectList = QCConnection.projectsList();
  List<String> domainList = new ArrayList<String>();
  for(int i=1;i<domains.count();i++){
    domainList.add((String)domains.item(i));
    System.out.println("DOmains: "+domains.item(i));
  }
  for(int i=1;i<projectList.count();i++){
    System.out.println("Projects : "+projectList.item(i));
  }
  QCConnection.connectProject(project, "LoginName", "Password");
  ITreeManager iTreeManager = QCConnection.treeManager().queryInterface(ITreeManager.class);
  ISubjectNode iSubNode = iTreeManager.nodeByPath("Subject").queryInterface(ISubjectNode.class);

  IList testFolders = iSubNode.newList();
  for(Com4jObject isys:testFolders){
    System.out.println("Test folder : "+isys.queryInterface(ISysTreeNode.class).name());
  }
}
catch(Exception e){
  System.out.println("Exceptions occured: "+e.getMessage());
}

Will Display all the folders in the project!

Vinay Gupta
  • 213
  • 3
  • 16