view · edit · sidebar · attach · print · history

20110208-testcases--oddb_org

<< | Index | >>


  1. Update test-cases for exporter.rb (100% coverage)
  2. Check test-cases for plugins
  3. Update the test-case of ouwerkerk.rb
  4. Check coverage oddb.org
  5. Update test-case test_util

Goal
  • Update test-cases export_oddbdat / 100%
  • Update test-cases oddb.org / 70%
Milestones
  1. test-cases for exporter.rb 9:30
  2. Check test-cases for plugins
    1. bsv_xml.rb src/util/logfile (LoadError) 9:50
    2. hospitals.rb ext/meddata/src/meddata (LoadError) 10:00
    3. flockhart.rb 26 errors 10:45
    4. Check all the tests
    5. Update test-case ouwerkerk.rb
  3. Check coverage 15:30
  4. Update test_util
  5. Update test_view
Summary
Commits
ToDo Tomorrow
Keep in Mind
  1. On Ice

Update test-cases for exporter.rb (100% coverage)

The current exporter.rb

Result

masa@masa ~/ywesee/oddb.org/test/test_util $ ruby exporter.rb 
[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

Loaded suite exporter
Started
..........................................
Finished in 0.114101 seconds.

42 tests, 35 assertions, 0 failures, 0 errors

Update test/test_util/exporter.rb

Result

masa@masa ~/ywesee/oddb.org/test/test_util $ ruby exporter.rb 
[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

Loaded suite exporter
Started
..........................................
Finished in 0.190083 seconds.

42 tests, 35 assertions, 0 failures, 0 errors

Done

Result

masa@masa ~/ywesee/oddb.org/test/test_util $ ruby exporter.rb 
[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

Loaded suite exporter
Started
............................................
Finished in 0.245917 seconds.

44 tests, 43 assertions, 0 failures, 0 errors

Commit

Check test-cases for plugins

The current status

masa@masa ~/ywesee/oddb.org/test/test_plugin $ ruby suite.rb 
/usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- src/util/logfile (LoadError)
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from ./bsv_xml.rb:11
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from suite.rb:8
        from suite.rb:6:in `foreach'
        from suite.rb:6

Check one by one

  • bsv_xml.rb src/util/logfile (LoadError)
  • comarketing.rb all passed
  • doctors.rb all passed
  • download_invoicer.rb all passed
  • flockhart.rb 26 errors
  • hayes.rb all passed
  • hospitals.rb ext/meddata/src/meddata (LoadError)
  • interaction.rb all passed
  • lppv.rb all passed
  • medwin.rb all passed
  • migel.rb all passed
  • narcotic.rb all passed (warning)
  • oddbdat_export.rb all passed
  • ouwerkerk.rb all passed
  • patinfo_invoicer.rb all passed
  • plugin.rb all passed
  • swissmedicjournal.rb all passed
  • swissmedic.rb all passed
  • text_info.rb all passed
  • vaccines.rb all passed
  • yaml.rb all passed

Next

  • Check the following test-cases
    1. bsv_xml.rb src/util/logfile (LoadError)
    2. flockhart.rb 26 errors
    3. hospitals.rb ext/meddata/src/meddata (LoadError)

Update

test/test_plugin/bsv_xml.rb

# require 'src/util/logfile'
require 'util/logfile'

Check test-cases for bsv_xml.rb

masa@masa ~/ywesee/oddb.org/test/test_plugin $ ruby bsv_xml.rb 
Loaded suite bsv_xml
Started
..EEEEEEE
Finished in 0.04844 seconds.

  1) Error:
test_update_preparation(ODDB::TestBsvXmlPlugin):
DRb::DRbConnError: druby://localhost:10006 - #<Errno::ECONNREFUSED: Connection refused - connect(2)>
...

Note

  • 7 DRbConnError
  • This test needs medatad running

Run

  • oddb.org/ext/meddata/bin/meddatad

Check again

masa@masa ~/ywesee/oddb.org/test/test_plugin $ ruby bsv_xml.rb 
Loaded suite bsv_xml
Started
.........
Finished in 0.148717 seconds.

9 tests, 71 assertions, 0 failures, 0 errors

Update

src/plugin/hospitals.rb

$: << File.expand_path('../..', File.dirname(__FILE__))
$: << File.expand_path('../../src', File.dirname(__FILE__))

Check test-cases for hospitals.rb

masa@masa ~/ywesee/oddb.org/test/test_plugin $ ruby hospitals.rb 
Loaded suite hospitals
Started
...
Finished in 0.000778 seconds.

3 tests, 11 assertions, 0 failures, 0 errors

Check test-cases for flockhart.rb

masa@masa ~/ywesee/oddb.org/test/test_plugin $ ruby flockhart.rb 
flockhart.rb:15: warning: already initialized constant TARGET
Loaded suite flockhart
Started
.EEEEEEEEEEEEEEEEEEEEEEEEEE
Finished in 0.002473 seconds.

  1) Error:
test_get_table_links(TestFlockhartPlugin):
Errno::ENOENT: No such file or directory - /home/masa/ywesee/oddb.org/test/data/html/interaction/flockhart/table.asp
    /home/masa/ywesee/oddb.org/src/plugin/flockhart.rb:357:in `read'
    /home/masa/ywesee/oddb.org/src/plugin/flockhart.rb:357:in `get_table_links'
    flockhart.rb:237:in `test_get_table_links'
...
  5) Error:
test_check_string(TestFlockhartWriter):
Errno::ENOENT: No such file or directory - /home/masa/ywesee/oddb.org/test/data/html/interaction/flockhart/prepared_table.asp
    flockhart.rb:41:in `read'
    flockhart.rb:41:in `setup'
...

Note

  • There are not 2 files, talbe.asp and prepared_table.asp

Get table.asp from online server

  • and put it in est/data/html/interaction/flockhart/ directory as table.asp and prepared_table.asp

Result

masa@masa ~/ywesee/oddb.org/test/test_plugin $ ruby flockhart.rb 
flockhart.rb:15: warning: already initialized constant TARGET
Loaded suite flockhart
Started
..............F............
Finished in 4.031105 seconds.

  1) Failure:
test_extract_data3(TestFlockhartWriter) [flockhart.rb:113]:
<5> expected but was
<37>.

27 tests, 50 assertions, 1 failures, 0 errors

Update

  • I changed the '5' into '37'

Result

masa@masa ~/ywesee/oddb.org/test/test_plugin $ ruby flockhart.rb 
flockhart.rb:15: warning: already initialized constant TARGET
Loaded suite flockhart
Started
...........................
Finished in 3.800162 seconds.

27 tests, 50 assertions, 0 failures, 0 errors

Check all the tests

masa@masa ~/ywesee/oddb.org/test/test_plugin $ ruby suite.rb 
./doctors.rb:15: warning: already initialized constant PARSER
./flockhart.rb:15: warning: already initialized constant TARGET
./hayes.rb:22: warning: already initialized constant TARGET
./interaction.rb:19: warning: already initialized constant REFETCH_PAGES
/home/masa/ywesee/oddb.org/src/model/package.rb:297: superclass mismatch for class Package (TypeError)
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /home/masa/ywesee/oddb.org/src/plugin/lppv.rb:7
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from ./lppv.rb:8
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from suite.rb:8
        from suite.rb:6:in `foreach'
        from suite.rb:6

Note

  • Each test file can pass
  • bsv_xml.rb create log files
  • ouwerkerk.rb creates med-drugs-20xxxxxx.xls file in test/data/xls directory
  • The cause of the error is the duplicated definition of some class, in paticular Package class, in the test file, bsv_xml.rb

bsv_xml.rb

  class Package
  end

Note

  • The other test-cases are influenced by this definition

Memo

  • So, the overwriting of a class should not be used in a test-case file since the definition may influence on the other test-cases
  • I should check the test-cases for exporter.rb too

Experiment

masa@masa ~/ywesee/oddb.org/test/test_plugin $ ls
bak  doctor.rb  suite.rb  swissmedic.rb

Result

masa@masa ~/ywesee/oddb.org/test/test_plugin $ ruby suite.rb 
"doctor.rb"
./doctor.rb:15: warning: already initialized constant PARSER
"swissmedic.rb"
Loaded suite suite
Started
................EEEEEEE...............
Finished in 1.148659 seconds.

  1) Error:
test_update_composition__chemical_form(ODDB::SwissmedicPluginTest):
NoMethodError: undefined method `restore_collection' for #<ODBA::StorageStub:0x7ff9ffb24430 @id=7>
    /usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:523:in `store_collection_elements'
...

Experiment2

masa@masa ~/ywesee/oddb.org/test/test_plugin $ mv doctor.rb zdoctor.rb
masa@masa ~/ywesee/oddb.org/test/test_plugin $ ls
bak  suite.rb  swissmedic.rb  zdoctor.rb

Result

masa@masa ~/ywesee/oddb.org/test/test_plugin $ ruby suite.rb 
"swissmedic.rb"
"zdoctor.rb"
./zdoctor.rb:15: warning: already initialized constant PARSER
Loaded suite suite
Started
......................................
Finished in 1.128338 seconds.

38 tests, 134 assertions, 0 failures, 0 errors

Note

  • What I can say is that 'swissmedic.rb' should run before 'doctor.rb'

Experiment

class TestSuper
end

class Test
end

class Test < TestSuper
end

Result

masa@masa ~/work $ ruby test.rb 
test.rb:8: superclass mismatch for class Test (TypeError)

Note

  • So, this means the class cannot be defined again with the other superclass
  • in bsv_xml.rb there is Package definition like
class Package
end
  • but in lppv.rb src/model/package.rb is loaded (required) then the Package is defined as
class Package < PackageCommon
  • That is why the error comes

Experiment

bsv_xml.rb

  class PackageCommon
  end
  class Package < PackageCommon
  end

Result

masa@masa ~/ywesee/oddb.org/test/test_plugin $ ruby suite.rb 
"bsv_xml.rb"
"lppv.rb"
Loaded suite suite
Started
...............
Finished in 0.106029 seconds.

15 tests, 89 assertions, 0 failures, 0 errors

Note

  • Good

Check all the tests

masa@masa ~/ywesee/oddb.org/test/test_plugin $ ls 
bsv_xml.rb            flockhart.rb  interaction.rb  migel.rb           ouwerkerk.rb         suite.rb              test.rb       yaml.rb
comarketing.rb        hayes.rb      lppv.rb         narcotic.rb        patinfo_invoicer.rb  swissmedicjournal.rb  text_info.rb  zdoctor.rb
download_invoicer.rb  hospitals.rb  medwin.rb       oddbdat_export.rb  plugin.rb            swissmedic.rb         vaccines.rb

Result

masa@masa ~/ywesee/oddb.org/test/test_plugin $ ruby suite.rb 
./flockhart.rb:15: warning: already initialized constant TARGET
./hayes.rb:22: warning: already initialized constant TARGET
./interaction.rb:19: warning: already initialized constant REFETCH_PAGES
/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
./vaccines.rb:28: warning: already initialized constant MEDDATA_SERVER
./zdoctor.rb:15: warning: already initialized constant PARSER
Loaded suite suite
Started
.........................................................................................................................................................................................................
Finished in 9.85082 seconds.

201 tests, 607 assertions, 0 failures, 0 errors

Note

  • Good
  • 'doctor.rb' is changed into 'zdoctor.rb'

Commit

Update the test-case of ouwerkerk.rb

Problem

  • After the test-case of ouwerkerk.rb runs, a xml file is created

Task

  • Update the test-case not to create a new data file
masa@masa ~/ywesee/oddb.org $ git status
# On branch master
nothing to commit (working directory clean)
masa@masa ~/ywesee/oddb.org $ ruby test/test_plugin/ouwerkerk.rb 
[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

Loaded suite test/test_plugin/ouwerkerk
Started
......
Finished in 0.015723 seconds.

6 tests, 13 assertions, 0 failures, 0 errors
masa@masa ~/ywesee/oddb.org $ git status
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       test/data/xls/med-drugs-20110208.xls
nothing added to commit but untracked files present (use "git add" to track)

Note

  • The teardown method should be updated

Update

test/test_plugin/ouwerkerk.rb#teardown

  def teardown
    if(File.exists? @plugin.file_path)
      FileUtils.rm_f(@plugin.file_path)
    end
    ODBA.storage = nil
  end

Result

masa@masa ~/ywesee/oddb.org $ git status
# On branch master
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   test/test_plugin/ouwerkerk.rb
#
no changes added to commit (use "git add" and/or "git commit -a")
masa@masa ~/ywesee/oddb.org $ ruby test/test_plugin/ouwerkerk.rb 
[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

Loaded suite test/test_plugin/ouwerkerk
Started
......
Finished in 0.015414 seconds.

6 tests, 13 assertions, 0 failures, 0 errors
masa@masa ~/ywesee/oddb.org $ git status
# On branch master
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   test/test_plugin/ouwerkerk.rb
#
no changes added to commit (use "git add" and/or "git commit -a")

Commit

Check coverage oddb.org

The error

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/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- ext/analysisparse/src/analysis_hpricot (LoadError)
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /home/masa/ywesee/oddb.org/src/plugin/analysis.rb:5
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /home/masa/ywesee/oddb.org/src/util/updater.rb:4
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /home/masa/ywesee/oddb.org/src/state/admin/init.rb:7
         ... 28 levels...
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from suite.rb:8
        from suite.rb:6:in `foreach'
        from suite.rb:6

Update

 $: << path = File.expand_path("../..", File.dirname(__FILE__)) unless $:.include?(path)

test_model

masa@masa ~/ywesee/oddb.org/test/test_model $ rcov 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 /usr/bin/rcov
Started
.............................................................................................................................................................................................................................................................................................................................................................................................................Substance.merge: no active agent, only removing sequence
............................................................................................................................................................................
Finished in 0.340383 seconds.

569 tests, 1380 assertions, 0 failures, 0 errors

test_state

masa@masa ~/ywesee/oddb.org/test/test_state $ rcov 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
Loaded suite /usr/bin/rcov
Started
........
Finished in 0.001202 seconds.

8 tests, 16 assertions, 0 failures, 0 errors

test_util

masa@masa ~/ywesee/oddb.org/test/test_util $ rcov suite.rb 
...
250 tests, 486 assertions, 3 failures, 2 errors
masa@masa ~/ywesee/oddb.org/test/test_util $ 

test_view

masa@masa ~/ywesee/oddb.org/test/test_view $ rcov 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 /usr/bin/rcov
Started
................F......
Finished in 0.163001 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:0x7f69ac396b70>; expected next_id, was restore_named

23 tests, 39 assertions, 1 failures, 0 errors

Check coverages

Total coverage (oddb.org/src, not include all ext scripts)

Note

  • The calculation above is something strange
  • But anyway it is about 50 - 70%

Update test-case test_util

Current

masa@masa ~/ywesee/oddb.org/test/test_util $ ruby suite.rb
...
  1) Error:
