Showing posts with label Watir Unit Tests Cygwin FireWatir GitHub. Show all posts
Showing posts with label Watir Unit Tests Cygwin FireWatir GitHub. Show all posts

Friday, February 27, 2009

Chapter 30: Watir Unit Testing based on GitHub

Fix window_tests.rb problems

  1. $ ruby attach_to_existing_window_test.rb (clean)
    Loaded suite attach_to_existing_window_test
    Started....
    Finished in 4.646 seconds.
    4 tests, 9 assertions, 0 failures, 0 errors
    attach_to_existing_window_test.rb
  2. $ ruby attach_to_new_window_test.rb (clean)
    Loaded suite attach_to_new_window_test
    Started.......
    Finished in 23.268 seconds.
    7 tests, 7 assertions, 0 failures, 0 errors
  3. $ ruby close_window_test.rb (clean)
    Loaded suite close_window_test
    Started.
    Finished in 1.621 seconds.
    1 tests, 2 assertions, 0 failures, 0 errors
  4. $ ruby frame_links_test (clean)
    Loaded suite frame_links_test
    Started..
    Finished in 5.093 seconds.
    2 tests, 2 assertions, 0 failures, 0 errors
  5. $ ruby new_test (clean0
    Loaded suite new_test
    Started ....
    Finished in 10.593 seconds.
    4 tests, 5 assertions, 0 failures, 0 errors
  6. $ ruby send_keys_test (clean)
    Loaded suite send_keys_test
    Started F.
    Finished in 2.501 seconds.
    1) Failure:
    test_enter(TC_SendKeys) [send_keys_test.rb:24]:
    is not true.
    2 tests, 2 assertions, 1 failures, 0 errors
  7. =======================================================
  8. $ ruby open_close_test.rb (Ran clean under Cygwin, but not under GitBash)
    Loaded suite open_close_test
    Started ....................
    Finished in 98.194 seconds.
    20 tests, 0 assertions, 0 failures, 0 errors
  9. ie-each_test.rb (NOTE: FOUND THIS INSIDE FILE: # Not intended to be run as part of a larger suite.) Ran clean under Cygwin, but not under GitBash. $ ruby ie-e*
    Loaded suite ie-each_test
    Started ....
    Finished in 12.557 seconds.
    4 tests, 8 assertions, 0 failures, 0 errors
  10. =======================================================
  11. iedialog_test.rb (TWO FAILURES: $ ruby ied*
    Loaded suite iedialog_test
    Started FF
    Finished in 1.027 seconds.
    1) Failure: test_all(TC_IEDialog) [iedialog_test.rb:42]:
    is not true.
    2) Failure: test_find_window(TC_IEDialog) [iedialog_test.rb:26]:
    is not true.
    2 tests, 2 assertions, 2 failures, 0 errors
  12. js_events_test.rb (THREE FAILURES: $ ruby js*
    Loaded suite js_events_test
    Started ...E.EE
    Finished in 5.767 seconds.
    1) Error: test_clear_page_status(TC_JSEvents): Watir::Exception::NoStatusBarException:
    c:/Users/jasnow/gitlocalrepo/watir/watir/lib/watir/ie-class.rb:344:in `status'
    js_events_test.rb:53:in `test_clear_page_status'
    2) Error: test_page_nostatus(TC_JSEvents): Watir::Exception::NoStatusBarException:
    c:/Users/jasnow/gitlocalrepo/watir/watir/lib/watir/ie-class.rb:344:in `status'
    js_events_test.rb:43:in `test_page_nostatus'
    3) Error: test_set_page_status(TC_JSEvents): Watir::Exception::NoStatusBarException:
    c:/Users/jasnow/gitlocalrepo/watir/watir/lib/watir/ie-class.rb:344:in `status'
    js_events_test.rb:48:in `test_set_page_status'
    7 tests, 5 assertions, 0 failures, 3 errors
  13. modal_dialog_test.rb (FOUR ERRORS: $ ruby modal_dialog_test
    Loaded suite modal_dialog_test
    Started EE.E...E
    Finished in 58.452 seconds.
    1) Error: test_modal_simple_use_case(TC_ModalDialog):
    Watir::Exception::NoMatchingWindowFoundException: Modal Dialog with title Modal
    Dialog not found. Timeout = 10.0
    c:/Users/jasnow/gitlocalrepo/watir/watir/lib/watir/modal_dialog.rb:51:in `locate'
    c:/Users/jasnow/gitlocalrepo/watir/watir/lib/watir/modal_dialog.rb:86:in `initialize'
    c:/Users/jasnow/gitlocalrepo/watir/watir/lib/watir/container.rb:186:in `new'
    c:/Users/jasnow/gitlocalrepo/watir/watir/lib/watir/container.rb:186:in `modal_dialog'
    modal_dialog_test.rb:38:in `test_modal_simple_use_case'
    2) Error: test_wait_should_not_block(TC_ModalDialog):
    Watir::Exception::NoMatchingWindowFoundException: Modal Dialog with title Modal
    Dialog not found. Timeout = 10.0
    c:/Users/jasnow/gitlocalrepo/watir/watir/lib/watir/modal_dialog.rb:51:in `locate'
    c:/Users/jasnow/gitlocalrepo/watir/watir/lib/watir/modal_dialog.rb:86:in `initialize'
    c:/Users/jasnow/gitlocalrepo/watir/watir/lib/watir/container.rb:186:in `new'
    c:/Users/jasnow/gitlocalrepo/watir/watir/lib/watir/container.rb:186:in `modal_dialog'
    modal_dialog_test.rb:48:in `test_wait_should_not_block'
    3) Error: test_modal_dialog_use_case_title(TC_ModalDialog):
    Watir::Exception::NoMatchingWindowFoundException: Modal Dialog with title Modal Dialog not found. Timeout = 10.0
    c:/Users/jasnow/gitlocalrepo/watir/watir/lib/watir/modal_dialog.rb:51:in `locate'
    c:/Users/jasnow/gitlocalrepo/watir/watir/lib/watir/modal_dialog.rb:86:in `initialize'
    c:/Users/jasnow/gitlocalrepo/watir/watir/lib/watir/container.rb:186:in `new'
    c:/Users/jasnow/gitlocalrepo/watir/watir/lib/watir/container.rb:186:in `modal_dialog'
    modal_dialog_test.rb:80:in `test_modal_dialog_use_case_title'
    4) Error: test_modal_exists(TC_ModalDialog):
    Watir::Exception::NoMatchingWindowFoundException: Modal Dialog with title Modal Dialog not found. Timeout = 10.0
    c:/Users/jasnow/gitlocalrepo/watir/watir/lib/watir/modal_dialog.rb:51:in `locate'
    c:/Users/jasnow/gitlocalrepo/watir/watir/lib/watir/modal_dialog.rb:86:in `initialize'
    c:/Users/jasnow/gitlocalrepo/watir/watir/lib/watir/container.rb:186:in `new'
    c:/Users/jasnow/gitlocalrepo/watir/watir/lib/watir/container.rb:186:in `modal_dialog'
    modal_dialog_test.rb:122:in `test_modal_exists'
    8 tests, 8 assertions, 0 failures, 4 errors
  14. $ ruby open_close_test.rb
    ./../../lib/watir/ie-process.rb:1:in `require': no such file to load -- win32/process (LoadError)
    from ./../../lib/watir/ie-process.rb:1
    from ./../../lib/watir/ie.rb:45:in `require'
    from ./../../lib/watir/ie.rb:45
    from open_close_test.rb:6:in `require'
    from open_close_test.rb:6

Chapter 29: Watir Unit Testing based on GitHub

$core_tests = $all_tests - $non_core_tests - $window_tests - $xpath_tests
all_tests.rb problem (402, 437, 1, 315) references:
  1. Too many failures in all_tests.rb http://jira.openqa.org/browse/WTR-137

  2. watir all_tests.rb failures and errors wtih REXML and Win32OLERuntimeError
    http://groups.google.com/group/watir-general/browse_thread/thread/2189d94ae8e25cba?pli=1
  3. http://zeljkofilipin.com/2006/03/24/how-to-organize-watir-files/
  4. http://clearspace.openqa.org/thread/8807?pdf=true ("all_tests.rb are broken. You should be fine if core_tests.rb run fine.")
non_core_tests.rb problem (19, 1, 0 25) references:
  1. http://www.mail-archive.com/wtr-general@rubyforge.org/msg08569.html
window_tests.rb problem (57, 42, 3, 7) references:
  1. http://rubyforge.org/pipermail/wtr-general/2006-September/007405.html
other/all_tests_concurrent.rb (2/27/2009: Skipped for now)
  1. No references inside Google.

Chapter 28: Watir Unit Testing based on GitHub

Staring to try to run GitHub's Watir Unit Tests.
  1. Getting Watir (read-only copy) from GitHub. $ git clone git://github.com/bret/watir.git
    Initialized empty Git repository in c:/Users/jasnow/gitlocalrepo/watir/.git/
    remote: Counting objects: 14747, done.←[K
    remote: Compressing objects: 100% (4973/4973), done.←[K
    remote: Total 14747 (delta 9704), reused 14388 (delta 9445)←[K
    Receiving objects: 100% (14747/14747), 7.81 MiB | 146 KiB/s, done.
    Resolving deltas: 100% (9704/9704), done.
  2. Now to organize my task notebook.
  3. Trying to set it up so others can run the unit tests and report back to the community in a standard way: http://sites.google.com/site/watirunittestruns/Home/
  4. Read thru: http://wiki.openqa.org/display/WTR/Building+Watir
  5. Now reading http://wiki.openqa.org/display/WTR/Running+Unit+Tests+in+Development web page.
  6. Found I had user-choices (1.1.6).
  7. Question: Unclear if we still should have SVN reference.
  8. My target set of unit tests are core_tests.rb with "regression" flag in options.yml file.
  9. cd to watir/watir/unittests and did this and got this: $ ruby core_tests.rb 2>&1 |tee o_coretests_run0227a
    Loaded suite core_tests
    Started
    ................................................................................................................................................................
    ...............................................................................................................................
    Finished in 199.741 seconds.
    287 tests, 1411 assertions, 0 failures, 0 errors
  10. But no windows were shown. Looked inside core_tests.rb and $HIDE_IE = true so ok.
  11. Create options.yml file and reran step #9 and this time I show the windows with visible: true . $ ruby core_tests.rb 2>&1 |tee o_coretests_run0227b
    Loaded suite core_tests
    Started
    ................................................................................................................................................................
    ....................................................................................................................................
    Finished in 201.692 seconds.
    292 tests, 1417 assertions, 0 failures, 0 errors
  12. Then cd ../../firewatir/unittests and ruby mozilla_all_tests.rb 2>&1 |tee moz_all_tests_0227a and got 312 tests, 1660 assertions, 3 failures, 1 errors. Here is the pastie of the whole log file.
  13. See Chapter #13 of this blog for the answer (fix).
  14. Then repeat step 12 and got 312 tests, 1661 assertions, 0 failures, 0 errors. Here is the pastie of the whole log file.
  15. THEREFORE I CAN RUN WATIR and FIREWATIR cleanly. WOW.
  16. Okay, I tried step 14 with visible: false and everything worked. Here is the pastie of the whole log file.
  17. Then I did this and everything worked. $ ruby test_tests.rb 2>&1 |tee o_testtests_rb_feb27a
    Loaded suite test_tests
    Started
    ..............
    Finished in 10.82 seconds.
    14 tests, 109 assertions, 0 failures, 0 errors
  18. Ran "ruby xpath_tests.rb 2>&1 |tee o_xpathtests_rb_feb27a" and got "91 tests, 393 assertions, 0 failures, 0 errors". Here is the pastie of the whole log file.
  19. Dirty runs were window_tests.rb (57,42,3,7) and non_core_tests.rb (19,1,0,25).

Chapter 27: Previous Watir Unit Testing

Chapter 27: Get Watir Unit Tests from GitHub