testdroid-api-client 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5f83eb091cc4e654dc3fea2624367f7b0ed7b7d1
4
- data.tar.gz: 9b86550f09fc612e1cd13ddf4afcce83a439d667
3
+ metadata.gz: 032442944630e8efe8636bf520cddefeec30946a
4
+ data.tar.gz: 58fc17ad7d3c661a3e8d165e66aaff6cabe65906
5
5
  SHA512:
6
- metadata.gz: 713492843fc48e35ccd0147b2ee59dac1da42b0db1e49816902905ae32dcd85e1f1f7d0bc6bafe0505398e6c497f33012abfd4e0388c097ada8f139a3b34d72d
7
- data.tar.gz: da09bd8fb287ef7d25202f6c5bd8b4b7b8d3d91d22b5b4b2100ce09db00b37f817610245d34486cf5701e4945da70dfc96bc468bbd35d3e5deb67ea55f53411b
6
+ metadata.gz: f050beaeec123d9898b1ff5db6ab893947b385fbf4c537720c23b441c916ef9f35231a764f6ae3bc58b4e46e6ac1411a942ea579381a39e75fbb636e561740cf
7
+ data.tar.gz: afcd6cf4fb3dab79441fb536d2fd078f30cc1fd7f2d911243a9d14698a595c078648f0d08a19994fa9bd1c264c752a78a6795cffec7cc58961522f019a67c104
@@ -73,6 +73,11 @@ module TestdroidAPI
73
73
  @logger.error "Failed to post resource #{uri} #{e}"
74
74
  return nil
75
75
  end
76
+
77
+ if resp.body.nil? || resp.body.length == 0
78
+ return nil
79
+ end
80
+
76
81
  JSON.parse(resp.body)
77
82
  end
78
83
  def get(uri, params={})
@@ -71,7 +71,7 @@ module TestdroidAPI
71
71
  end
72
72
  def delete
73
73
  raise "Can't delete a resource without a REST Client" unless @client
74
- client.delete(@uri)
74
+ @client.delete(@uri)
75
75
  end
76
76
  end
77
77
  end
@@ -9,7 +9,6 @@ module TestdroidAPI
9
9
  end
10
10
  def release
11
11
  resp = @client.post("#{@uri}/release", params= {})
12
- DeviceSession.new("#{@uri}", @client, resp)
13
12
  end
14
13
  end
15
14
  end
@@ -7,5 +7,8 @@ module TestdroidAPI
7
7
  @uri, @client = uri, client
8
8
  sub_items :device_runs
9
9
  end
10
+ def abort()
11
+ resp = @client.post("#{@uri}/abort", params= {})
12
+ end
10
13
  end
11
14
  end
data/sample/sample.rb ADDED
@@ -0,0 +1,39 @@
1
+ require 'testdroid-api-client'
2
+
3
+ client = TestdroidAPI::Client.new('admin@localhost', 'admin')
4
+ #to use private cloud specify cloud url as:
5
+ #client = TestdroidAPI::Client.new('my@host.com', 'hostpass', 'https://customer.testdroid.com/cloud')
6
+ #oauth
7
+ user = client.authorize
8
+
9
+ # Create Android project
10
+ android_project = user.projects.create({:params => {:name => "Android robotium", :type => "ANDROID"}})
11
+
12
+ # Create iOS project
13
+ ios_project = user.projects.create({:params => {:name => "iOS project", :type => "IOS"}})
14
+
15
+ #Android applicaiton
16
+ android_project.files.uploadApplication("BitbarSampleApp.apk")
17
+
18
+ #instrumentation package
19
+ android_project.files.uploadTest("BitbarSampleAppTests.apk")
20
+
21
+
22
+ #Set custom runner and set mode for instrumentaiton test
23
+ android_project.config.update({:params => {'instrumentationRunner' => 'com.testrunners.MyRunner', :mode=> 'FULL_RUN'}})
24
+
25
+ #get all the Android devices
26
+ android_devices = client.devices.list.select {|device| device.os_type.casecmp("ANDROID") == 0 }
27
+
28
+ #get IDs of the android devices
29
+ id_list = android_devices.collect{|device| device.id }
30
+
31
+ run_parameters = {:params => {:name => 'Test run 1', "usedDeviceIds[]" => id_list.join(',') }}
32
+ #Run project using the parameters
33
+ android_project.run(run_parameters)
34
+
35
+ #wait until the whole test run is completed
36
+ sleep 20 until android_project.runs.list.first.state == "FINISHED"
37
+
38
+ #download junit xml from the all device runs
39
+ android_project.runs.list.first.device_runs.list({:params => {:limit => 0}}).each { |device_run| device_run.download_junit("#{device_run.id}_junit.xml") }
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "testdroid-api-client"
3
- s.version = "0.2.0"
3
+ s.version = "0.2.1"
4
4
 
5
5
 
6
6
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testdroid-api-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sakari Rautiainen
@@ -177,6 +177,7 @@ files:
177
177
  - pkg/testdroid-api-client-0.1.0.gem
178
178
  - pkg/testdroid-api-client-0.1.1.gem
179
179
  - pkg/testdroid-api-client-0.1.2.gem
180
+ - sample/sample.rb
180
181
  - spec/client_spec.rb
181
182
  - spec/device_groups_spec.rb
182
183
  - spec/device_runs_spec.rb