test_notify(ODDB::TestLog):
NoMethodError: undefined method `config' for ODDB:Module
    /home/masa/ywesee/oddb.org/src/util/log.rb:112:in `send_mail'
    /home/masa/ywesee/oddb.org/src/util/log.rb:86:in `notify'
    ./log.rb:48:in `test_notify'

  2) Error:
test_notify_date_str(ODDB::TestLog):
NoMethodError: undefined method `config' for ODDB:Module
    /home/masa/ywesee/oddb.org/src/util/log.rb:112:in `send_mail'
    /home/masa/ywesee/oddb.org/src/util/log.rb:86:in `notify'
    ./log.rb:76:in `test_notify_date_str'

  3) Failure:
test_notify_file(ODDB::TestLog) [./log.rb:105]:
Exception raised:
Class: <NoMethodError>
Message: <"undefined method `config' for ODDB:Module">
---Backtrace---
/home/masa/ywesee/oddb.org/src/util/log.rb:112:in `send_mail'
/home/masa/ywesee/oddb.org/src/util/log.rb:86:in `notify'
./log.rb:106:in `test_notify_file'
./log.rb:105:in `test_notify_file'
---------------

  4) Failure:
test_async(TestOddbApp) [./oddbapp.rb:719]:
<"bar"> expected but was
<"baz">.

  5) Failure:
