我正在使用Ruby Cucumber,我正在测试轨道上更新测试结果。我可以毫无问题地更新一个结果。我的问题是,根据下面的代码,如何使用 add_result 方法更新多个测试运行?
require 'testrail-ruby'
client = TestRail::APIClient.new('https:XXXXXt/')
client.user = 'XXXXXXXXXXXX'
client.password = 'XXXXXXXXX'
r = client.send_post(
'add_result/483750',
{ :status_id => 1, :comment => 'This test worked fine!' }
)
#puts r
end
我对testrail_client
宝石运气很好。它非常相似:https://rubygems.org/gems/testrail_client/versions/0.0.1
data =[{
"test_id" => 1234
"status_id" => status_value,
"comment" => "blarg"
}]
url = "https://canvas.testrail.com"
trclient = TestRail::APIClient.new(url)
trclient.user = ENV["TESTRAIL_USER"]
trclient.password = ENV["TESTRAIL_PASSWORD"]
uri = "add_results/#{run_id}"
trclient.send_post_retry(uri, "results" => data)
如果您使用的是 rspec,则有一个 gem 可以自动将结果发布到 testrail:testrailtagging
。TESTRAIL_BATCH_SIZE
env 变量有助于避免被 tetrail 限制。