view · edit · sidebar · attach · print · history

20110210-testcases-oddb_org

<< | Index | >>


  1. Update test_view
  2. Resolve interdependency of test-cases

Goal/Estimate
  • All tests pass oddb.org / 90%
Milestones
  1. Update test_view 8:00
  2. Resolve mutualdependency
Summary
Commits
ToDo Tomorrow
Keep in Mind
  1. On Ice

Update test_view

The current status

masa@masa ~/ywesee/oddb.org/test/test_view $ ruby suite.rb 
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/sourcecode_dumpable.rb:73: warning: redefining constant Struct::MethodNamed
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/sourcecode_dumpable.rb:73: warning: already initialized constant MethodNamed
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/sourcecode_dumpable.rb:74: warning: redefining constant Struct::ModuleMethodNamed
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/sourcecode_dumpable.rb:74: warning: already initialized constant ModuleMethodNamed
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/glr_parser.rb:275: warning: redefining constant Struct::Link
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/glr_parser.rb:275: warning: already initialized constant Link
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/conflict_resolution.rb:18: warning: redefining constant Struct::Relation
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/conflict_resolution.rb:18: warning: already initialized constant Relation
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/grammar.rb:591: warning: already initialized constant EpsilonToken
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/graphviz_dot.rb:52: warning: redefining constant Struct::DotGraph
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/graphviz_dot.rb:52: warning: already initialized constant DotGraph
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/directed_graph.rb:16: warning: redefining constant Struct::GraphLink
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/directed_graph.rb:16: warning: already initialized constant GraphLink
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/reduce_actions_generator.rb:273: warning: redefining constant Struct::LaLrPair
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/reduce_actions_generator.rb:273: warning: already initialized constant LaLrPair
[DEPRECATED] By requiring 'spreadsheet/excel' you are loading a Compatibility
             layer which provides a drop-in replacement for Spreadsheet::Excel
             versions <= 0.3.5.1. This code will be removed in Spreadsheet
             version 1.0.0

/home/masa/ywesee/oddb.org/src/view/changelog.rb:26: warning: already initialized constant SORT_DEFAULT
/home/masa/ywesee/oddb.org/src/view/drugs/resultlist.rb:21: warning: already initialized constant BACKGROUND_SUFFIX
loading testenvironment
disabling UPDATER
/home/masa/ywesee/oddb.org/src/testenvironment.rb:12: warning: already initialized constant MAIL_TO
/home/masa/ywesee/oddb.org/src/testenvironment.rb:17: warning: already initialized constant PAYPAL_SERVER
/home/masa/ywesee/oddb.org/src/testenvironment.rb:18: warning: already initialized constant PAYPAL_RECEIVER
/home/masa/ywesee/oddb.org/src/testenvironment.rb:19: warning: already initialized constant SMTP_SERVER
/home/masa/ywesee/oddb.org/test/stub/oddbapp.rb:22: warning: already initialized constant ODDB_VERSION
Loaded suite suite
Started
................F......
Finished in 0.082614 seconds.

  1) Failure:
