0

テスト フォルダーにクエリを実行し、クエリ結果を取得しました。次に、テスト フォルダーでテスト ケースを検索する必要があります。参照またはその他の属性でクエリを実行する必要がありますか? 使用する必要がある構文を知りたいです。

4

1 に答える 1

1

前のクエリの結果としてテスト フォルダー名があるとします。

folder_name = tf_results.first.Name

このテスト フォルダーに関連付けられているテスト ケースは、次の構文を使用して見つけることができます。

tc_query.query_string = "(TestFolder.Name = \"#{folder_name}\")" 

Rally Ruby REST API (rally_api gem)を使用する完全なコードを次に示します。

require 'rally_api'


#Setup custom app information
headers = RallyAPI::CustomHttpHeader.new()
headers.name = "find test cases by test folder name"
headers.vendor = "Nick M RallyLab"
headers.version = "1.0"

# Connection to Rally
config = {:base_url => "https://rally1.rallydev.com/slm"}
config[:username] = "user@co.com"
config[:password] = "secret"
config[:workspace] = "W"
config[:project] = "P"
config[:headers] = headers #from RallyAPI::CustomHttpHeader.new()

@rally = RallyAPI::RallyRestJson.new(config)

tf_query = RallyAPI::RallyQuery.new()
tf_query.type = :testfolder
tf_query.fetch = "Name,FormattedID"
tf_query.workspace = {"_ref" => "https://rally1.rallydev.com/slm/webservice/1.43/workspace/11111.js" } #optional
tf_query.project = {"_ref" => "https://rally1.rallydev.com/slm/webservice/1.43/project/22222.js" } #optional
tf_query.page_size = 200 #optional - default is 200
tf_query.limit = 1000 #optional - default is 99999
tf_query.project_scope_up = false
tf_query.project_scope_down = true
tf_query.order = "Name Asc"
tf_query.query_string = "(Name = \"My Test Folder 1\")"

tf_results = @rally.find(tf_query)


tf_results.each do |t|
    puts "Name: #{t["Name"]}, FormattedID: #{t["FormattedID"]}"
    t.read
end

folder_name = tf_results.first.Name

tc_query = RallyAPI::RallyQuery.new()
tc_query.type = :testcase
tc_query.fetch = "Name,FormattedID"
tc_query.workspace = {"_ref" => "https://rally1.rallydev.com/slm/webservice/1.43/workspace/12352608129.js" } #optional
tc_query.project = {"_ref" => "https://rally1.rallydev.com/slm/webservice/1.43/project/12352608219.js" } #optional
tc_query.page_size = 200 #optional - default is 200
tc_query.limit = 1000 #optional - default is 99999
tc_query.project_scope_up = false
tc_query.project_scope_down = true
tc_query.order = "Name Asc"

tc_query.query_string = "(TestFolder.Name = \"#{folder_name}\")"  

puts "same string" if ("My Test Folder 1" == folder_name)

tc_results = @rally.find(tc_query)

tc_results.each do |t|
    puts "Name: #{t["Name"]}, FormattedID: #{t["FormattedID"]}"
    t.read
end
于 2013-08-19T14:57:34.967 に答える