Sha256: 254fb7a866e71e79d40bd169ac70b529934b15c13cf399aebcca8ee997f4faf3

Contents?: true

Size: 1.52 KB

Versions: 3

Compression:

Stored size: 1.52 KB

Contents

require 'testdroid-api-client'

client = TestdroidAPI::Client.new('admin@localhost', 'admin')
#to use private cloud specify cloud url as:
#client = TestdroidAPI::Client.new('my@host.com', 'hostpass', 'https://customer.testdroid.com/cloud')
#oauth
user = client.authorize

# Create Android project
android_project = user.projects.create({:params => {:name => "Android robotium", :type => "ANDROID"}})

# Create iOS project
ios_project = user.projects.create({:params => {:name => "iOS project", :type => "IOS"}})

#Android applicaiton
android_project.files.uploadApplication("BitbarSampleApp.apk")

#instrumentation package
android_project.files.uploadTest("BitbarSampleAppTests.apk")


#Set custom runner and set mode for instrumentaiton test
android_project.config.update({:params => {'instrumentationRunner' => 'com.testrunners.MyRunner', :mode=> 'FULL_RUN'}})

#get all the Android devices
android_devices = client.devices.list.select {|device| device.os_type.casecmp("ANDROID") == 0 }

#get IDs of the android devices
id_list = android_devices.collect{|device| device.id } 

run_parameters = {:params => {:name => 'Test run 1', "usedDeviceIds[]" => id_list.join(',') }}
#Run project using the parameters
android_project.run(run_parameters)

#wait until the whole test run is completed
sleep 20 until android_project.runs.list.first.state == "FINISHED"

#download junit xml from the all device runs
android_project.runs.list.first.device_runs.list({:params => {:limit => 0}}).each { |device_run| device_run.download_junit("#{device_run.id}_junit.xml") }

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
testdroid-api-client-0.2.3 sample/sample.rb
testdroid-api-client-0.2.2 sample/sample.rb
testdroid-api-client-0.2.1 sample/sample.rb