test_http_headers(ODDB::View::TestSearch)
    [/usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:306:in `fetch_named'
     /usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:330:in `call'
     /usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:330:in `fetch_or_do'
     /usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:304:in `fetch_named'
     /home/masa/ywesee/oddb.org/src/util/oddbapp.rb:1277:in `initialize'
     ./search.rb:34:in `new'
     ./search.rb:34:in `setup']:
wrong method called on #<Mock:0x7f1f8f977dd0>; expected next_id, was restore_named

23 tests, 39 assertions, 1 failures, 0 errors

Note

  • One failure

Check (test search.rb)

masa@masa ~/ywesee/oddb.org/test/test_view $ ruby search.rb 
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/sourcecode_dumpable.rb:73: warning: redefining constant Struct::MethodNamed
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/sourcecode_dumpable.rb:73: warning: already initialized constant MethodNamed
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/sourcecode_dumpable.rb:74: warning: redefining constant Struct::ModuleMethodNamed
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/sourcecode_dumpable.rb:74: warning: already initialized constant ModuleMethodNamed
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/glr_parser.rb:275: warning: redefining constant Struct::Link
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/glr_parser.rb:275: warning: already initialized constant Link
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/conflict_resolution.rb:18: warning: redefining constant Struct::Relation
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/conflict_resolution.rb:18: warning: already initialized constant Relation
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/grammar.rb:591: warning: already initialized constant EpsilonToken
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/graphviz_dot.rb:52: warning: redefining constant Struct::DotGraph
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/graphviz_dot.rb:52: warning: already initialized constant DotGraph
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/directed_graph.rb:16: warning: redefining constant Struct::GraphLink
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/directed_graph.rb:16: warning: already initialized constant GraphLink
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/reduce_actions_generator.rb:273: warning: redefining constant Struct::LaLrPair
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/reduce_actions_generator.rb:273: warning: already initialized constant LaLrPair
[DEPRECATED] By requiring 'spreadsheet/excel' you are loading a Compatibility
             layer which provides a drop-in replacement for Spreadsheet::Excel
             versions <= 0.3.5.1. This code will be removed in Spreadsheet
             version 1.0.0

/home/masa/ywesee/oddb.org/src/view/changelog.rb:26: warning: already initialized constant SORT_DEFAULT
/home/masa/ywesee/oddb.org/src/view/drugs/resultlist.rb:21: warning: already initialized constant BACKGROUND_SUFFIX
loading testenvironment
disabling UPDATER
/home/masa/ywesee/oddb.org/src/testenvironment.rb:12: warning: already initialized constant MAIL_TO
/home/masa/ywesee/oddb.org/src/testenvironment.rb:17: warning: already initialized constant PAYPAL_SERVER
/home/masa/ywesee/oddb.org/src/testenvironment.rb:18: warning: already initialized constant PAYPAL_RECEIVER
/home/masa/ywesee/oddb.org/src/testenvironment.rb:19: warning: already initialized constant SMTP_SERVER
Loaded suite search
Started
init system
init system: 0.000805
setup drb-delegation
reset
reset: 0.012803
system initialized
initialized: 0.012918
.
Finished in 0.029718 seconds.

1 tests, 2 assertions, 0 failures, 0 errors

Note

  • Namely, the interdependency of test-cases

Experiment

masa@masa ~/ywesee/oddb.org/test/test_view $ git mv search.rb asearch.rb
masa@masa ~/ywesee/oddb.org/test/test_view $ ruby suite.rb 
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/sourcecode_dumpable.rb:73: warning: redefining constant Struct::MethodNamed
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/sourcecode_dumpable.rb:73: warning: already initialized constant MethodNamed
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/sourcecode_dumpable.rb:74: warning: redefining constant Struct::ModuleMethodNamed
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/sourcecode_dumpable.rb:74: warning: already initialized constant ModuleMethodNamed
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/glr_parser.rb:275: warning: redefining constant Struct::Link
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/glr_parser.rb:275: warning: already initialized constant Link
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/conflict_resolution.rb:18: warning: redefining constant Struct::Relation
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/conflict_resolution.rb:18: warning: already initialized constant Relation
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/grammar.rb:591: warning: already initialized constant EpsilonToken
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/graphviz_dot.rb:52: warning: redefining constant Struct::DotGraph
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/graphviz_dot.rb:52: warning: already initialized constant DotGraph
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/directed_graph.rb:16: warning: redefining constant Struct::GraphLink
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/directed_graph.rb:16: warning: already initialized constant GraphLink
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/reduce_actions_generator.rb:273: warning: redefining constant Struct::LaLrPair
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/reduce_actions_generator.rb:273: warning: already initialized constant LaLrPair
[DEPRECATED] By requiring 'spreadsheet/excel' you are loading a Compatibility
             layer which provides a drop-in replacement for Spreadsheet::Excel
             versions <= 0.3.5.1. This code will be removed in Spreadsheet
             version 1.0.0

/home/masa/ywesee/oddb.org/src/view/changelog.rb:26: warning: already initialized constant SORT_DEFAULT
/home/masa/ywesee/oddb.org/src/view/drugs/resultlist.rb:21: warning: already initialized constant BACKGROUND_SUFFIX
loading testenvironment
disabling UPDATER
/home/masa/ywesee/oddb.org/src/testenvironment.rb:12: warning: already initialized constant MAIL_TO
/home/masa/ywesee/oddb.org/src/testenvironment.rb:17: warning: already initialized constant PAYPAL_SERVER
/home/masa/ywesee/oddb.org/src/testenvironment.rb:18: warning: already initialized constant PAYPAL_RECEIVER
/home/masa/ywesee/oddb.org/src/testenvironment.rb:19: warning: already initialized constant SMTP_SERVER
./navigationfoot.rb:15: warning: already initialized constant ODDB_VERSION
Loaded suite suite
Started
................init system
init system: 0.000839
setup drb-delegation
reset
reset: 0.06681
system initialized
initialized: 0.078703
.......
Finished in 0.17759 seconds.

23 tests, 41 assertions, 0 failures, 0 errors

Commit

Total check

masa@masa ~/ywesee/oddb.org $ ruby test/suite.rb
...
1054 tests, 2510 assertions, 7 failures, 10 errors

Note

  • 7 Failures, 10 Errors
  • But these are caused by the interdependency of test-cases
  • They are fine (no faliure and error) if the test-cases run independently

Check independety

  • test_model: ok
masa@masa ~/ywesee/oddb.org/test/test_model $ ruby suite.rb
...
569 tests, 1380 assertions, 0 failures, 0 errors
  • test_plugin: ok (meddatad must run, this should be replaced to flexmock)
masa@masa ~/ywesee/oddb.org/test/test_plugin $ ruby suite.rb
...
201 tests, 607 assertions, 0 failures, 0 errors
  • test_stat: ok
masa@masa ~/ywesee/oddb.org/test/test_state $ ruby suite.rb 
...
8 tests, 16 assertions, 0 failures, 0 errors
  • test_util: ok
masa@masa ~/ywesee/oddb.org/test/test_util $ ruby suite.rb
...
251 tests, 490 assertions, 0 failures, 0 errors
  • test_view: ok
masa@masa ~/ywesee/oddb.org/test/test_view $ ruby suite.rb 
...
23 tests, 41 assertions, 0 failures, 0 errors

Note

  • Certainly, the interdependency is the cause

Resolve interdependency of test-cases

Consideration

  • The interdependency comes from the re-definition of the existing classes in a test-case
  • The re-definition influences on the other test-cases
  • Two solution can be:
    1. Improve suite.rb for each test-case to run independently
    2. Improve each test-case not to influence on the other test-case
  • The straightforward method is the latter
  • Basically, suite.rb runs many test-cases with 'require' statement to load a test-case file
  • Even if I use Thread and I make each test independetly, the collision of defnitions will occur by 'require' since the Thread shares the memory space
  • It may be possible to execute each test-case independently by using 'system' statement since this makes an independent process (namely, each memory space is also independent)

Update suite.rb (each test-case runs independently)

Result

masa@masa ~/ywesee/oddb.org $ ruby test/suite.rb
...
Loaded suite 
 /home/masa/ywesee/oddb.org/test/test_model/activeagent,
 /home/masa/ywesee/oddb.org/test/test_model/address,
 /home/masa/ywesee/oddb.org/test/test_model/address2,
 /home/masa/ywesee/oddb.org/test/test_model/atcclass,
 /home/masa/ywesee/oddb.org/test/test_model/atcnode,
 /home/masa/ywesee/oddb.org/test/test_model/company,
 /home/masa/ywesee/oddb.org/test/test_model/comparison,
 /home/masa/ywesee/oddb.org/test/test_model/cyp450,
 /home/masa/ywesee/oddb.org/test/test_model/cyp450connection,
 /home/masa/ywesee/oddb.org/test/test_model/doctor,
 /home/masa/ywesee/oddb.org/test/test_model/dose,
 /home/masa/ywesee/oddb.org/test/test_model/ean13,
 /home/masa/ywesee/oddb.org/test/test_model/fachinfo,
 /home/masa/ywesee/oddb.org/test/test_model/feedback,
 /home/masa/ywesee/oddb.org/test/test_model/galenicform,
 /home/masa/ywesee/oddb.org/test/test_model/galenicgroup,
 /home/masa/ywesee/oddb.org/test/test_model/genericgroup,
 /home/masa/ywesee/oddb.org/test/test_model/hospital,
 /home/masa/ywesee/oddb.org/test/test_model/indication,
 /home/masa/ywesee/oddb.org/test/test_model/invoice,
 /home/masa/ywesee/oddb.org/test/test_model/migel_group,
 /home/masa/ywesee/oddb.org/test/test_model/migel_product,
 /home/masa/ywesee/oddb.org/test/test_model/migel_subgroup,
 /home/masa/ywesee/oddb.org/test/test_model/narcotic,
 /home/masa/ywesee/oddb.org/test/test_model/package,
 /home/masa/ywesee/oddb.org/test/test_model/patinfo,
 /home/masa/ywesee/oddb.org/test/test_model/registration,
 /home/masa/ywesee/oddb.org/test/test_model/sequence,
 /home/masa/ywesee/oddb.org/test/test_model/slentry,
 /home/masa/ywesee/oddb.org/test/test_model/sponsor,
 /home/masa/ywesee/oddb.org/test/test_model/substance,
 /home/masa/ywesee/oddb.org/test/test_model/text,
 /home/masa/ywesee/oddb.org/test/test_model/user,
 /home/masa/ywesee/oddb.org/test/test_plugin/bsv_xml,
 /home/masa/ywesee/oddb.org/test/test_plugin/comarketing,
 /home/masa/ywesee/oddb.org/test/test_plugin/download_invoicer,
 /home/masa/ywesee/oddb.org/test/test_plugin/flockhart,
 /home/masa/ywesee/oddb.org/test/test_plugin/hayes,
 /home/masa/ywesee/oddb.org/test/test_plugin/hospitals,
 /home/masa/ywesee/oddb.org/test/test_plugin/interaction,
 /home/masa/ywesee/oddb.org/test/test_plugin/lppv,
 /home/masa/ywesee/oddb.org/test/test_plugin/medwin,
 /home/masa/ywesee/oddb.org/test/test_plugin/migel,
 /home/masa/ywesee/oddb.org/test/test_plugin/narcotic,
 /home/masa/ywesee/oddb.org/test/test_plugin/oddbdat_export,
 /home/masa/ywesee/oddb.org/test/test_plugin/ouwerkerk,
 /home/masa/ywesee/oddb.org/test/test_plugin/patinfo_invoicer,
 /home/masa/ywesee/oddb.org/test/test_plugin/plugin,
 /home/masa/ywesee/oddb.org/test/test_plugin/swissmedic,
 /home/masa/ywesee/oddb.org/test/test_plugin/swissmedicjournal,
 /home/masa/ywesee/oddb.org/test/test_plugin/text_info,
 /home/masa/ywesee/oddb.org/test/test_plugin/vaccines,
 /home/masa/ywesee/oddb.org/test/test_plugin/yaml,
 /home/masa/ywesee/oddb.org/test/test_plugin/zdoctor,
 /home/masa/ywesee/oddb.org/test/test_state/global,
 /home/masa/ywesee/oddb.org/test/test_state/page_facade,
 /home/masa/ywesee/oddb.org/test/test_util/config,
 /home/masa/ywesee/oddb.org/test/test_util/csstemplate,
 /home/masa/ywesee/oddb.org/test/test_util/exporter,
 /home/masa/ywesee/oddb.org/test/test_util/html_parser,
 /home/masa/ywesee/oddb.org/test/test_util/interval,
 /home/masa/ywesee/oddb.org/test/test_util/language,
 /home/masa/ywesee/oddb.org/test/test_util/levenshtein_distance,
 /home/masa/ywesee/oddb.org/test/test_util/logfile,
 /home/masa/ywesee/oddb.org/test/test_util/loggroup,
 /home/masa/ywesee/oddb.org/test/test_util/notification_logger,
 /home/masa/ywesee/oddb.org/test/test_util/oddbapp,
 /home/masa/ywesee/oddb.org/test/test_util/persistence,
 /home/masa/ywesee/oddb.org/test/test_util/pointerarray,
 /home/masa/ywesee/oddb.org/test/test_util/session,
 /home/masa/ywesee/oddb.org/test/test_util/soundex,
 /home/masa/ywesee/oddb.org/test/test_util/updater,
 /home/masa/ywesee/oddb.org/test/test_util/validator,
 /home/masa/ywesee/oddb.org/test/test_util/zlog,
 /home/masa/ywesee/oddb.org/test/test_view/asearch,
 /home/masa/ywesee/oddb.org/test/test_view/chapter,
 /home/masa/ywesee/oddb.org/test/test_view/descriptionform,
 /home/masa/ywesee/oddb.org/test/test_view/descriptionlist,
 /home/masa/ywesee/oddb.org/test/test_view/logo,
 /home/masa/ywesee/oddb.org/test/test_view/navigationfoot,
 /home/masa/ywesee/oddb.org/test/test_view/pager,
 /home/masa/ywesee/oddb.org/test/test_view/pointersteps,
 /home/masa/ywesee/oddb.org/test/test_view/sponsorhead
Finished in 20.171767 seconds.

  1) Error:
test_add_package(TestGenericGroup):
NoMethodError: undefined method `select_one' for nil:NilClass
    /usr/lib64/ruby/site_ruby/1.8/odba/storage.rb:605:in `restore_max_id'
    /usr/lib64/ruby/site_ruby/1.8/odba/storage.rb:601:in `ensure_next_id_set'
    /usr/lib64/ruby/site_ruby/1.8/odba/storage.rb:375:in `next_id'
    /usr/lib64/ruby/site_ruby/1.8/odba/storage.rb:374:in `synchronize'
    /usr/lib64/ruby/site_ruby/1.8/odba/storage.rb:374:in `next_id'
    /usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:387:in `next_id'
    /usr/lib64/ruby/site_ruby/1.8/odba/persistable.rb:259:in `odba_id'
    /home/masa/ywesee/oddb.org/src/util/persistence.rb:95:in `set_oid'
    /home/masa/ywesee/oddb.org/src/util/persistence.rb:106:in `initialize'
    /home/masa/ywesee/oddb.org/src/model/package_observer.rb:8:in `initialize'
    /home/masa/ywesee/oddb.org/test/test_model/genericgroup.rb:20:in `new'
    /home/masa/ywesee/oddb.org/test/test_model/genericgroup.rb:20:in `setup'

  2) Error:
