Module: TestingBot::SeleniumForTestUnit
- Included in:
- RailsTestCase
- Defined in:
- lib/testingbot/hooks.rb
Instance Attribute Summary collapse
-
#browser ⇒ Object
readonly
Returns the value of attribute browser.
-
#exception ⇒ Object
Returns the value of attribute exception.
Instance Method Summary collapse
- #handle_exception(e) ⇒ Object (also: #handle_exception_old)
- #run(*args, &blk) ⇒ Object
- #teardown ⇒ Object
Instance Attribute Details
#browser ⇒ Object (readonly)
Returns the value of attribute browser.
222 223 224 |
# File 'lib/testingbot/hooks.rb', line 222 def browser @browser end |
#exception ⇒ Object
Returns the value of attribute exception.
221 222 223 |
# File 'lib/testingbot/hooks.rb', line 221 def exception @exception end |
Instance Method Details
#handle_exception(e) ⇒ Object Also known as: handle_exception_old
259 260 261 262 |
# File 'lib/testingbot/hooks.rb', line 259 def handle_exception(e) @exception = e.to_s problem_occurred end |
#run(*args, &blk) ⇒ Object
224 225 226 227 228 229 230 231 232 233 234 235 236 |
# File 'lib/testingbot/hooks.rb', line 224 def run(*args, &blk) return if @method_name.to_s == "default_test" if TestingBot.get_config.desired_capabilities.instance_of?(Array) TestingBot.get_config.desired_capabilities.each do |browser| @browser = ::Selenium::Client::Driver.new(:browser => browser[:browserName], :url => TestingBot.get_config[:browserUrl]) @browser.start_new_browser_session(browser) super(*args, &blk) @browser.stop end else super(*args, &blk) end end |
#teardown ⇒ Object
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 |
# File 'lib/testingbot/hooks.rb', line 238 def teardown return super if @browser.nil? api = TestingBot::Api.new params = { "session_id" => @browser.session_id, "status_message" => @exception || "", "success" => passed? ? 1 : 0, "name" => self.to_s } begin data = api.update_test(@browser.session_id, params) rescue end if ENV['JENKINS_HOME'] && (TestingBot.get_config[:jenkins_output] == true) puts "TestingBotSessionID=" + @browser.session_id end super end |