2

我正在使用 ruby​​ Cucumber,我正在更新 Testrail 上的测试结果。我可以毫无问题地更新一个结果。我的问题是,根据下面的代码,如何使用 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
4

1 回答 1

0

我对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: testrailtaggingTESTRAIL_BATCH_SIZEenv 变量有助于避免被 tetrail 限制。

于 2019-02-25T03:46:32.647 回答