access defects from HP quality center using com4j (java)

1.8k views Asked by At

i have been able to connect with HP QC project using com4j. But now i want to be able to access the Defects using filters. I dont know the actual field names of all the fields as i do not have admin rights for QC, so i cannot go to customization tab.

I want to know, how can i retrieve a defect record and output that record's columns using fieldnames. later i want to save those records in an excel file! but that is for later. please help me up with the CODE !

MY PROGRESS:

import ota.*;

public class comqc {
  public void login(){
    ITDConnection4 td = ClassFactory.createTDConnection();      
    td.initConnectionEx("https://qcbt10.saas.hp.com/qcbin");
    System.out.println(td.connected());         
    td.connectProjectEx("domain", "project", "user", "pass");

    System.out.println(td.dbName());
    IBugFactory bugfactory = td.bugFactory().queryInterface(IBugFactory.class);
    ITDFilter fil = bugfactory.filter().queryInterface(ITDFilter.class);
    ITDField field = bugfactory.fields().queryInterface(ITDField.class); 
    }

  public static void main(String args[]){
    comqc obj = new comqc();
    obj.login();
 }
}

Thanks in advance!

1

There are 1 answers

0
pvash On

was able to retrieve the defect by their fieldname! used this code!

IBug bug = bugfactory.item(55203).queryInterface(IBug.class);
System.out.println(bug.assignedTo());

earlier i was trying the first expression with item(1) or item(2) etc, and it was giving an error! 'item index' value is actually the 'defect ID' for the bug, so just needed to enter the correct defect ID and it worked!

but i can print values for only limited number of columns for a bug, not all, FOR NOW (Maybe they are not the predefined fields) !