Class: Seleniumrc::SeleniumTestCase
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- Seleniumrc::SeleniumTestCase
- Extended by:
- ClassMethods
- Includes:
- SeleniumDsl
- Defined in:
- lib/seleniumrc/selenium_test_case.rb
Overview
The Test Case class that runs your Selenium tests. You are able to use all methods provided by Selenium::SeleneseInterpreter with some additions.
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary
Attributes included from ClassMethods
#use_instantiated_fixtures, #use_transactional_fixtures
Attributes included from SeleniumDsl
#configuration, #selenium_driver
Attributes included from WaitFor
Instance Method Summary collapse
Methods included from ClassMethods
all_descendant_classes, all_subclasses_as_suite, extract_subclasses, inherited, subclasses
Methods included from SeleniumDsl
#download, #method_missing, #open_home_page
Methods included from TestUnitDsl
#assert_attribute, #assert_checked, #assert_element_contains, #assert_element_does_not_contain_text, #assert_element_not_present, #assert_element_present, #assert_location_ends_in, #assert_next_sibling, #assert_not_checked, #assert_not_visible, #assert_selected, #assert_text, #assert_text_in_order, #assert_text_not_present, #assert_text_present, #assert_title, #assert_value, #assert_visible
Methods included from WaitFor
#default_wait_for_time, #flunk, #time_class, #wait_for
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Seleniumrc::SeleniumDsl
Instance Method Details
#run(result, &block) ⇒ Object
86 87 88 89 |
# File 'lib/seleniumrc/selenium_test_case.rb', line 86 def run(result, &block) return if @method_name.nil? || @method_name.to_sym == :default_test super end |
#selenium_test_case ⇒ Object
82 83 84 |
# File 'lib/seleniumrc/selenium_test_case.rb', line 82 def selenium_test_case @selenium_test_case ||= SeleniumTestCase end |
#setup ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/seleniumrc/selenium_test_case.rb', line 50 def setup # set "setup_once" to true # to prevent fixtures from being re-loaded and data deleted from the DB. # this is handy if you want to generate a DB full of sample data # from the tests. Make sure none of your selenium tests manually # reset data! #TODO: make this configurable setup_once = false raise "Cannot use transactional fixtures if ActiveRecord concurrency is turned on (which is required for Selenium tests to work)." if self.class.use_transactional_fixtures unless setup_once ActiveRecord::Base.connection.update('SET FOREIGN_KEY_CHECKS = 0') super ActiveRecord::Base.connection.update('SET FOREIGN_KEY_CHECKS = 1') else unless InstanceMethods.const_defined?("ALREADY_SETUP_ONCE") super InstanceMethods.const_set("ALREADY_SETUP_ONCE", true) end end @selenium_driver = configuration.driver end |
#teardown ⇒ Object
73 74 75 76 77 78 79 80 |
# File 'lib/seleniumrc/selenium_test_case.rb', line 73 def teardown selenium_driver.stop if should_stop_driver? super if @beginning duration = (time_class.now - @beginning).to_f puts "#{duration} seconds" end end |