Difference between revisions of "Unit tests"

From EPrints Documentation
Jump to: navigation, search
(Created page with 'Centos 7.1, EPrints 3.3.14 from RPM Unit tests * Needed to install perl-Test-Simple (provides Test::More) and perl-Test-Memory-Cycle * I think the Sword test might be failing bec…')
 
m (finally remove old test runs, the steps on this page should result in all but one test passing so the old cruft from Before Instructions is just using space)
 
(18 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Centos 7.1, EPrints 3.3.14 from RPM Unit tests
+
Since Eprints 3.2 [[New_Features_in_EPrints_3.2#Unit_Tests |unit tests have been included in the codebase]] and can be run by developer and non developer alike.
* Needed to install perl-Test-Simple (provides Test::More) and perl-Test-Memory-Cycle
 
* I think the Sword test might be failing because I used example.com as my hostname?
 
* the Metafield/Id.pm errors may be resolved by: https://github.com/eprints/eprints/issues/359
 
  
===STDOUT===
+
The tests are not changed very often, but there are quite a few of them covering the existing codebase.
<pre>
 
/usr/share/eprints/tests/01_use.pl ............... ok
 
/usr/share/eprints/tests/02_session.pl ........... ok
 
/usr/share/eprints/tests/03_set_value.pl ......... ok
 
/usr/share/eprints/tests/05_bug_fixes.pl .........
 
Dubious, test returned 255 (wstat 65280, 0xff00)
 
Failed 11/15 subtests
 
/usr/share/eprints/tests/10_xml_dom.pl ...........
 
Dubious, test returned 2 (wstat 512, 0x200)
 
Failed 3/12 subtests
 
/usr/share/eprints/tests/10_xml_gdome.pl ......... skipped: XML::GDOME missing
 
/usr/share/eprints/tests/10_xml_libxml.pl ........
 
Dubious, test returned 255 (wstat 65280, 0xff00)
 
Failed 3/12 subtests
 
/usr/share/eprints/tests/11_epscript.pl .......... ok
 
/usr/share/eprints/tests/20_database_utf8.pl ..... ok
 
/usr/share/eprints/tests/21_database_fields.pl ... ok
 
/usr/share/eprints/tests/23_cache.pl ............. ok
 
/usr/share/eprints/tests/25_mysql.pl ............. ok
 
/usr/share/eprints/tests/30_search.pl ............
 
Dubious, test returned 255 (wstat 65280, 0xff00)
 
Failed 33/36 subtests
 
/usr/share/eprints/tests/31_simple_search.pl ..... ok
 
/usr/share/eprints/tests/32_triples.pl ........... ok
 
/usr/share/eprints/tests/40_views.pl .............
 
Dubious, test returned 1 (wstat 256, 0x100)
 
Failed 1/6 subtests
 
/usr/share/eprints/tests/50_mem_usage.pl ......... ok
 
/usr/share/eprints/tests/51_plugin_mem_usage.pl .. ok
 
/usr/share/eprints/tests/52_mem_cycle.pl ......... ok
 
/usr/share/eprints/tests/55_phrases.pl ........... ok
 
/usr/share/eprints/tests/60_id_value.pl .......... ok
 
/usr/share/eprints/tests/61_subjects.pl .......... ok
 
/usr/share/eprints/tests/65_epm.pl ............... ok
 
/usr/share/eprints/tests/67_crypt.pl ............. ok
 
/usr/share/eprints/tests/70_xml_import.pl ........ ok
 
/usr/share/eprints/tests/80_screenprocessor.pl ... ok
 
/usr/share/eprints/tests/81_workflow.pl ..........
 
Dubious, test returned 255 (wstat 65280, 0xff00)
 
Failed 1/4 subtests
 
/usr/share/eprints/tests/82_eprint_view.pl ....... ok
 
/usr/share/eprints/tests/82_screen.pl ............ ok
 
/usr/share/eprints/tests/83_static.pl ............ ok
 
Bailout called.  Further testing stopped:  Error retrieving http://jlrs.example.com: 500 Can't connect to jlrs.example.com:80 (Bad hostname) at /usr/share/eprints/tests/84_sword.pl line 54, <DATA> line 8.
 
</pre>
 
  
===STDERR===
+
== Required packages==
<pre>
 
# EPrints Version: 3.3.14
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
  
#  Failed test 'list is 3 long'
+
Exact requirements for running the tests aren't documented but at this writing, the used packages are these (available from a distribution package or CPAN).
at /usr/share/eprints/tests/05_bug_fixes.pl line 24.
 
#          got: '0'
 
#    expected: '3'
 
  
#  Failed test 'list is 3 long after map'
+
$ grep -h '^use.*::' * |cut -d ' ' -f 2  |sort -u
#  at /usr/share/eprints/tests/05_bug_fixes.pl line 26.
+
"EPrints::Test"
#          got: '0'
+
"EPrints::Test::XML"
#    expected: '3'
+
Data::Compare;
 +
Data::Dumper;
 +
Digest::MD5;
 +
EPrints::SystemSettings;
 +
EPrints::Test::RepositoryLog;
 +
EPrints::Test;
 +
LWP::UserAgent;
 +
Test::MockObject::Extends;
 +
Test::MockObject;
 +
Test::More
 +
Test::More;
 +
XML::LibXML::XPathContext;
 +
XML::LibXML;
  
#  Failed test 'all slice is 3 long'
+
On RHEL these can be installed by:
#  at /usr/share/eprints/tests/05_bug_fixes.pl line 27.
 
#          got: undef
 
#    expected: '3'
 
  
#  Failed test 'slice is 3 long'
+
yum install eprints perl-Data-Compare perl-libwww-perl perl-Test-Simple perl-Test-MockObject perl-XML-LibXML
#  at /usr/share/eprints/tests/05_bug_fixes.pl line 28.
 
#          got: undef
 
#    expected: '3'
 
  
#  Failed test 'slice is 3 long, asked for 5'
 
#  at /usr/share/eprints/tests/05_bug_fixes.pl line 29.
 
#          got: undef
 
#    expected: '3'
 
  
#  Failed test 'slice is 2 long, asked for 2'
+
== Optional packages ==
#  at /usr/share/eprints/tests/05_bug_fixes.pl line 30.
 
#          got: undef
 
#    expected: '2'
 
  
#  Failed test 'list is 3 long after slice'
+
There are also optional dependencies (checked with egrep 'require .*::' *):
#  at /usr/share/eprints/tests/05_bug_fixes.pl line 31.
+
* Test::Memory::Cycle
#          got: '0'
+
* XML::DOM
#    expected: '3'
+
* XML::GDOME
Can't call method "create_subdataobj" on unblessed reference at /usr/share/eprints/tests/05_bug_fixes.pl line 36.
 
# Looks like you planned 15 tests but ran 11.
 
# Looks like you failed 7 tests of 11 run.
 
# Looks like your test exited with 255 just after 11.
 
Can't call method "to_xml" on an undefined value at /usr/share/eprints/bin/../perl_lib/EPrints/Test/XML.pm line 50.
 
# Looks like you planned 12 tests but ran 9.
 
# Looks like your test exited with 2 just after 9.
 
Can't call method "to_xml" on an undefined value at /usr/share/eprints/bin/../perl_lib/EPrints/Test/XML.pm line 50.
 
# Looks like you planned 12 tests but ran 9.
 
# Looks like your test exited with 255 just after 9.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
  
#  Failed test 'blank found matches'
+
yum install perl-Test-Memory-Cycle perl-XML-DOM
#  at /usr/share/eprints/tests/30_search.pl line 21.
 
  
#  Failed test 'search range eprintid'
+
XML::GDOME is not available on RHEL6 repositories
#  at /usr/share/eprints/tests/30_search.pl line 33.
 
  
#  Failed test 'title IN + creators_name GREP
+
Storage::LocalCompress is not available on RHEL6 repositories, but if installing it PerlIO::gzip (perl-PerlIO-gzip) is required.
# AND(
 
#      AND(
 
#              grep($eprint.creators_name,"%[maury]%-%[w%") ... eprint__index_grep,
 
#              index($eprint.creators_name,"maury") ... eprint__rindex
 
#      ),
 
#      AND(
 
#              grep($eprint.creators_name,"%[parkes]%-%[f%") ... eprint__index_grep,
 
#              index($eprint.creators_name,"parkes") ... eprint__rindex
 
#      ),
 
#      index($eprint.title,"eagle") ... eprint__rindex
 
# )'
 
#  at /usr/share/eprints/tests/30_search.pl line 43.
 
  
#  Failed test 'SET match'
 
#  at /usr/share/eprints/tests/30_search.pl line 58.
 
  
#  Failed test 'subjects and divisions: AND(
+
=== EPrint generating script ===
#      in_subject($eprint.divisions,"sch_mat") ... eprint_divisions,
 
#      in_subject($eprint.subjects,"GR") ... eprint_subjects
 
# )'
 
#  at /usr/share/eprints/tests/30_search.pl line 71.
 
  
#  Failed test 'match testdata article full text'
+
EPrints ships ''testdata//bin/import_rand_data'' to generate a number of records ( By default creates 1000 prints, 100 publications, 10 publishers and 10 institutions). They don't appear to be required by existing tests but you may find them useful to have during testing anyway and they will be used if available.
#  at /usr/share/eprints/tests/30_search.pl line 82.
 
Can't call method "get_parent" on an undefined value at /usr/share/eprints/tests/30_search.pl line 86.
 
# Looks like you planned 36 tests but ran 9.
 
# Looks like you failed 6 tests of 9 run.
 
# Looks like your test exited with 255 just after 9.
 
# memory footprint
 
Warning! No values were found for eprint.view._40_views_pl [date] - configuration may be wrong
 
# /tmp/jrjiuqUzTc/en/view/_40_views_pl
 
  
#  Failed test 'browse_view_menu'
+
This requires [ https://metacpan.org/pod/Text::Lorem Text::Lorem] which is not packaged but can be trivially vendored in to an eprints install.
#  at /usr/share/eprints/tests/40_views.pl line 67.
+
 
#        update_view_by_path=-1B
+
 
#        update_browse_view_list=-1B
+
wget https://st.aticpan.org/source/ADEOLA/Text-Lorem-0.3/lib/Text/Lorem.pm -O perl_lib/Text/Lorem.pm
# Looks like you failed 1 test of 6.
+
 
# LOAD=-1B
+
 
# Repository-Specific Data
+
Once installed it can be run with
#      _load_config=-1B
+
./testdata/bin/import_rand_data REPOID
#      _load_workflows=-1B
+
 
#      _load_namedsets=-1B
+
Following this ensure your documents are indexed, either via web or command line
#      _load_datasets=-1B
+
./bin/indexer start --verbose --notdaemon # ^C to stop this after completion
#      _load_languages=-1B
+
 
#      _load_templates=-1B
+
== Other configuration ==
#      _load_citation_specs=-1B
+
 
#      _load_storage=-1B
+
* A user named "admin" is required for some tests to run, said user does not have to be an admin
#      _load_plugins=-1B
+
 
# Session=-1B
+
 
#
+
== Dummy data ==
# Plugin Memory Usage
+
 
# EPrints::Plugin::Screen::EPrint::Messages=-1B
+
For test instances test data can be installed. Without this data set many dozen tests will fail.
# EPrints::Plugin::Convert::Thumbnails=-1B
+
 
# EPrints::Plugin::Search=-1B
+
 
# EPrints::Plugin::Storage::EPM=-1B
+
Pre supplied data (from testdata/* can be installed with ``import_test_data`` - REPOID is required.
# EPrints::Plugin::Screen::Workflow::Destroy=-1B
+
 
# EPrints::Plugin::Screen::Workflow::Destroy=-1B
+
./testdata/bin/import_test_data REPOID
# Undefined phrase: xxx_invalid (en) at line 24 in /usr/share/eprints/tests/55_phrases.pl
+
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
+
Following this ensure your documents are indexed, either via web or command line
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
+
./bin/indexer start --verbose --notdaemon # ^C to stop this after completion
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
+
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
+
== Expected output ==
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
+
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
+
Not everything is an error - these items look like problems but aren't.
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
+
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
+
# Undefined phrase: xxx_invalid (en) at line 24 in /usr/share/eprints/tests/55_phrases.pl
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Can't call method "get_dataset" on an undefined value at /usr/share/eprints/bin/../perl_lib/EPrints/Workflow.pm line 145.
 
# Looks like you planned 4 tests but ran 3.
 
# Looks like your test exited with 255 just after 3.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Argument "" isn't numeric in addition (+) at /usr/share/eprints/bin/../perl_lib/EPrints/Database.pm line 1500.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
Use of uninitialized value in subroutine entry at /usr/share/eprints/bin/../perl_lib/EPrints/MetaField/Id.pm line 50.
 
FAILED--Further testing stopped: Error retrieving http://jlrs.example.com: 500 Can't connect to jlrs.example.com:80 (Bad hostname) at /usr/share/eprints/tests/84_sword.pl line 54, <DATA> line 8.
 
</pre>
 

Latest revision as of 01:40, 11 October 2018

Since Eprints 3.2 unit tests have been included in the codebase and can be run by developer and non developer alike.

The tests are not changed very often, but there are quite a few of them covering the existing codebase.

Required packages

Exact requirements for running the tests aren't documented but at this writing, the used packages are these (available from a distribution package or CPAN).

$ grep -h '^use.*::' * |cut -d ' ' -f 2  |sort -u
"EPrints::Test"
"EPrints::Test::XML"
Data::Compare;
Data::Dumper;
Digest::MD5;
EPrints::SystemSettings;
EPrints::Test::RepositoryLog;
EPrints::Test;
LWP::UserAgent;
Test::MockObject::Extends;
Test::MockObject;
Test::More
Test::More;
XML::LibXML::XPathContext;
XML::LibXML;

On RHEL these can be installed by:

yum install eprints perl-Data-Compare perl-libwww-perl perl-Test-Simple perl-Test-MockObject perl-XML-LibXML


Optional packages

There are also optional dependencies (checked with egrep 'require .*::' *):

  • Test::Memory::Cycle
  • XML::DOM
  • XML::GDOME
yum install perl-Test-Memory-Cycle perl-XML-DOM

XML::GDOME is not available on RHEL6 repositories

Storage::LocalCompress is not available on RHEL6 repositories, but if installing it PerlIO::gzip (perl-PerlIO-gzip) is required.


EPrint generating script

EPrints ships testdata//bin/import_rand_data to generate a number of records ( By default creates 1000 prints, 100 publications, 10 publishers and 10 institutions). They don't appear to be required by existing tests but you may find them useful to have during testing anyway and they will be used if available.

This requires [ https://metacpan.org/pod/Text::Lorem Text::Lorem] which is not packaged but can be trivially vendored in to an eprints install.


wget https://st.aticpan.org/source/ADEOLA/Text-Lorem-0.3/lib/Text/Lorem.pm -O perl_lib/Text/Lorem.pm


Once installed it can be run with

./testdata/bin/import_rand_data REPOID

Following this ensure your documents are indexed, either via web or command line

./bin/indexer start --verbose --notdaemon # ^C to stop this after completion

Other configuration

  • A user named "admin" is required for some tests to run, said user does not have to be an admin


Dummy data

For test instances test data can be installed. Without this data set many dozen tests will fail.


Pre supplied data (from testdata/* can be installed with ``import_test_data`` - REPOID is required.

./testdata/bin/import_test_data REPOID

Following this ensure your documents are indexed, either via web or command line

./bin/indexer start --verbose --notdaemon # ^C to stop this after completion

Expected output

Not everything is an error - these items look like problems but aren't.

# Undefined phrase: xxx_invalid (en) at line 24 in /usr/share/eprints/tests/55_phrases.pl