No description, website, or topics provided.
Ruby
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
pkg
sample
spec
.gitignore
Gemfile
Gemfile.lock
LICENSE
README.md
testdroid-api-client.gemspec

README.md

Testdroid API Client for Ruby

Installation

# Gemfile
gem "testdroid-api-client"
> bundle install

Sample client usage - Authenticate

require 'testdroid-api-client'

client = TestdroidAPI::Client.new('admin@localhost', 'admin')

Sample usage - get projects

 @user = client.authorize
 projects = @user.projects.list

Get project by id

project_id = 123
project123 = @user.projects.get(project_id)
#output project name
p "Project name #{project123.name}"

Get project by name

android_project = @user.projects.list.detect {|project| project.name.casecmp("Android Project") == 0 }

Start project

test_run = project123.run

Check test run status

p "Project state #{test_run.state}"

Download all logs from test run

test_run.device_runs.list({:params => {:limit => 100}}).each { |drun| drun.download_logs("#{drun.id}_log") }

Using device labels

#Get label for android os version 2.1
lg_android_version_2_1 = client.label_groups.list.detect {|lg| lg.display_name.casecmp("android version") == 0 }

os_v2_1 =  client.label_groups.get(lg_android_versions.id).labels.list.detect {|l| l.display_name.casecmp("2.1") == 0 }
        
 #get all devices with android os level 2.1
 devices = client.label_groups.get(lg_android_versions.id).labels.get(os_v2_1.id).devices
#get spefici device from devices list        
lenovo_a820 = devices.list.detect {|d| d.display_name == "Lenovo A820"}
       

Device Sessions

#create a new device session: 
device_session = @user.device_sessions.create({:params =>  {'deviceModelId' => '1'}})

#release device session: 
device_session.release()

Project configuration

#get project and update project configuration
android_project = @user.projects.list.detect {|project| project.name.casecmp("Android Project") == 0 }
android_project.config.update({:params => {'instrumentationRunner' => 'abc'}})
#See full list of params: http://docs.testdroid.com/_pages/client.html#update-project-config

See https://cloud.testdroid.com/swagger/index.html for more details about API V2