Class: TestdroidApi::Client::Project
- Inherits:
-
Object
- Object
- TestdroidApi::Client::Project
- Defined in:
- lib/testdroid-api/client/project.rb,
lib/testdroid-api/client/project/test_run.rb,
lib/testdroid-api/client/project/test_run/device_run.rb
Defined Under Namespace
Classes: TestRun
Instance Attribute Summary collapse
-
#app_file ⇒ Object
readonly
Returns the value of attribute app_file.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#test_file ⇒ Object
readonly
Returns the value of attribute test_file.
Instance Method Summary collapse
- #config ⇒ Object
-
#create_test_run(device_group = 'all devices', instatest = false, screenshots = false) ⇒ TestdroidApi::Client::Project::TestRun
Start new test run.
-
#delete! ⇒ Object
Delete project.
-
#initialize(client, config) ⇒ Project
constructor
A new instance of Project.
-
#test_runs ⇒ Array<Project>
Returns project runs from project.
- #update_config(new_config) ⇒ Object
-
#upload_app_file(path) ⇒ Object
Upload application binary.
-
#upload_test_file(path) ⇒ Object
Upload test binary.
Constructor Details
#initialize(client, config) ⇒ Project
Returns a new instance of Project.
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/testdroid-api/client/project.rb', line 6 def initialize(client, config) @client = client @id = config['id'] @name = config['name'] @description = config['description'] #TODO: Add uploadTimeslate @app_file = config['appFile'] && config['appFile']['originalName'] #TODO: Add uploadTime @test_file = config['testFile'] && config['testFile']['originalName'] end |
Instance Attribute Details
#app_file ⇒ Object (readonly)
Returns the value of attribute app_file.
5 6 7 |
# File 'lib/testdroid-api/client/project.rb', line 5 def app_file @app_file end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
5 6 7 |
# File 'lib/testdroid-api/client/project.rb', line 5 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/testdroid-api/client/project.rb', line 5 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/testdroid-api/client/project.rb', line 5 def name @name end |
#test_file ⇒ Object (readonly)
Returns the value of attribute test_file.
5 6 7 |
# File 'lib/testdroid-api/client/project.rb', line 5 def test_file @test_file end |
Instance Method Details
#config ⇒ Object
89 90 91 |
# File 'lib/testdroid-api/client/project.rb', line 89 def config raise NotImplementedError end |
#create_test_run(device_group = 'all devices', instatest = false, screenshots = false) ⇒ TestdroidApi::Client::Project::TestRun
Start new test run
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/testdroid-api/client/project.rb', line 63 def create_test_run(device_group = 'all devices', instatest = false, screenshots = false) res_name = "project/run/#{id}" endpoint = "projects/#{id}/run" params = { :instatestMode => instatest, :autoScreenshots => screenshots, :usedClusterId => get_group_id(device_group) } test_run = @client.post_api_request(endpoint, params, res_name) TestdroidApi::Client::Project::TestRun.new(@client, self, test_run) end |
#delete! ⇒ Object
Delete project
50 51 52 53 54 55 |
# File 'lib/testdroid-api/client/project.rb', line 50 def delete! res_name = "project/#{id}" endpoint = "projects/#{id}/delete" @client.post_api_request(endpoint, nil, res_name) end |
#test_runs ⇒ Array<Project>
Returns project runs from project
78 79 80 81 82 83 84 85 86 87 |
# File 'lib/testdroid-api/client/project.rb', line 78 def test_runs res_name = "runs" endpoint = "projects/#{id}/runs" configs = @client.get_api_request(endpoint, res_name) configs.map{|config| TestdroidApi::Client::Project::TestRun.new(@client, self, config) } end |
#update_config(new_config) ⇒ Object
93 94 95 |
# File 'lib/testdroid-api/client/project.rb', line 93 def update_config(new_config) raise NotImplementedError end |
#upload_app_file(path) ⇒ Object
Upload application binary
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/testdroid-api/client/project.rb', line 21 def upload_app_file(path) endpoint = "projects/#{id}/apks/application" file = File.new(path) digest = mh5digest(file) params = { :file => file, :multipart => true } res_name = "upload#{id}application#{digest}" extra_headers = {'X-Testdroid-MD5' => digest} @client.post_api_request(endpoint, params, res_name, extra_headers ) end |
#upload_test_file(path) ⇒ Object
Upload test binary
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/testdroid-api/client/project.rb', line 36 def upload_test_file(path) endpoint = "projects/#{id}/apks/instrumentation" file = File.new(path) digest = mh5digest(file) params = { :file => file, :multipart => true } res_name = "upload#{id}instrumentation#{digest}" extra_headers = {'X-Testdroid-MD5' => digest} @client.post_api_request(endpoint, params, res_name, extra_headers ) end |