test_remove_package(TestGenericGroup):
NoMethodError: undefined method `select_one' for nil:NilClass
    /usr/lib64/ruby/site_ruby/1.8/odba/storage.rb:605:in `restore_max_id'
    /usr/lib64/ruby/site_ruby/1.8/odba/storage.rb:601:in `ensure_next_id_set'
    /usr/lib64/ruby/site_ruby/1.8/odba/storage.rb:375:in `next_id'
    /usr/lib64/ruby/site_ruby/1.8/odba/storage.rb:374:in `synchronize'
    /usr/lib64/ruby/site_ruby/1.8/odba/storage.rb:374:in `next_id'
    /usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:387:in `next_id'
    /usr/lib64/ruby/site_ruby/1.8/odba/persistable.rb:259:in `odba_id'
    /home/masa/ywesee/oddb.org/src/util/persistence.rb:95:in `set_oid'
    /home/masa/ywesee/oddb.org/src/util/persistence.rb:106:in `initialize'
    /home/masa/ywesee/oddb.org/src/model/package_observer.rb:8:in `initialize'
    /home/masa/ywesee/oddb.org/test/test_model/genericgroup.rb:20:in `new'
    /home/masa/ywesee/oddb.org/test/test_model/genericgroup.rb:20:in `setup'


1054 tests, 2535 assertions, 0 failures, 2 errors

Note

  • I guess the errors above occur because of the loss of libraries requirement
  • Probably, these depend on the other test-cases
  • In my opinion, in any case, a test-case should be independent from the other test-cases

Experiment (Check the dependency)

  • Run the test-case from suite.rb
masa@masa ~/ywesee/oddb.org/test/test_model $ ruby suite.rb 
/home/masa/ywesee/oddb.org/src/view/drugs/resultlist.rb:21: warning: already initialized constant BACKGROUND_SUFFIX
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/sourcecode_dumpable.rb:73: warning: redefining constant Struct::MethodNamed
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/sourcecode_dumpable.rb:73: warning: already initialized constant MethodNamed
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/sourcecode_dumpable.rb:74: warning: redefining constant Struct::ModuleMethodNamed
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/sourcecode_dumpable.rb:74: warning: already initialized constant ModuleMethodNamed
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/glr_parser.rb:275: warning: redefining constant Struct::Link
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/glr_parser.rb:275: warning: already initialized constant Link
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/conflict_resolution.rb:18: warning: redefining constant Struct::Relation
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/conflict_resolution.rb:18: warning: already initialized constant Relation
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/grammar.rb:591: warning: already initialized constant EpsilonToken
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/graphviz_dot.rb:52: warning: redefining constant Struct::DotGraph
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/graphviz_dot.rb:52: warning: already initialized constant DotGraph
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/directed_graph.rb:16: warning: redefining constant Struct::GraphLink
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/directed_graph.rb:16: warning: already initialized constant GraphLink
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/reduce_actions_generator.rb:273: warning: redefining constant Struct::LaLrPair
/usr/lib64/ruby/site_ruby/1.8/rpdf2txt-rockit/reduce_actions_generator.rb:273: warning: already initialized constant LaLrPair
[DEPRECATED] By requiring 'spreadsheet/excel' you are loading a Compatibility
             layer which provides a drop-in replacement for Spreadsheet::Excel
             versions <= 0.3.5.1. This code will be removed in Spreadsheet
             version 1.0.0

/home/masa/ywesee/oddb.org/src/view/changelog.rb:26: warning: already initialized constant SORT_DEFAULT
./text.rb:273: warning: parenthesize argument(s) for future version
./user.rb:15: warning: already initialized constant YUS_SERVER
Loaded suite suite
Started
.............................................................................................................................................................................................................................................................................................................................................................................................................Substance.merge: no active agent, only removing sequence
............................................................................................................................................................................
Finished in 0.220021 seconds.

569 tests, 1380 assertions, 0 failures, 0 errors

Note

  • No error
  • Run the test-case by itself
masa@masa ~/ywesee/oddb.org/test/test_model $ ruby genericgroup.rb 
Loaded suite genericgroup
Started
EE
Finished in 0.000313 seconds.

  1) Error:
test_add_package(TestGenericGroup):
NoMethodError: undefined method `select_one' for nil:NilClass
    /usr/lib64/ruby/site_ruby/1.8/odba/storage.rb:605:in `restore_max_id'
    /usr/lib64/ruby/site_ruby/1.8/odba/storage.rb:601:in `ensure_next_id_set'
    /usr/lib64/ruby/site_ruby/1.8/odba/storage.rb:375:in `next_id'
    /usr/lib64/ruby/site_ruby/1.8/odba/storage.rb:374:in `synchronize'
    /usr/lib64/ruby/site_ruby/1.8/odba/storage.rb:374:in `next_id'
    /usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:387:in `next_id'
    /usr/lib64/ruby/site_ruby/1.8/odba/persistable.rb:259:in `odba_id'
    /home/masa/ywesee/oddb.org/src/util/persistence.rb:95:in `set_oid'
    /home/masa/ywesee/oddb.org/src/util/persistence.rb:106:in `initialize'
    /home/masa/ywesee/oddb.org/src/model/package_observer.rb:8:in `initialize'
    genericgroup.rb:20:in `new'
    genericgroup.rb:20:in `setup'

  2) Error:
