Class: RokuBuilder::Tester

Inherits:
Util
  • Object
show all
Defined in:
lib/roku_builder/tester.rb

Overview

Method for running unit tests This is intended to be used with the brstest librbary but should work with other testing libraries

Instance Method Summary collapse

Methods inherited from Util

#initialize, #multipart_connection, options_parse, #simple_connection

Constructor Details

This class inherits a constructor from RokuBuilder::Util

Instance Method Details

#initObject

Initialize starting and ending regular expressions



11
12
13
14
# File 'lib/roku_builder/tester.rb', line 11

def init()
  @end_reg = /\*\*\*\*\* ENDING TESTS \*\*\*\*\*/
  @start_reg = /\*\*\*\*\* STARTING TESTS \*\*\*\*\*/
end

#run_tests(sideload_config:) ⇒ Object

Run tests and report results

Parameters:

  • sideload_config (Hash)

    The config for sideloading the app



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/roku_builder/tester.rb', line 18

def run_tests(sideload_config:)
  telnet_config ={
    'Host' => @roku_ip_address,
    'Port' => 8085
  }

  loader = Loader.new(**@device_config)
  connection = Net::Telnet.new(telnet_config)
  code, _build_version = loader.sideload(**sideload_config)

  if code = SUCCESS
    in_tests = false
    connection.waitfor(@end_reg) do |txt|
      in_tests = handle_text(txt: txt, in_tests: in_tests)
    end
    connection.puts("cont\n")
  end
end