test_last_medication_update(TestOddbApp) [./oddbapp.rb:704]:
<Tue, 08 Feb 2011> expected but was
<Sun, 02 Jan 2011>.
250 tests, 486 assertions, 3 failures, 2 errors

Update one by one

Result

masa@masa ~/ywesee/oddb.org/test/test_util $ ruby log.rb 
Loaded suite log
Started
....
Finished in 0.00825 seconds.

4 tests, 6 assertions, 0 failures, 0 errors

But

masa@masa ~/ywesee/oddb.org/test/test_util $ ruby suite.rb
...
  1) Error:
test_notify(ODDB::TestLog):
ArgumentError: wrong auth type smtp_authtype
    /usr/lib64/ruby/1.8/net/smtp.rb:568:in `check_auth_args'
    /home/masa/ywesee/oddb.org/src/util/smtp_tls.rb:8:in `do_start'
    /usr/lib64/ruby/1.8/net/smtp.rb:377:in `start'
    /usr/lib64/ruby/1.8/net/smtp.rb:315:in `start'
    /home/masa/ywesee/oddb.org/src/util/log.rb:119:in `send_mail'
    /home/masa/ywesee/oddb.org/src/util/log.rb:86:in `notify'
    ./log.rb:67:in `test_notify'

  2) Error:
test_notify_date_str(ODDB::TestLog):
ArgumentError: wrong auth type smtp_authtype
    /usr/lib64/ruby/1.8/net/smtp.rb:568:in `check_auth_args'
    /home/masa/ywesee/oddb.org/src/util/smtp_tls.rb:8:in `do_start'
    /usr/lib64/ruby/1.8/net/smtp.rb:377:in `start'
    /usr/lib64/ruby/1.8/net/smtp.rb:315:in `start'
    /home/masa/ywesee/oddb.org/src/util/log.rb:119:in `send_mail'
    /home/masa/ywesee/oddb.org/src/util/log.rb:86:in `notify'
    ./log.rb:95:in `test_notify_date_str'

  3) Failure:
