0

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

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

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

内部 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 Error - Bad request。但是,当我单击 TestSuite 记录中收到的测试用例 href 时,我可以获得测试用例记录。

请帮我获取这些数据。

4

1 回答 1

0

当我们尝试将 href 转换为 URI 百分比编码格式时,似乎标题包含一些引发URISyntaxException的特殊字符。我最初使用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"); 
于 2015-08-20T04:19:27.907 回答