0

I have the following structure in QC

Test Plan > Subject > Sample(Folder Name) > Scenario (Sub Folder) > TC1 (Test Case ) 

How can i retrieve TC1 using OTA and Java. Written the following code to get the Test folders , but not able to get the test cases under the Scenario folder

ITreeManager iTreeManager = qcConnect.treeManager().queryInterface(ITreeManager.class);
ISubjectNode iSubNode = iTreeManager.nodeByPath("Subject\\Sample").queryInterface(ISubjectNode.class);
IList testFolders = iSubNode.newList();
  for (Com4jObject isys : testFolders) {
        System.out.println("Test folder : "+ isys.queryInterface(ISysTreeNode.class).());           
    }

How can I get to TC1 and update the fields in the test case

Vivek
  • 2,091
  • 11
  • 46
  • 61

1 Answers1

1

Once you get the ISubjectNode you want (the object that represents Test Plan folders), you can access the 'TestFactory' property of that folder to return a factory object that will let you access the tests stored in that folder.

I don't write Java, so here's my best attempt at what you need based on the code you provided:

// First access the TestFactory from the folder
ITestFactory iTestFact = iSubject.testFactory;

// Pull back a list of all tests.  Refer to OTA documentation on how to use filters on the list.
IList testList = iTestFact.newList();

// You can now iterate over the list of tests like you did subject folders
HgCoder
  • 1,243
  • 9
  • 14