The testdroid-api gem is a client for the Testdroid Cloud API.
In your application's Gemfile, add gem 'testdroid-api'
. Then, execute the following command:
$ bundle
Alternatively, you can install it yourself:
$ gem install testdroid-api
The testdroid-api gem allows you to create, manage, and delete projects on testdroid Cloud. For each project, you can trigger a test run. You can get collective or device-specific test results.
require 'testdroid-api'
client = TestdroidApi::Client.new('user_email', 'password')
client.authenticate!
=> "api_token"
project = client.projects.first
# create new project
client.create_project('Name', 'Description')
=> <TestdroidApi::Client::Project @name=Name, @description=Description>
# list all projects
client.projects
=> [
<TestdroidApi::Client::Project>,
<TestdroidApi::Client::Project>
]
# find projects by name
client.projects('Name')
=> [ <TestdroidApi::Client::Project, @name=Name> ]
# delete project
project.delete!
# upload application
project.upload_app_file(absolute_path_to_application)
# upload instrumentation
project.upload_test_file(absolute_path_to_tests)
project = client.projects.first
run = project.test_runs.first
# list all test runs
project.test_runs
=> [
<TestdroidApi::Client::Project::TestRun> ,
<TestdroidApi::Client::Project::TestRun>
]
# create new test run
project.create_test_run
=> <TestdroidApi::Client::Project::TestRun>
# update test run state
run.update!
=> <TestdroidApi::Client::Project::TestRun>
# get test run's results as junit xml (zip)
File.open(path_to_file, 'w') { |file| file.write(run.junit_results_zip) }
# get test run's screenshots (zip)
File.open(path_to_file, 'w') { |file| file.write(run.screenshots_zip) }
# get test run's logs (zip)
File.open(path_to_file, 'w') { |file| file.write(run.logs_zip) }
# get test run results
run.results
=> NotImplemented
project = client.projects.first
run = project.test_runs.first
device_run = run.device_runs.first
# get device runs
run.device_runs
=> [
<TestdroidApi::Client::Project::TestRun::DeviceRun>,
<TestdroidApi::Client::Project::TestRun::DeviceRun>
]
# get device's results as junit xml
File.open(path_to_file, 'w') { |file| file.write(device_run.junit_results) }
# get device's logs
device_run.logs
# list device's screenshots
device_run.screenshots
=> [ { "id": 108144 }, { "id": 108145 } ]
# get a specific screenshot
File.open(path_to_file, 'w') { |file| file.write(device_run.screenshot(108144)) }
# get device run results
device_run.results
=> NotImplemented
- Fork it.
- Create a feature branch (
git checkout -b <my-feature-branch>
). - Commit your changes (
git commit -am 'Add new feature'
). - Run tests (
rspec
). - Push your changes to the feature branch (
git push origin <my-feature-branch>
). - Create a new pull request.
Thanks to Ursula Kallio for the documentation help.