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

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, run, config) ⇒ DeviceRun

Returns a new instance of DeviceRun.



10
11
12
13
14
15
16
# File 'lib/testdroid-api/client/project/test_run/device_run.rb', line 10

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

  update(config)
end

Instance Attribute Details

#device_idObject (readonly)

Returns the value of attribute device_id.



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

def device_id
  @device_id
end

#fail_messageObject (readonly)

Returns the value of attribute fail_message.



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

def fail_message
  @fail_message
end

#finishedObject (readonly)

Returns the value of attribute finished.



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

def finished
  @finished
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#junit_urlObject (readonly)

Returns the value of attribute junit_url.



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

def junit_url
  @junit_url
end

#logs_urlObject (readonly)

Returns the value of attribute logs_url.



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

def logs_url
  @logs_url
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#screenshots_urlObject (readonly)

Returns the value of attribute screenshots_url.



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

def screenshots_url
  @screenshots_url
end

#stateObject (readonly)

Returns the value of attribute state.



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

def state
  @state
end

Instance Method Details

#finished?Boolean

Did test run finish

Returns:

  • (Boolean)


70
71
72
# File 'lib/testdroid-api/client/project/test_run/device_run.rb', line 70

def finished?
  finished
end

#junit_resultsObject

Get device run’s test results as JUnit XML



29
30
31
32
33
34
# File 'lib/testdroid-api/client/project/test_run/device_run.rb', line 29

def junit_results
  res_name = 'junit XML'
  endpoint = "projects/#{@project_id}/runs/#{@run_id}/device-runs/#{id}_junit.xml"

  @client.get_file(endpoint, res_name)
end

#logsObject

Get device run’s logs



37
38
39
40
41
42
# File 'lib/testdroid-api/client/project/test_run/device_run.rb', line 37

def logs
  res_name = 'log'
  endpoint = "projects/#{@project_id}/runs/#{@run_id}/device-runs/#{id}_log.txt"

  @client.get_file(endpoint, res_name)
end

#resultsObject

Raises:

  • (NotImplementedError)


74
75
76
# File 'lib/testdroid-api/client/project/test_run/device_run.rb', line 74

def results
  raise NotImplementedError
end

#screenshot(screenshot_id) ⇒ Object

Get device’s run screenshot.

Parameters:

  • screenshot_id (Integer)

    screenshot id



62
63
64
65
66
67
# File 'lib/testdroid-api/client/project/test_run/device_run.rb', line 62

def screenshot(screenshot_id)
  res_name = 'screenshot'
  endpoint = "projects/#{@project_id}/runs/#{@run_id}/device-runs/#{id}/screenshots/#{screenshot_id}"

  @client.get_file(endpoint, res_name)
end

#screenshotsObject

Returns screenshots’ ids for device run.



53
54
55
56
57
58
# File 'lib/testdroid-api/client/project/test_run/device_run.rb', line 53

def screenshots
  res_name = 'deviceRunScreenshots'
  endpoint = "projects/#{@project_id}/runs/#{@run_id}/device-runs/#{id}/screenshots"

  @client.get_api_request(endpoint, res_name)
end

#screenshots_zipObject

Get device run’s screenshots as a zip file.



45
46
47
48
49
50
# File 'lib/testdroid-api/client/project/test_run/device_run.rb', line 45

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

  @client.get_file(endpoint, res_name)
end

#update!Object

Updates device run information



19
20
21
22
23
24
25
26
# File 'lib/testdroid-api/client/project/test_run/device_run.rb', line 19

def update!
  res_name = 'deviceRun'
  endpoint = "projects/#{@project_id}/runs/#{@run_id}/device-runs/#{id}"

  config   = @client.get_api_request(endpoint, res_name)

  update(config)
end