Class: TestdroidApi::Client::Project::TestRun

Inherits:
Object
  • Object
show all
Defined in:
lib/testdroid-api/client/project/test_run.rb,
lib/testdroid-api/client/project/test_run/device_run.rb

Defined Under Namespace

Classes: DeviceRun

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, project, config) ⇒ TestRun

Returns a new instance of TestRun.



7
8
9
10
11
12
# File 'lib/testdroid-api/client/project/test_run.rb', line 7

def initialize(client, project, config)
  @client     = client
  @project_id = project.id

  update(config)
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/testdroid-api/client/project/test_run.rb', line 6

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/testdroid-api/client/project/test_run.rb', line 6

def name
  @name
end

#project_idObject (readonly)

Returns the value of attribute project_id.



6
7
8
# File 'lib/testdroid-api/client/project/test_run.rb', line 6

def project_id
  @project_id
end

#stateObject (readonly)

Returns the value of attribute state.



6
7
8
# File 'lib/testdroid-api/client/project/test_run.rb', line 6

def state
  @state
end

Instance Method Details

#device_runsArray<TestdroidApi::Client::TestRun::DeviceRun>

Returns devices that the run was executed on.

Returns:

  • (Array<TestdroidApi::Client::TestRun::DeviceRun>)


30
31
32
33
34
35
36
37
38
# File 'lib/testdroid-api/client/project/test_run.rb', line 30

def device_runs
  res_name = "deviceRuns"
  endpoint = "projects/#{@project_id}/runs/#{id}/device-runs"

  results  = @client.get_api_request(endpoint, res_name)
  results.map{|device_run|
    TestdroidApi::Client::Project::TestRun::DeviceRun.new(@client, self, device_run)
  }
end

#finished?Boolean

Did test run finish

Returns:

  • (Boolean)


66
67
68
# File 'lib/testdroid-api/client/project/test_run.rb', line 66

def finished?
  state == 'FINISHED'
end

#junit_results_zipObject

Get test run’s junit results as a zip file



49
50
51
52
53
54
# File 'lib/testdroid-api/client/project/test_run.rb', line 49

def junit_results_zip
  res_name = 'junits.zip'
  endpoint = "projects/#{@project_id}/runs/#{id}/junits.zip"

  @client.get_file(endpoint, res_name)
end

#logs_zipObject

Get test run’s logs as a zip file.



57
58
59
60
61
62
# File 'lib/testdroid-api/client/project/test_run.rb', line 57

def logs_zip
  res_name = 'logs.zip'
  endpoint = "projects/#{@project_id}/runs/#{id}/logs.zip"

  @client.get_file(endpoint, res_name)
end

#resultsObject

Raises:

  • (NotImplementedError)


24
25
26
# File 'lib/testdroid-api/client/project/test_run.rb', line 24

def results
  raise NotImplementedError
end

#screenshots_zipObject

Get test run’s screenshots as a zip file.



41
42
43
44
45
46
# File 'lib/testdroid-api/client/project/test_run.rb', line 41

def screenshots_zip
  res_name = 'screenshots.zip'
  endpoint = "projects/#{@project_id}/runs/#{id}/screenshots.zip"

  @client.get_file(endpoint, res_name)
end

#update!Object

Updates test_run information



15
16
17
18
19
20
21
22
# File 'lib/testdroid-api/client/project/test_run.rb', line 15

def update!
  res_name = "run"
  endpoint = "projects/#{@project_id}/runs/#{id}"

  config   = @client.get_api_request(endpoint, res_name)

  update(config)
end