【问题标题】:Get Test cases from Test Plan using OTA使用 OTA 从测试计划中获取测试用例
【发布时间】:2014-08-05 10:31:51
【问题描述】:

我在QC中有以下结构

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

如何使用 OTA 和 Java 检索 TC1。 编写以下代码获取Test文件夹,但无法获取Scenario文件夹下的测试用例

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

如何进入 TC1 并更新测试用例中的字段

【问题讨论】:

    标签: java hp-quality-center com4j


    【解决方案1】:

    获得所需的 ISubjectNode(表示测试计划文件夹的对象)后,您可以访问该文件夹的“TestFactory”属性以返回一个工厂对象,该对象可让您访问存储在该文件夹中的测试。

    我不会编写 Java,因此根据您提供的代码,这是我对您需要的最佳尝试:

    // 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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-19
      相关资源
      最近更新 更多