test_remove_package(TestGenericGroup):
NoMethodError: undefined method `select_one' for nil:NilClass
    /usr/lib64/ruby/site_ruby/1.8/odba/storage.rb:605:in `restore_max_id'
    /usr/lib64/ruby/site_ruby/1.8/odba/storage.rb:601:in `ensure_next_id_set'
    /usr/lib64/ruby/site_ruby/1.8/odba/storage.rb:375:in `next_id'
    /usr/lib64/ruby/site_ruby/1.8/odba/storage.rb:374:in `synchronize'
    /usr/lib64/ruby/site_ruby/1.8/odba/storage.rb:374:in `next_id'
    /usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:387:in `next_id'
    /usr/lib64/ruby/site_ruby/1.8/odba/persistable.rb:259:in `odba_id'
    /home/masa/ywesee/oddb.org/src/util/persistence.rb:95:in `set_oid'
    /home/masa/ywesee/oddb.org/src/util/persistence.rb:106:in `initialize'
    /home/masa/ywesee/oddb.org/src/model/package_observer.rb:8:in `initialize'
    genericgroup.rb:20:in `new'
    genericgroup.rb:20:in `setup'

2 tests, 0 assertions, 0 failures, 2 errors

Note

  • Bingo as I thought.

Next

  • Update test/test_model/genericgroup.rb

Update test/test_model/genericgroup.rb

In my opinion

  • This test-case is not necessary
  • because there is no method defnition in src/model/genericgroup.rb

src/model/genericgroup.rb

#!/usr/bin/env ruby
# GenericGroup -- oddb -- 28.02.2003 -- hwyss@ywesee.com 

require 'util/persistence'
require 'model/package_observer'

module ODDB
  class GenericGroup
    include Persistence
    include PackageObserver
  end
end

Resolved

Result

masa@masa ~/ywesee/oddb.org/test/test_model $ ruby genericgroup.rb 
Loaded suite genericgroup
Started
...
Finished in 0.001909 seconds.

3 tests, 3 assertions, 0 failures, 0 errors

Total check

masa@masa ~/ywesee/oddb.org $ ruby test/suite.rb
...
Finished in 19.77257 seconds.


1055 tests, 2538 assertions, 0 failures, 0 errors

Note

  • 100% tests passed

Check coverage

masa@masa ~/ywesee/oddb.org $ rcov test/suite.rb
...
Finished in 18.647226 seconds.


1055 tests, 2538 assertions, 0 failures, 0 errors

No file to analyze was found. All the files loaded by rcov matched one of the
following expressions, and were thus ignored:
[/\A\/usr\/lib64/,
 /\btc_[^.]*.rb/,
 /_test\.rb\z/,
 /\btest\//,
 /\bvendor\//,
 /\A\/usr\/lib64\/ruby\/gems\/1\.8\/gems\/rcov\-0\.9\.9\/lib\/rcov\/formatters\/base_formatter\.rb\z/]

You can solve this by doing one or more of the following:
* rename the files not to be ignored so they don't match the above regexps
* use --include-file to give a list of patterns for files not to be ignored
* use --exclude-only to give the new list of regexps to match against
* structure your code as follows:
      test/test_*.rb  for the test cases
      lib/**/*.rb     for the target source code whose coverage you want
  making sure that the test/test_*.rb files are loading from lib/, e.g. by 
  using the -Ilib command-line argument, adding  
    $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
  to test/test_*.rb, or running rcov via a Rakefile (read the RDoc
  documentation or README.rake in the source distribution).

Note

  • The new suite.rb is not recognized by rcov
  • rcov summarizes the total coverage only in the case of execute test-cases in the same processs
  • Namely, we should 'require' every test-case if we check the coverage
  • It looks impossible to gather the results of rcov in different processes -> possible

Next

  • Check rcov --aggregate and --save option

ttt.rb

class TTT
  def method1
    100
  end
  def method2
    200
  end
  def method3
    300
  end
end

testcase1.rb

require 'test/unit'
require 'ttt'

class TestTTT < Test::Unit::TestCase
  def test_method
    assert_equal(100, TTT.new.method1)
  end
end

testcase2.rb

require 'test/unit'
require 'ttt'

class TestTTT < Test::Unit::TestCase
  def test_method
    assert_equal(200, TTT.new.method2)
  end
end

testcase3.rb

require 'test/unit'
require 'ttt'

class TestTTT < Test::Unit::TestCase
  def test_method
    assert_equal(300, TTT.new.method3)
  end
end

Run rcov --aggregate

masa@masa ~/work $ rcov testcase1.rb -t --aggregate coverage.dat
Loaded suite /usr/bin/rcov
Started
.
Finished in 0.000181 seconds.

1 tests, 1 assertions, 0 failures, 0 errors
72.2%   2 file(s)   22 Lines   18 LOC
masa@masa ~/work $ rcov testcase2.rb -t --aggregate coverage.dat
Loaded suite /usr/bin/rcov
Started
.
Finished in 0.000194 seconds.

1 tests, 1 assertions, 0 failures, 0 errors
88.0%   3 file(s)   31 Lines   25 LOC
masa@masa ~/work $ rcov testcase3.rb -t --aggregate coverage.dat
Loaded suite /usr/bin/rcov
Started
.
Finished in 0.000194 seconds.

1 tests, 1 assertions, 0 failures, 0 errors
100.0%   4 file(s)   40 Lines   32 LOC

Experiment

test/suite.rb

#!/usr/bin/env ruby
# suite.rb -- oddb -- 18.11.2002 -- hwyss@ywesee.com 

$: << File.dirname(__FILE__)

directories = []

Dir.foreach(File.dirname(__FILE__)) { |dir|
  if /^test_.*/o.match(dir)
    directories << File.expand_path(dir, File.dirname(__FILE__))
  end
}

directories.each { |dir|
  if(File.ftype(dir) == 'directory')
    puts dir
    Dir.foreach(dir) { |file|
      #if /.*\.rb$/o.match(file) && file!='suite.rb'
      if file == "suite.rb"
        #require(File.expand_path(file, dir))
        path = File.expand_path(file, dir)
        puts path
        system "rcov #{path} --no-html -t --aggregate coverage.dat"
      end
    }
  end
}

Result

masa@masa ~/ywesee/oddb.org $ ruby test/suite.rb
...
62.9%   573 file(s)   63518 Lines   58168 LOC

Note

  • Total coverage: 62.9% (All tests passed)

Update

  • test/suite.rb

Result

masa@masa ~/ywesee/oddb.org $ ruby test/suite.rb 
...
Loaded suite 
 /home/masa/ywesee/oddb.org/test/test_model/suite,
 /home/masa/ywesee/oddb.org/test/test_plugin/suite,
 /home/masa/ywesee/oddb.org/test/test_state/suite,
 /home/masa/ywesee/oddb.org/test/test_util/suite,
 /home/masa/ywesee/oddb.org/test/test_view/suite

Finished in 12.832734 seconds.


1052 tests, 2534 assertions, 0 failures, 0 errors

Commit

Total coverage (oddb.org, except for ext scripts)

view · edit · sidebar · attach · print · history
Page last modified on February 11, 2011, at 08:10 AM