Search code examples
javahp-quality-center

Read test data from Mercury Quality center 9 via java


We use Mercury Quality Center 9 for storage tests and test results.
I need to read test data from Test Plan and to write test result into Test Lab via java.
I tried to find about this in google but I have not found anything.

UPDATE:

I tried to use qctools4j for working with MQC 9 with the following code:

public void connect() {
try{
    IQcConnection conn = QcConnectionFactory.createConnection("http://qc/qcbin");                           
    conn.connect("login", "password", "DEFAULT","project");                         
    TestClient tc = conn.getTestClient();
    System.out.println("Connection success!!!");
}
catch (QcException e) {
    System.out.println(e.getMessage());
    e.printStackTrace();
}
}

I got the following exception message:

*org.qctools4j.exception.QcException: Can't co-create object
    at org.qctools4j.clients.QcConnectionImpl.initConnection(Unknown Source)
    at org.qctools4j.clients.QcConnectionImpl.<init>(Unknown Source)
    at org.qctools4j.QcConnectionFactory.createConnection(Unknown Source)
    at automation_framework1.automation_framework1.QCWorker.connect1(QCWorker.java:38)
    at automation_framework1.automation_framework1.Main.main(Main.java:12)
Caused by: com.jacob.com.ComFailException: Can't co-create object
    at com.jacob.com.Dispatch.createInstanceNative(Native Method)
    at com.jacob.com.Dispatch.<init>(Dispatch.java:99)
    at com.jacob.activeX.ActiveXComponent.<init>(ActiveXComponent.java:58)
    at org.qctools4j.clients.QcConnectionImpl.initConnection(Unknown Source)*

What am I doing wrong?


Solution

  • I took part in developping QC 9 and I am not sure there is Java API. However, there is a COM interface or OTA API. You can use some library that helps to call COM API from Java.

    For example:

    1. Jacob it is open source and here are some examples.
    2. Nevaobject - it is commercial but more stable.

    Good luck!

    EDIT:

    just saw qctools4j (it is based on Jacob) - never tried it.