Skip to content

Commit

Permalink
Merge pull request #46 from QuantumGeordie/add_tests_requests
Browse files Browse the repository at this point in the history
Add .tests() to retrieve test occurrences from a build.
  • Loading branch information
jperry committed Jun 5, 2015
2 parents 509d5c7 + 01032e2 commit d12ae90
Show file tree
Hide file tree
Showing 9 changed files with 389 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/teamcity/client.rb
Expand Up @@ -11,5 +11,6 @@ class Client < API
include TeamCity::Client::Builds
include TeamCity::Client::Common
include TeamCity::Client::VCSRoots
include TeamCity::Client::Tests
end
end
24 changes: 24 additions & 0 deletions lib/teamcity/client/tests.rb
@@ -0,0 +1,24 @@
module TeamCity
class Client
# Defines methods related to tests
module Tests
# HTTP GET

# List of tests
#
# @param options [Hash] list of test locators to filter test results on
# @return [Array<Hashie::Mash>] of tests (empty array if no tests exist)
def tests(options={})
url_params = options.empty? ? '' : "?locator=#{locator(options)}"
tests = []
begin
response = get("testOccurrences#{url_params}")
tests = response.testOccurrence
rescue
tests = []
end
tests
end
end
end
end

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 60 additions & 0 deletions spec/cassettes/Tests/GET/_tests/should_fetch_all_the_tests.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d12ae90

Please sign in to comment.