web服务——无法使用REST API通过测试用例标题获取RQM测试用例



我使用java RQM Rest API从RQM工具获取数据

我在项目CLM test(质量管理)中有一个测试用例。测试用例标题是

预付费住宅客户到后付费消费者(卡塔尔国民)客户迁移。(现有客户仅预付费订阅)

内部Id为3271我正试图从测试套件中获取测试用例细节。当从TestSuite获取测试用例细节时,我得到了测试用例href

<testcase href= "https://clm.techmahindra.com:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/CLM+Test+%28Quality+Management%29/testcase/Pre-Paid_Residential Customer_to_Post-Paid_Consumer_(Qatari-National)_Customer_Migration.(Existing_Customer_having_only_prepaid_subscription).xml" />

如果您观察测试用例href,它在'Paid_Residential'后面包含一个空格所以当用这个href查询服务器时,我得到URISyntaxException由于字符串中的空间。

还有一件奇怪的事情是:当我使用RestClient(FireFox插件)查询服务器时,此查询显示400错误-错误请求。但是当我点击TestSuite记录中收到的testcase href时,我能够获得测试用例记录。

请帮我弄到这些数据。

似乎标题包含一些特殊字符,抛出URISyntaxException当我们试图将href转换为URI百分比编码格式。我最初使用URI java类进行转换,它无法转换字符串(href= " https://clm.techmahindra.com:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/CLM+Test+%28Quality+Management%29/testcase/Pre-Paid_Residential Customer_to_Post-Paid_Consumer_(Qatari-National)_Customer_Migration.(Existing_Customer_having_only_prepaid_subscription).xml ")

但是当我尝试使用URLEncoder类时,它工作了。现在我可以得到记录,即使测试用例中有特殊字符。

片段:

String strURI = URLEncoder.encode(href, "UTF-8"); 

最新更新