问题描述
我试图在硒JAVA(testNG)中使用testLink(1.9.14(Padawan))xml-rpc将测试结果自动同步到testlink.我提供了用于webdriverJS测试的devkey和url.
I was trying to use the testLink(1.9.14 (Padawan)) xml-rpc in selenium JAVA(testNG) to sync the test result to testlink automatically.I provided the devkey and url what I used for the webdriverJS test.
public static String DEVKEY = "e69035750c91d1775900f4ce16dbcfb5";
public static String URL ="http://computername:80/testlink/lib/api/xmlrpc/v1/xmlrpc.php";
运行测试套件时,总是出现类似以下错误:
When I ran the test suite, I always got the error something like:
testlink.api.java.client.TestLinkAPIException: The call to the xml-rpc client failed.
at testlink.api.java.client.TestLinkAPIClient.executeXmlRpcMethod(TestLinkAPIClient.java:1266)
at testlink.api.java.client.TestLinkAPIClient.execXmlRpcMethodWithCache(TestLinkAPIClient.java:1195)
at testlink.api.java.client.TestLinkAPIClient.getProjects(TestLinkAPIClient.java:726)
at testlink.api.java.client.TestLinkAPIHelper.getProjectInfo(TestLinkAPIHelper.java:64)
at testlink.api.java.client.TestLinkAPIHelper.getProjectID(TestLinkAPIHelper.java:48)
at testlink.api.java.client.TestLinkAPIClient.reportTestCaseResult(TestLinkAPIClient.java:184)
at rocket.aldon.almwp.test.reportResult(test.java:19)
at rocket.aldon.almwp.test.Test1(test.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:643)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at org.testng.TestRunner.privateRun(TestRunner.java:782)
at org.testng.TestRunner.run(TestRunner.java:632)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
at org.testng.SuiteRunner.run(SuiteRunner.java:268)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
at org.testng.TestNG.run(TestNG.java:1064)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:126)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:137)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:58)
Caused by: org.apache.xmlrpc.client.XmlRpcClientException: Failed to parse servers response: Expected methodResponse element, got br
at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:177)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:145)
at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:94)
at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:44)
at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:53)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:166)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:157)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:146)
at testlink.api.java.client.TestLinkAPIClient.executeXmlRpcMethod(TestLinkAPIClient.java:1232)
... 31 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 7; Expected methodResponse element, got br
at org.apache.xmlrpc.parser.XmlRpcResponseParser.startElement(XmlRpcResponseParser.java:98)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:175)
... 39 more
似乎XML-RPC连接在这里不起作用,从调试信息中,我可以看到api对象具有isConnected = false;
有人会遇到这个问题并找到解决方案吗?我正在使用的罐子:
Seems like the XML-RPC connection not works here, from the debug info, I could see the api object has isConnected = false;
Could someone had met this and got a solution for it?The jars I am using:
testlink-api-client-2.0.jar
selenium-java-2.52.0.zip
selenium-server-standalone-2.52.0.jar
xmlrpc-common-3.1-sources.jar
xmlrpc-common-3.1.jar
xmlrpc-client-3.1-sources.jar
xmlrpc-client-3.1.jar
commons-logging-1.1.jar
guice-3.0.jar
velocity-dep-1.4.jar
ws-commons-util.1.0.2.jar
有人可以帮助研究吗?我用了很长时间的Google仍然不清楚.
Can someone help to research? I google for a long time still not get clear way.
推荐答案
前提条件:
- 应启用自动化API
- 应创建测试项目,测试计划,构建和测试用例.
- 手动通过/失败应该可以工作
请执行以下更改,然后重新启动Apache服务:
-
按照 Testlink文件夹中的 config.inc.php 中的以下行进行更改:
Do change as per given below lines in config.inc.php in Testlink folder :
$tlCfg->exec_cfg->enable_test_automation = ENABLED;
$tlCfg->api->enabled = TRUE;
在C:\xampp\htdocs\testlink-1.9.15\lib\api\xmlrpc\v1
文件夹中,如下编辑该文件 xmlrpc.php :
In C:\xampp\htdocs\testlink-1.9.15\lib\api\xmlrpc\v1
folder edit this file xmlrpc.php as under:
require_once("xmlrpc.class.php");
define('XMLRPC_REQUEST', true);
// Some browser-embedded clients send cookies. We don't want them.
$_COOKIE = array();
$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input");
$XMLRPCServer = new TestlinkXMLRPCServer();
注意:只要有其他可用的配置,只需替换上面的行.不要编辑其他任何内容.
Note : Just replace above lines If there is any other configurations are available. Do not edit anything else.
-
重新启动Apache服务后,打开Testlink和打开测试项目,并在项目管理中启用
Test Automation (API keys)
After restart Apache service, Open Testlink and Open Test Project and enable
Test Automation (API keys)
in Project Management
从用户设置中获取 API密钥,并将其用作DEV_KEY
Take API key from User Setting and use it as DEV_KEY
请让我知道是否有任何查询.
Please let me know if any query.
这篇关于TestLink XML-RPC到xml-rpc客户端的调用失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!