testrail_api 0.1.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 56946d133f1eaa0e9b2e342c28e6f3b910379b7c
4
- data.tar.gz: 1c0a33fa6e867ed4f116a164c8b8d9b67425eb64
3
+ metadata.gz: 52c66fb3d7da04169026a46c64ee81a9b3678eda
4
+ data.tar.gz: e9d7db52100d0b6be5fa8935a3082e17555e3435
5
5
  SHA512:
6
- metadata.gz: 5876e9354a0ec6abbc0cdfdbf443f9a7f1ac494f1c7cb9b37a10cca36f4f06d1d764e4c3333cc126978ca5570ba2ede2e300dbd31d623ba91ad687dab2a34619
7
- data.tar.gz: 14dd134a9e8dbcd10bf7db8abe11d147be13fd93ac8992ff4ff0e9e568738269123bef79e0dac6bd987b1e28d8c4c5d27da40040fbb44b90a38c4e9adaef81d3
6
+ metadata.gz: 1a1669767ea5341ebb7c2079157d79ff89ce84a6fd127944e1b7eb4d54250606ed4c73e28fe0d058fbda57df0bf7b98c1851eab99b7986959d23eef8590e3df0
7
+ data.tar.gz: afc8b886fbd51b9e642a12baa0e1df756ce0b3244647510db7eb847af0b9d44ef0ea20589300713731b4b8d9f53161efd646c29f8f0bca647994055e4bee7a18
data/.gitignore CHANGED
@@ -27,7 +27,7 @@ build/
27
27
 
28
28
  # for a library or gem, you might want to ignore these files since the code is
29
29
  # intended to run in multiple environments; otherwise, check them in:
30
- # Gemfile.lock
30
+ Gemfile.lock
31
31
  # .ruby-version
32
32
  # .ruby-gemset
33
33
 
data/README.md CHANGED
@@ -1,14 +1,15 @@
1
- # Testrail API v2 client
1
+ # Testrail API v2
2
2
 
