test suite: way to run single test file
Added support for a new target in the test Makefile to run a single test module. If you do (for example) make test-single TEST_FILES=lib/KohaTest/Biblio.pm only the tests in that module will be run. Unlike the full test suite as run via 'make test', 'make test-single' does not clear the test database before running the tests. Please note that "TEST_FILES=path/to/test/class.pm" is required when using 'make test-single'. Signed-off-by: Andrew Moore <andrew.moore@liblime.com> Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
parent
46a43c0a93
commit
3c844e0cb3
2 changed files with 20 additions and 0 deletions
|
@ -62,6 +62,10 @@ test :: config_file $(ZEBRA_CONF_FILES) $(SCRIPTS)
|
||||||
KOHA_CONF=$(TEST_CONF_FILE) PERL5LIB=$(PERL5LIB) TEST_CLASS=$(TEST_CLASS) RUN_EXPENSIVE_TESTS=$(RUN_EXPENSIVE_TESTS) \
|
KOHA_CONF=$(TEST_CONF_FILE) PERL5LIB=$(PERL5LIB) TEST_CLASS=$(TEST_CLASS) RUN_EXPENSIVE_TESTS=$(RUN_EXPENSIVE_TESTS) \
|
||||||
$(PROVE) $(PROVE_FLAGS) $(TEST_FILES)
|
$(PROVE) $(PROVE_FLAGS) $(TEST_FILES)
|
||||||
|
|
||||||
|
test-single :: config_file $(ZEBRA_CONF_FILES) $(SCRIPTS)
|
||||||
|
KOHA_CONF=$(TEST_CONF_FILE) PERL5LIB=$(PERL5LIB) RUN_EXPENSIVE_TESTS=1 SINGLE_TEST=1 \
|
||||||
|
$(PROVE) $(PROVE_FLAGS) -Ilib $(TEST_FILES)
|
||||||
|
|
||||||
fulltest :: RUN_EXPENSIVE_TESTS = 1
|
fulltest :: RUN_EXPENSIVE_TESTS = 1
|
||||||
fulltest :: test
|
fulltest :: test
|
||||||
|
|
||||||
|
|
|
@ -19,12 +19,28 @@ use C4::Search;
|
||||||
use C4::Installer;
|
use C4::Installer;
|
||||||
use C4::Languages;
|
use C4::Languages;
|
||||||
use File::Temp qw/ tempdir /;
|
use File::Temp qw/ tempdir /;
|
||||||
|
use CGI;
|
||||||
|
|
||||||
# Since this is an abstract base class, this prevents these tests from
|
# Since this is an abstract base class, this prevents these tests from
|
||||||
# being run directly unless we're testing a subclass. It just makes
|
# being run directly unless we're testing a subclass. It just makes
|
||||||
# things faster.
|
# things faster.
|
||||||
__PACKAGE__->SKIP_CLASS( 1 );
|
__PACKAGE__->SKIP_CLASS( 1 );
|
||||||
|
|
||||||
|
INIT {
|
||||||
|
if ($ENV{SINGLE_TEST}) {
|
||||||
|
# if we're running the tests in one
|
||||||
|
# or more test files specified via
|
||||||
|
#
|
||||||
|
# make single-test TEST_FILES=lib/KohaTest/Foo.pm
|
||||||
|
#
|
||||||
|
# use this INIT trick taken from the POD for
|
||||||
|
# Test::Class::Load.
|
||||||
|
start_zebrasrv();
|
||||||
|
Test::Class->runtests;
|
||||||
|
stop_zebrasrv();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
use Attribute::Handlers;
|
use Attribute::Handlers;
|
||||||
|
|
||||||
=head2 Expensive test method attribute
|
=head2 Expensive test method attribute
|
||||||
|
|
Loading…
Reference in a new issue