Java:使用qcutils4j.jar连接到Quality Center

时间:2015-08-31 10:08:08

标签: java eclipse qc jacob hp-quality-center

我为自动化框架开发了一个转轮模块,允许测试人员使用Eclipse IDE创作并执行测试。

现在我想添加一个模块来连接到QC并将我的测试上传到相应的测试计划。为此,我使用的是qcutils.jar。

我的代码:

public static void QCConnect()
{
    File fUser = new File("lib");
    File fNat = new File(fUser, "jacob-1.18-x64.dll");
    // Set java library path at runtime

    String javaPath = System.getProperty("java.library.path");
    javaPath = javaPath+";"+fUser.getAbsolutePath()+";";
    System.setProperty("java.library.path", javaPath);
    String javaPath1 = System.getProperty("java.library.path");

   //       Load dll

    System.load(fUser.getAbsolutePath()+"\\jacob-1.18-x64.dll");


    IQcConnection conn = QcConnectionFactory.createConnection("https://<myqc>/qcbin");
    conn.connect("user", "pass", "domain", "project");
    TestClient tc = conn.getTestClient();

    Test t = new Test();
    t.setTestFolder(TestFolder.ROOT_FOLDER + "\\Demo");
    t.setDescription("This is a QcTools4j Test");

    t.setStatus("Design");
    t.setName("myTest");
    tc.saveTest(t)
   }

遇到异常:

 org.qctools4j.utils.DllLoader loadLibrary
 SEVERE: DLL not found in the class path!
 Exception in thread "main" org.qctools4j.exception.QcException: Can't get  object clsid from progid
at org.qctools4j.clients.QcConnectionImpl.initConnection(Unknown Source)
at org.qctools4j.clients.QcConnectionImpl.<init>(Unknown Source)
at org.qctools4j.QcConnectionFactory.createConnection(Unknown Source)
at QCJavaConnect.main(QCJavaConnect.java:37)
Caused by: com.jacob.com.ComFailException: Can't get object clsid from progid
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)
... 3 more

我正在寻找使用java处理QC的解决方案,我不介意使用任何其他java包。

提前致谢!

0 个答案:

没有答案