3
- This is client for TestRail API v2. See official [documentation](http://docs.gurock.com/testrail-api2/start) for
4
- reference.
3
+ [TestRail API v2](http://docs.gurock.com/testrail-api2/start) wrapper, written in Ruby.
4
+
5
+ [![Gem Version](https://badge.fury.io/rb/testrail_api.svg)](http://badge.fury.io/rb/testrail_api)
5
6
 
6
7
  ## Installation
7
8
 
8
9
  Add this line to your application's Gemfile:
9
10
 
10
11
  ```ruby
11
- gem 'testrail_api'
12
+ gem 'testrail_api', '~> 0.1.1'
12
13
  ```
13
14
 
14
15
  And then execute:
@@ -26,6 +27,10 @@ client = TestRail::Client.new('example.testrail.com', 'admin@example.com', 'pass
26
27
  puts client.projects
27
28
  ```
28
29
 
30
+ ## Documentation
31
+
32
+ [http://www.rubydoc.info/gems/testrail_api](http://www.rubydoc.info/gems/testrail_api)
33
+
29
34
  ## Development
30
35
 
31
36
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
@@ -33,7 +38,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
33
38
  ## Contributing
34
39
 
35
40
  Bug reports and pull requests are welcome on GitHub at https://github.com/kirillzh/testrail_api. This project is
36
- intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
41
+ intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org/) code of conduct.
37
42
 
38
43
 
39
44
  ## License
@@ -0,0 +1,5 @@
1
+ class Array
2
+ def to_list
3
+ join(',')
4
+ end
5
+ end
@@ -0,0 +1 @@
1
+ require 'array/to_list'
@@ -0,0 +1,37 @@
1
+ require 'testrail_api/client/case_fields'
2
+ require 'testrail_api/client/case_types'
3
+ require 'testrail_api/client/cases'
4
+ require 'testrail_api/client/milestones'
5
+ require 'testrail_api/client/plans'
6
+ require 'testrail_api/client/priorities'
7
+ require 'testrail_api/client/projects'
8
+ require 'testrail_api/client/result_fields'
9
+ require 'testrail_api/client/results'
10
+ require 'testrail_api/client/runs'
11
+ require 'testrail_api/client/sections'
12
+ require 'testrail_api/client/statuses'
13
+ require 'testrail_api/client/suites'
14
+ require 'testrail_api/client/tests'
15
+ require 'testrail_api/client/users'
16
+
17
+ module TestRail
18
+ class Client
19
+ module API
20
+ include TestRail::Client::CaseFields
21
+ include TestRail::Client::CaseTypes
22
+ include TestRail::Client::Cases
23
+ include TestRail::Client::Milestones
24
+ include TestRail::Client::Plans
25
+ include TestRail::Client::Priorities
26
+ include TestRail::Client::Projects
27
+ include TestRail::Client::ResultFields
28
+ include TestRail::Client::Results
29
+ include TestRail::Client::Runs
30
+ include TestRail::Client::Sections
31
+ include TestRail::Client::Statuses
32
+ include TestRail::Client::Suites
33
+ include TestRail::Client::Tests
34
+ include TestRail::Client::Users
35
+ end
36
+ end
37
+ end
@@ -1,17 +1,17 @@
1
1
  module TestRail
2
2
  class Client
3
3
  # Methods for the Case Fields API
4
+ #
4
5
  # Use the following API methods to request details about custom fields for test cases.
5
-
6
6
  # @see http://docs.gurock.com/testrail-api2/reference-cases-fields
7
-
8
- #
9
- # Returns a list of available test case custom fields.
10
- #
11
- # @return [Array<Hash>] a list of available test case custom fields
12
- #
13
- def case_fields
14
- get('get_case_fields')
7
+ module CaseFields
8
+ # List all available test case custom fields
9
+ #
10
+ # @return [Array<Hash>] a list of available test case custom fields
11
+ # @see http://docs.gurock.com/testrail-api2/reference-cases-fields#get_case_fields
12
+ def case_fields
13
+ get('get_case_fields')
14
+ end
15
15
  end
16
16
  end
17
17
  end
@@ -2,9 +2,17 @@ module TestRail
2
2
  class Client
3
3
  # Methods for the Case Types API
4
4
  #
5
+ # Use the following API methods to request details about custom types for test cases.
5
6
  # @see http://docs.gurock.com/testrail-api2/reference-cases-types
6
- def case_types
7
- get('get_case_types')
7
+ module CaseTypes
8
+ # List all available test case custom types
9
+ #
10
+ # @return [Array<Hash>] a list of available test case custom types
11
+ # @see http://docs.gurock.com/testrail-api2/reference-cases-types#get_case_types
12
+ def case_types
13
+ get('get_case_types')
14
+ end
8
15
  end
9
16
  end
10
17
  end
18
+
@@ -2,77 +2,105 @@ module TestRail
2
2
  class Client
3
3
  # Methods for the Cases API
4
4
  #
5
+ # Use the following API methods to request details about test cases and to create or modify test cases.
5
6
  # @see http://docs.gurock.com/testrail-api2/reference-cases
6
- #
7
- # Returns an existing test case
8
- #
9
- # @param [Integer, String] case_id The ID of the test case
10
- # @return an existing test case
11
- # @see http://docs.gurock.com/testrail-api2/reference-cases#get_case
12
- def case(case_id)
13
- get("get_case/#{case_id}")
14
- end
7
+ module Cases
8
+ # Returns an existing test case
9
+ #
10
+ # @param case_id [Integer, String] The ID of the test case
11
+ # @return [Hash] an existing test case
12
+ # @see http://docs.gurock.com/testrail-api2/reference-cases#get_case
13
+ def case(case_id)
14
+ get("get_case/#{case_id}")
15
+ end
15
16
 
16
- #
17
- # Returns a list of test cases for a test suite or specific section in a test suite.
18
- #
19
- # @param [Integer, String] project_id The ID of the project the test run should be added to
20
- # @param [Integer, String] suite_id The ID of the test suite (optional if the project is operating in single suite mode)
21
- # @param [Integer, String] section_id The ID of the section (optional)
22
- # @param filters [Hash]: A customizable set of filters
23
- # @option filters [Integer] :created_after Only return test cases created after this date (as UNIX timestamp).
24
- # @option filters [Integer] :created_before Only return test cases created before this date (as UNIX timestamp).
25
- # @option filters [Array<Integer>] :created_by A comma-separated list of creators (user IDs) to filter by.
26
- # @option filters [Array<Integer>] :milestone_id A comma-separated list of milestone IDs to filter by (not available if the milestone field is disabled for the project).
27
- # @option filters [Array<Integer>] :priority_id A comma-separated list of priority IDs to filter by.
28
- # @option filters [Array<Integer>] :type_id A comma-separated list of case type IDs to filter by.
29
- # @option filters [Integer] :updated_after Only return test cases updated after this date (as UNIX timestamp).
30
- # @option filters [Integer] :updated_before Only return test cases updated before this date (as UNIX timestamp).
31
- # @option filters [Array<Integer>] :updated_by A comma-separated list of users who updated test cases to filter by.
32
- # @return a list of test cases for a test suite or specific section in a test suite. The response includes an array of test cases. Each test case in this list follows the same format as TestRail#Client#get_case
33
- # @see http://docs.gurock.com/testrail-api2/reference-cases#get_cases
34
- def cases(project_id, suite_id, section_id = '', filters = {})
35
- get("get_cases/#{project_id}&suite_id=#{suite_id}&section_id=#{section_id}", filters)
36
- end
17
+ #
18
+ # Returns a list of test cases for a test suite or specific section in a test suite.
19
+ #
20
+ # @param project_id [Integer, String] The ID of the project the test run should be added to
21
+ # @param suite_id [Integer, String] The ID of the test suite (optional if the project is operating in single suite mode)
22
+ # @param filters [Hash] A customizable set of filters
23
+ # @option filters [Integer, String] :section_id The ID of the section
24
+ # @option filters [Integer, String] :created_after Only return test cases created after this date (as UNIX timestamp).
25
+ # @option filters [Integer, String] :created_before Only return test cases created before this date (as UNIX timestamp).
26
+ # @option filters [Array<Integer>] :created_by A comma-separated list of creators (user IDs) to filter by.
27
+ # @option filters [Array<Integer>] :milestone_id A comma-separated list of milestone IDs to filter by (not available if the milestone field is disabled for the project).
28
+ # @option filters [Array<Integer>] :priority_id A comma-separated list of priority IDs to filter by.
29
+ # @option filters [Array<Integer>] :type_id A comma-separated list of case type IDs to filter by.
30
+ # @option filters [Integer, String] :updated_after Only return test cases updated after this date (as UNIX timestamp).
31
+ # @option filters [Integer, String] :updated_before Only return test cases updated before this date (as UNIX timestamp).
32
+ # @option filters [Array<Integer>] :updated_by A comma-separated list of users who updated test cases to filter by.
33
+ # @return a list of test cases for a test suite or specific section in a test suite.
34
+ # The response includes an array of test cases.
35
+ # Each test case in this list follows the same format as TestRail#Client#Cases#case
36
+ # @see http://docs.gurock.com/testrail-api2/reference-cases#get_cases
37
+ def cases(project_id, suite_id, filters = {})
38
+ get("get_cases/#{project_id}&suite_id=#{suite_id}",
39
+ params: {
40
+ section_id: filters[:section_id],
41
+ created_after: filters[:created_after],
42
+ created_before: filters[:created_before],
43
+ created_by: filters[:created_by].to_list,
44
+ milestone_id: filters[:milestone_id].to_list,
45
+ priority_id: filters[:priority_id].to_list,
46
+ type_id: filters[:type_id].to_list,
47
+ updated_after: filters[:updated_after],
48
+ updated_before: filters[:updated_before],
49
+ updated_by: filters[:updated_by].to_list
50
+ })
51
+ end
37
52
 
38
- #
39
- # Creates a new test case.
40
- #
41
- # @param [Integer, String] section_id The ID of the section the test case should be added to
42
- # @param payload [Hash]: A customizable payload
43
- # @option payload [String] :title The title of the test case (required)
44
- # @option payload [Integer] :type_id The ID of the case type
45
- # @option payload [Integer] :priority_id The ID of the case priority
46
- # @option payload [String] :estimate The estimate, e.g. "30s" or "1m 45s"
47
- # @option payload [Integer] :milestone_id The ID of the milestone to link to the test case
48
- # @option payload [String] :refs A comma-separated list of references/requirements
49
- # TODO: finish docs
50
- # @return
51
- # @see http://docs.gurock.com/testrail-api2/reference-cases#add_case
52
- def add_case(section_id, payload)
53
- post("get_case/#{section_id}", payload)
54
- end
53
+ #
54
+ # Creates a new test case.
55
+ #
56
+ # @param section_id [Integer, String] The ID of the section the test case should be added to
57
+ # @param filters [Hash] A customizable set of filters
58
+ # @option filters [String] :title The title of the test case (required)
59
+ # @option filters [Integer] :type_id The ID of the case type
60
+ # @option filters [Integer] :priority_id The ID of the case priority
61
+ # @option filters [String, Integer] :estimate The estimate, e.g. "30s" or "1m 45s"
62
+ # @option filters [Integer] :milestone_id The ID of the milestone to link to the test case
63
+ # @option filters [String] :refs A comma-separated list of references/requirements
64
+ # @return [Hash] created case
65
+ # TODO: finish custom fields
66
+ # @see http://docs.gurock.com/testrail-api2/reference-cases#add_case
67
+ def add_case(section_id, filters)
68
+ post("add_case/#{section_id}",
69
+ body: {
70
+ title: filters[:title],
71
+ type_id: filters[:type_id].to_list,
72
+ priority_id: filters[:priority_id].to_list,
73
+ estimate: filters[:estimate],
74
+ milestone_id: filters[:milestone_id],
75
+ refs: filters[:refs]
76
+ }.to_json)
77
+ end
55
78
 
56
- #
57
- # Returns an existing test case by its name.
58
- # :case_name The ID of the test case if number provided
59
- #
60
- def case_by_name(_case_name)
61
- # TODO: implement get_case_by_name
62
- end
79
+ # @return [Array] array of cases IDs using TestRail#Client#Case#cases method (parameters are the same)
80
+ def cases_ids(project_id, suite_id, filters = {})
81
+ cases(project_id, suite_id, filters).map { |x| x['id'] }
82
+ end
63
83
 
64
- # Custom method
65
- # TODO: finish docs
66
- def cases_ids(project_id, suite_id, section_id = '')
67
- cases(project_id, suite_id, section_id).map { |x| x['id'] }
68
- end
84
+ def cases_by_title(title, project_id, suite_id, filters = {})
85
+ cases(project_id, suite_id, filters).find { |test_case| test_case['title'] == title }
86
+ end
69
87
 
70
- def update_case(_case_id, _payload)
71
- # TODO: finish
72
- end
88
+ # Updates an existing test case (partial updates are supported, i.e. you can submit and update specific fields only).
89
+ # This method supports the same POST fields as TestRail#Client#Case#add_case (except section_id)
90
+ def update_case(case_id, body)
91
+ body[:type_id] = body[:type_id].to_list if body[:type_id]
92
+ body[:priority_id] = body[:priority_id].to_list if body[:type_id]
93
+ post("update_case/#{case_id}", body: body)
94
+ end
73
95
 
74
- def delete_case(_case_id)
75
- # TODO: finish
96
+ # Deletes an existing test case.
97
+ # Please note: Deleting a test case cannot be undone and also permanently deletes all test results in active test
98
+ # runs (i.e. test runs that haven't been closed (archived) yet).
99
+ #
100
+ # @param case_id [Integer, String] The ID of the test case
101
+ def delete_case(case_id)
102
+ post("delete_case/#{case_id}")
103
+ end
76
104
  end
77
105
  end
78
106
  end
@@ -3,6 +3,8 @@ module TestRail
3
3
  # Methods for the Milestones API
4
4
  #
5
5
  # @see http://docs.gurock.com/testrail-api2/reference-milestones
6
- # TODO: implement
6
+ module Milestones
7
+ # TODO: implement
8
+ end
7
9
  end
8
10
  end
@@ -3,6 +3,8 @@ module TestRail
3
3
  # Methods for the Plans API
4
4
  #
5
5
  # @see http://docs.gurock.com/testrail-api2/reference-plans
6
- # TODO: implement
6
+ module Plans
7
+ # TODO: implement
8
+ end
7
9
  end
8
10
  end
@@ -3,11 +3,13 @@ module TestRail
3
3
  # Methods for the Priorities API
4
4
  #
5
5
  # @see http://docs.gurock.com/testrail-api2/reference-priorities
6
- #
7
- # Returns a list of available priorities
8
- #
9
- def priorities
10
- get('get_priorities')
6
+ module Priorities
7
+ #
8
+ # Returns a list of available priorities
9
+ #
10
+ def priorities
11
+ get('get_priorities')
12
+ end
11
13
  end
12
14
  end
13
15
  end
@@ -3,32 +3,35 @@ module TestRail
3
3
  # Methods for the Projects API
4
4
  #
5
5
  # @see http://docs.gurock.com/testrail-api2/reference-projects
6
- #
7
- # Returns the list of available projects.
8
- #
9
- def projects
10
- get('get_projects')
11
- end
6
+ module Projects
7
+ #
8
+ # Returns the list of available projects.
9
+ #
10
+ def projects
11
+ get('get_projects')
12
+ end
12
13
 
13
- #
14
- # Returns an existing project by its ID.
15
- #
16
- # :project_id The ID of the project
17
- #
18
- def project(project_id)
19
- get("get_project/#{project_id}")
20
- end
14
+ # TODO: finish docs
15
+ def projects_ids
16
+ projects.map { |x| x['id'] }
17
+ end
21
18
 
22
- #
23
- # Returns an existing project by its name.
24
- #
25
- # :project_name The name of the project
26
- #
27
- def project_by_name(project_name, ignore_case = true)
28
- if ignore_case
19
+ #
20
+ # Returns an existing project by its ID.
21
+ #
22
+ # :project_id The ID of the project
23
+ #
24
+ def project(project_id)
25
+ get("get_project/#{project_id}")
26
+ end
27
+
28
+ #
29
+ # Returns an existing project by its name.
30
+ #
31
+ # :project_name The name of the project
32
+ #
33
+ def project_by_name(project_name)
29
34
  projects.find { |project| project['name'].casecmp(project_name) == 0 }
30
- else
31
- projects.find { |project| project['name'] == project_name }
32
35
  end
33
36
  end
34
37
  end
@@ -3,6 +3,8 @@ module TestRail
3
3
  # Methods for the Result Fields API
4
4
  #
5
5
  # @see http://docs.gurock.com/testrail-api2/reference-results-fields
6
- # TODO: implement
6
+ module ResultFields
7
+ # TODO: implement
8
+ end
7
9
  end
8
10
  end
@@ -5,104 +5,106 @@ module TestRail
5
5
  # Use the following API methods to request details about test results and to add new test results.
6
6
  #
7
7
  # @see http://docs.gurock.com/testrail-api2/reference-results
8
- #
9
- # Returns a list of test results for a test.
10
- #
11
- # @param [Integer, String] test_id The ID of the test
12
- # @return a list of test results for a test
13
- # @see http://docs.gurock.com/testrail-api2/reference-results#get_results
14
- def results(test_id)
15
- get("get_results/#{test_id}")
16
- end
8
+ module Results
9
+ #
10
+ # Returns a list of test results for a test.
11
+ #
12
+ # @param [Integer, String] test_id The ID of the test
13
+ # @return a list of test results for a test
14
+ # @see http://docs.gurock.com/testrail-api2/reference-results#get_results
15
+ def results(test_id)
16
+ get("get_results/#{test_id}")
17
+ end
17
18
 
18
- #
19
- # Returns a list of test results for a test run and case combination.
20
- # The difference to get_results is that this method expects a test run + test case instead of a test. In TestRail,
21
- # tests are part of a test run and the test cases are part of the related test suite.
22
- # So, when you create a new test run, TestRail creates a test for each test case found in the test suite of the run.
23
- # You can therefore think of a test as an “instance” of a test case which can have test results, comments and a test status.
24
- # Please also see TestRail's getting started guide for more details about the differences between test cases and tests.
25
- #
26
- # This method uses the same response format as get_results.
27
- #
28
- # :run_id The ID of the test run
29
- # :case_id The ID of the test case
30
- #
31
- def results_for_case(run_id, case_id)
32
- get("get_results_for_case/#{run_id}/#{case_id}")
33
- end
19
+ #
20
+ # Returns a list of test results for a test run and case combination.
21
+ # The difference to get_results is that this method expects a test run + test case instead of a test. In TestRail,
22
+ # tests are part of a test run and the test cases are part of the related test suite.
23
+ # So, when you create a new test run, TestRail creates a test for each test case found in the test suite of the run.
24
+ # You can therefore think of a test as an “instance” of a test case which can have test results, comments and a test status.
25
+ # Please also see TestRail's getting started guide for more details about the differences between test cases and tests.
26
+ #
27
+ # This method uses the same response format as get_results.
28
+ #
29
+ # :run_id The ID of the test run
30
+ # :case_id The ID of the test case
31
+ #
32
+ def results_for_case(run_id, case_id)
33
+ get("get_results_for_case/#{run_id}/#{case_id}")
34
+ end
34
35
 
35
- #
36
- # Returns a list of test results for a test run.
37
- #
38
- # :run_id The ID of the test run
39
- #
40
- def results_for_run(run_id)
41
- get("get_results_for_run/#{run_id}")
42
- end
36
+ #
37
+ # Returns a list of test results for a test run.
38
+ #
39
+ # :run_id The ID of the test run
40
+ #
41
+ def results_for_run(run_id)
42
+ get("get_results_for_run/#{run_id}")
43
+ end
43
44
 
44
- # TODO: add custom fields docs
45
- #
46
- # Adds a new test result, comment or assigns a test.
47
- # It's recommended to use #add_results instead if you plan to add results for multiple tests.
48
- #
49
- # @param [Integer, String] test_id The ID of the test the result should be added to
50
- # @param data [Hash]: Optional query data
51
- # @option data [Integer, String] :status_id The ID of the test status. The built-in system statuses have the
52
- # following IDs:
53
- # 1 Passed
54
- # 2 Blocked
55
- # 3 Untested (not allowed when adding a result)
56
- # 4 Retest
57
- # 5 Failed
58
- # You can get a full list of system and custom statuses via #TestRail#Client#Statuses#get_statuses.
59
- # @option data [String] :comment The comment / description for the test result
60
- # @option data [String] :version The version or build you tested against
61
- # @option data [String] :elapsed The time it took to execute the test, e.g. "30s" or "1m 45s"
62
- # @option data [Array<Integer>, Array<String>] :defects A comma-separated list of defects to link to the test result
63
- # @option data [Integer, String] :assignedto_id The ID of a user the test should be assigned to
64
- # @return the new test result using the same response format as get_results, but with a single result instead of a list of results.
65
- # @see http://docs.gurock.com/testrail-api2/reference-results#add_result
66
- def add_result(test_id, data)
67
- post("add_result/#{test_id}", data)
68
- end
45
+ # TODO: add custom fields docs
46
+ #
47
+ # Adds a new test result, comment or assigns a test.
48
+ # It's recommended to use #add_results instead if you plan to add results for multiple tests.
49
+ #
50
+ # @param [Integer, String] test_id The ID of the test the result should be added to
51
+ # @param data [Hash]: Optional query data
52
+ # @option data [Integer, String] :status_id The ID of the test status. The built-in system statuses have the
53
+ # following IDs:
54
+ # 1 Passed
55
+ # 2 Blocked
56
+ # 3 Untested (not allowed when adding a result)
57
+ # 4 Retest
58
+ # 5 Failed
59
+ # You can get a full list of system and custom statuses via #TestRail#Client#Statuses#get_statuses.
60
+ # @option data [String] :comment The comment / description for the test result
61
+ # @option data [String] :version The version or build you tested against
62
+ # @option data [String] :elapsed The time it took to execute the test, e.g. "30s" or "1m 45s"
63
+ # @option data [Array<Integer>, Array<String>] :defects A comma-separated list of defects to link to the test result
64
+ # @option data [Integer, String] :assignedto_id The ID of a user the test should be assigned to
65
+ # @return the new test result using the same response format as get_results, but with a single result instead of a list of results.
66
+ # @see http://docs.gurock.com/testrail-api2/reference-results#add_result
67
+ def add_result(test_id, data)
68
+ post("add_result/#{test_id}", data)
69
+ end
69
70
 
70
- #
71
- # Adds a new test result, comment or assigns a test (for a test run and case combination).
72
- # It's recommended to use add_results_for_cases instead if you plan to add results for multiple test cases.
73
- # The difference to add_result is that this method expects a test run + test case instead of a test.
74
- # In TestRail, tests are part of a test run and the test cases are part of the related test suite.
75
- # So, when you create a new test run, TestRail creates a test for each test case found in the test suite of the run.
76
- # You can therefore think of a test as an “instance” of a test case which can have test results, comments and a test status.
77
- # Please also see TestRail's getting started guide for more details about the differences between test cases and tests.
78
- #
79
- # This method supports the same POST fields as add_result.
80
- #
81
- # :run_id The ID of the test run
82
- # :case_id The ID of the test case
83
- #
84
- def add_result_for_case(run_id, case_id, data)
85
- post("add_result_for_case/#{run_id}/#{case_id}", data)
86
- end
71
+ #
72
+ # Adds a new test result, comment or assigns a test (for a test run and case combination).
73
+ # It's recommended to use add_results_for_cases instead if you plan to add results for multiple test cases.
74
+ # The difference to add_result is that this method expects a test run + test case instead of a test.
75
+ # In TestRail, tests are part of a test run and the test cases are part of the related test suite.
76
+ # So, when you create a new test run, TestRail creates a test for each test case found in the test suite of the run.
77
+ # You can therefore think of a test as an “instance” of a test case which can have test results, comments and a test status.
78
+ # Please also see TestRail's getting started guide for more details about the differences between test cases and tests.
79
+ #
80
+ # This method supports the same POST fields as add_result.
81
+ #
82
+ # :run_id The ID of the test run
83
+ # :case_id The ID of the test case
84
+ #
85
+ def add_result_for_case(run_id, case_id, data)
86
+ post("add_result_for_case/#{run_id}/#{case_id}", data)
87
+ end
87
88
 
88
- #
89
- # Adds a new test result, comment or assigns a test.
90
- # It's recommended to use add_results instead if you plan to add results for multiple tests.
91
- #
92
- # :run_id The ID of the test run
93
- #
94
- def add_results(run_id, data)
95
- post("add_results/#{run_id}", data)
96
- end
89
+ #
90
+ # Adds a new test result, comment or assigns a test.
91
+ # It's recommended to use add_results instead if you plan to add results for multiple tests.
92
+ #
93
+ # :run_id The ID of the test run
94
+ #
95
+ def add_results(run_id, data)
96
+ post("add_results/#{run_id}", data)
97
+ end
97
98
 
98
- #
99
- # Adds one or more new test results, comments or assigns one or more tests (using the case IDs).
100
- # Ideal for test automation to bulk-add multiple test results in one step.
101
- #
102
- # :run_id The ID of the test run the results should be added to
103
- #
104
- def add_results_for_cases(run_id, data)
105
- post("add_results_for_cases/#{run_id}", data)
99
+ #
100
+ # Adds one or more new test results, comments or assigns one or more tests (using the case IDs).
101
+ # Ideal for test automation to bulk-add multiple test results in one step.
102
+ #
103
+ # :run_id The ID of the test run the results should be added to
104
+ #
105
+ def add_results_for_cases(run_id, data)
106
+ post("add_results_for_cases/#{run_id}", data)
107
+ end
106
108
  end
107
109
  end
108
110
  end