0

我正在尝试使用 COM4J 获得 QC 要求覆盖率。我能够获得涵盖要求的测试用例列表,但我不知道如何获取测试用例 ID 和名称等,

IReqFactory reqFactory=(itdc.reqFactory()).queryInterface(IReqFactory.class);
IReq iReq = (reqFactory.item(17447)).queryInterface(IReq.class);
System.out.println("Coverage count"+iReq.getCoverList(true).count());
System.out.println(iReq.name()+"Requirement Name"+iReq.id()+"Requirement Id");

IList list1=iReq.getCoverList(true);

for(int i=1;i<=list1.count();i++){
    //Com4jObject comobj = (Com4jObject)itr.next();
    System.out.println("Covered Tests : "+list1.iterator());
}

我的输出是

Coverage count3
CAFE Core Functionality-750133Requirement Name17447Requirement Id
Covered Tests : 430171564
Covered Tests : 430171796
Covered Tests : 430172260

在这里我需要Testcase idandname而不是Hashcode. 提前致谢。

4

1 回答 1

0

这是工作代码。现在我正在获取所需的信息。

ITestFactory sTestFactory = (itdc.testFactory()).queryInterface(ITestFactory.class); /*ITest iTest = (sTestFactory.item(23054)).queryInterface(ITest.class); //ITest iTest1= (sTestFactory.item(5)).queryInterface(ITest.class); System.out.println("Coverage List1 =" +iTest.getCoverList() + " test --> "); */

        IReqFactory reqFactory=(itdc.reqFactory()).queryInterface(IReqFactory.class);
        IReq iReq = (reqFactory.item(17447)).queryInterface(IReq.class);
        System.out.println("Coverage count"+iReq.getCoverList(true).count());
        System.out.println(iReq.name()+"Requirement Name"+iReq.id()+"Requirement Id");



        IList list1=iReq.getCoverList(true);
        for(int i=1;i<=list1.count();i++){
            System.out.println("Covered Tests : "+list1.iterator());
          }
        System.out.println("Requirement Coverage Status = "+iReq.hasCoverage());
        Iterator itr = list1.iterator();
        System.out.println(itr.getClass());
        IList list2=iReq.getCoverList(true);
        while (itr.hasNext())
        {
           Com4jObject comObj =(Com4jObject)itr.next();
           ITestSet sTestSet = comObj.queryInterface(ITestSet.class);     
           ITest iTest = comObj.queryInterface(ITest.class);
           System.out.println(iTest.id()+"**************Name of the Test*************"+iTest.name()+"***********ids of the Test**************"+iTest.execStatus()+"***********Status of execution***********"+iTest.execDate()+"**********Executuion Date*********"+iTest.lastRun()+"***********");

}

于 2014-09-25T10:43:26.607 回答