# Gemfile
gem "testdroid-api-client"
> bundle install
require 'testdroid-api-client'
client = TestdroidAPI::Client.new('admin@localhost', 'admin')
@user = client.authorize
projects = @user.projects.list
project_id = 123
project123 = @user.projects.get(project_id)
#output project name
p "Project name #{project123.name}"
project = @user.projects.list({:filter => "s_name_eq_MyProject"})[0]
frameworks = @user.available_frameworks.list
framework = @user.available_frameworks.list({:filter => "s_osType_eq_ANDROID;s_name_like_%Instrumentation"})[0]
file_app = @user.files.upload(File.join(File.dirname(__FILE__), "BitbarSampleApp.apk"))
file_test = @user.files.upload(File.join(File.dirname(__FILE__), "BitbarSampleAppTest.apk"))
test_run = @user.runs.create("{\"osType\": \"ANDROID\", \"projectId\": #{project.id}, \"frameworkId\":#{framework_id},
\"deviceIds\": #{id_list}, \"files\": [{\"id\": #{file_app.id}, \"action\": \"INSTALL\" },
{\"id\": #{file_test.id}, \"action\": \"RUN_TEST\" }]}")
#See full list of params: https://docs.bitbar.com/testing/api/tests/index.html#details-about-the-configuration-fields
test_run.device_sessions.list({:limit => 0}).each { |ds| ds.download_all_files("YOUR_PATH") }
files = @user.files
files.list({:limit => 40,:filter => "s_direction_eq_INPUT"}).each {
|f| puts "File id: #{f.id} name: #{f.name}" }
See https://cloud.bitbar.com/cloud/swagger-ui.html for more details about API V2, make sure you are logged in.
- Install ruby
bundle install
- Run tests:
rspec
, removespec/fixtures/cassettes
if you want to execute real Http requests