Friday, February 27, 2009

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).

No comments:

Post a Comment