Class: JsTestServer::Client::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/js_test_server/client/runner.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parameters) ⇒ Runner

Returns a new instance of Runner.



48
49
50
51
# File 'lib/js_test_server/client/runner.rb', line 48

def initialize(parameters)
  @parameters = parameters
  @flushed_console = ""
end

Instance Attribute Details

#current_statusObject (readonly)

Returns the value of attribute current_status.



46
47
48
# File 'lib/js_test_server/client/runner.rb', line 46

def current_status
  @current_status
end

#flushed_consoleObject (readonly)

Returns the value of attribute flushed_console.



46
47
48
# File 'lib/js_test_server/client/runner.rb', line 46

def flushed_console
  @flushed_console
end

#parametersObject (readonly)

Returns the value of attribute parameters.



46
47
48
# File 'lib/js_test_server/client/runner.rb', line 46

def parameters
  @parameters
end

#selenium_clientObject (readonly)

Returns the value of attribute selenium_client.



46
47
48
# File 'lib/js_test_server/client/runner.rb', line 46

def selenium_client
  @selenium_client
end

Class Method Details

.run(parameters = {}) ⇒ Object



5
6
7
# File 'lib/js_test_server/client/runner.rb', line 5

def run(parameters={})
  new(parameters).run
end

.run_argv(argv) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/js_test_server/client/runner.rb', line 9

def run_argv(argv)
  opts = Trollop.options(argv) do
    opt(
      :selenium_browser,
      "The Selenium browser (e.g. *firefox). See http://selenium-rc.openqa.org/",
      :type => String,
      :default => DEFAULT_SELENIUM_BROWSER
    )
    opt(
      :selenium_host,
      "The host name of the Selenium Server relative to where this file is executed",
      :type => String,
      :default => DEFAULT_SELENIUM_HOST
    )
    opt(
      :selenium_port,
      "The port of the Selenium Server relative to where this file is executed",
      :type => Integer,
      :default => DEFAULT_SELENIUM_PORT
    )
    opt(
      :spec_url,
      "The url of the js spec server, relative to the browsers running via the Selenium Server",
      :type => String,
      :default => DEFAULT_SPEC_URL
    )
    opt(
      :timeout,
      "The timeout limit of the test run",
      :type => Integer,
      :default => DEFAULT_TIMEOUT
    )
  end
  run opts
end

Instance Method Details

#runObject



53
54
55
56
57
58
59
# File 'lib/js_test_server/client/runner.rb', line 53

def run
  if parameters[:timeout]
     Timeout.timeout(parameters[:timeout]) {do_run}
  else
    do_run
  end
end