test_notify_file(ODDB::TestLog) [./log.rb:124]:
Exception raised:
Class: <ArgumentError>
Message: <"wrong auth type smtp_authtype">
---Backtrace---
/usr/lib64/ruby/1.8/net/smtp.rb:568:in `check_auth_args'
/home/masa/ywesee/oddb.org/src/util/smtp_tls.rb:8:in `do_start'
/usr/lib64/ruby/1.8/net/smtp.rb:377:in `start'
/usr/lib64/ruby/1.8/net/smtp.rb:315:in `start'
/home/masa/ywesee/oddb.org/src/util/log.rb:119:in `send_mail'
/home/masa/ywesee/oddb.org/src/util/log.rb:86:in `notify'
./log.rb:125:in `test_notify_file'
./log.rb:124:in `test_notify_file'
---------------

  4) Failure:
test_async(TestOddbApp) [./oddbapp.rb:719]:
<"bar"> expected but was
<"baz">.

  5) Failure:
test_last_medication_update(TestOddbApp) [./oddbapp.rb:704]:
<Tue, 08 Feb 2011> expected but was
<Sun, 02 Jan 2011>.

250 tests, 486 assertions, 3 failures, 2 errors

Note

  • There must be some dependencies

Experiment

masa@masa ~/ywesee/oddb.org/test/test_util $ git mv log.rb zlog.rb

Result

masa@masa ~/ywesee/oddb.org/test/test_util $ ruby suite.rb
..
  1) Failure:
test_async(TestOddbApp) [./oddbapp.rb:719]:
<"bar"> expected but was
<"baz">.

  2) Failure:
test_last_medication_update(TestOddbApp) [./oddbapp.rb:704]:
<Tue, 08 Feb 2011> expected but was
<Sun, 02 Jan 2011>.

250 tests, 488 assertions, 2 failures, 0 errors

Note

  • 'log.rb' should run at the last

Got it

  • This is because of 'sleep' re-definition in exporter.rb
  • Not yet resolved

Commit

view · edit · sidebar · attach · print · history
Page last modified on February 08, 2011, at 04:52 PM