【发布时间】:2016-10-31 17:25:44
【问题描述】:
我在 Rally 中有大量测试用例。为了更容易搜索测试用例,我为测试用例对象引入了一个新字段,称为“功能性”。该字段具有属性类型“下拉列表(多值)”。现在我需要创建一个 Ruby 脚本,这样我就可以为这个字段分配(可能是多个)值,这就是我的问题所在:我该如何编码?我假设该变量包含一个数组或指向列表的指针。我希望能够分配和删除单个值,而不会影响已经分配给特定测试用例的其他值。
当我查询变量时查看 Rally 返回的内容,我并没有真正了解它的结构。
"https://rally1.rallydev.com/slm/webservice/v2.0/attributedefinition/68878414616", "_refObjectUUID": "8cb97bae-ea25-4805-8e5b-77944ddc4f6a", "_refObjectName": "Functionality", "_type": "AttributeDefinition"}, "StringValue": "Account History", "ValueIndex": 0, "_type": "AllowedAttributeValue"}, {"_rallyAPIMajor": "2", "_rallyAPIMinor": "0", "_ref":
查看了示例和 Rally API,但无法找到有关如何完成此操作的任何信息。
更新:
基于来自@JPKole 的代码 sn-p,我创建了一个程序。
fields = {:attributedefinition => { '_ref' => this_artifact._ref },
:stringvalue => string_value
}
puts fields
puts "Allowed Attribute Value is #{:allowedattributevalue}"
new_value = @rally.create(:allowedattributevalue, fields)
我认为程序将正确的值加载到 string_value 和 fields 变量中。 puts 行给出: 处理测试用例 TC7203
{:attributeddefinition=>{"_ref"=>"https://rally1.rallydev.com/slm/webservice/v2.0/testcase/71703906048"}, :stringvalue=>"促销"} 允许的属性值是allowedattributevalue
其中 71703906048 是我正在处理的测试用例的 ID。 但后来我得到以下信息:
测试用例 TC7203 因错误未更新
请求错误 - https://rally1.rallydev.com/slm/webservice/v2.0/allowedattributevalue/create?workspace=workspace/50775741420 -
{:errors=>["抱歉!发生了意外错误。
我们已记录此错误并将开始调查。意思是
e,如果您想与我们的支持团队交谈,请参考以下信息:
com.rallydev.util.UnableToInvokeMethodException:方法 AllowedAttributeValue.newAllowedAttributeValue(TestCase) 不存在
2016-11-14 01:37
CST 美国/芝加哥"], :warnings=>[]}
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rally_api-1.2.1/lib/rally_api/rally_json_connection.rb:154:in send_request'
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rally_api-1.2.1/lib/rally_api/rally_rest_json.rb:107:insend_request'
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rally_api-1.2.1/lib/rally_api/rally_rest_json.rb:189:in create'
C:/Ruby22-x64/Sorens Ruby/UpdateFunct1.rb:118:inblock (2 级) in '
C:/Ruby22-x64/Sorens Ruby/UpdateFunct1.rb:103:in each'
C:/Ruby22-x64/Sorens Ruby/UpdateFunct1.rb:103:inblock in '
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rally_api-1.2.1/lib/rally_api/rally_query_result.rb:22:in block in each'
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rally_api-1.2.1/lib/rally_api/rally_query_result.rb:21:ineach'
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rally_api-1.2.1/lib/rally_api/rally_query_result.rb:21:in each'
C:/Ruby22-x64/Sorens Ruby/UpdateFunct1.rb:97:in'
知道我做错了什么吗?
【问题讨论】:
-
2016-11-01 的文档 (help.rallydev.com/create-custom-fields#create) 说“多值自定义字段不适用于 Web 服务 API 查询。所有其他自定义字段都可用于查询。”
-
该文档在过去是有效的,但现在可以通过 WSAPI 完全使用 MVCF。感谢您指出这一点 - 我们已删除帮助中的项目符号,因此它现在更准确。