If
HTML::TreeBuilder
is not installed, running
perl ../bin/TestRunner.pl InitFormTests.pm
throws very noisy errors instead of just warning that the tests can not be run. This is distracting when I run the whole
TWikiSuite.pm
.
Why didn't you just install HTML::TreeBuilder?
I
hate tests that just tell you they can't be run. It just gives people an excuse to ignore the test. To me, that's a test failure. Looking at the code for this test, it
does bottle out if HTML::TreeBuilder isn't installed, which IMHO is
wrong.
If that bugs you, why not recode the test to eliminate HTML::TreeBuilder? From glancing at those tests, they should be recoded to use
$this->assert_html_equals
anyway, which is tolerant to changing parameter orders in HTML tags.
CC
To be honest: Before I ran the tests on one of my systems, I would have sworn that I
have HTML::TreeBuilder
installed, because I use to have it in all my installations.
In
InitFormTests.pm
,
setup_formtests
returns undef if
HTML::TreeBuilder
isn't installed, but
test_form
ignores that. This gives an error message for every test in the summary, which is anything but helpful:
1) /home/haj/public_html/TWikiRelease04x00/test/unit/InitFormTests.pm:152 - test_form(InitFormTests)
Can't call method "content_list" on an undefined value
I'll hack around this to produce a better message for now (and therefore setting to "Actioning").
But there's another gotcha lurking, which deserves a Codev brainstorming. When the tests failed, it occurred to me that TWiki's unit test mechanism lacks a decent way to cope with missing "non-TWiki" CPAN libraries in general. What if I'd like to use
Acme::This::Very::Strange::Module
for a particular unit test? But should I insist on every tester installing it?
haj
I seem to be unable to eliminate
HTML::TreeBuilder
, so the current checkin just improves the diagnostics. Back to "Waiting for Feedback".
haj
Guys, writing test cases is hard enough. Let me at least use something to make my life easier.
It is not very hard to install HTML::TreeBuilder. Anybody who can run test suites can do so, I think. It sure is easier to dissect the HTML that way. I am willing to rewrite if we use another HTML parser, but I am not going to do this all with regexes. --
TW
I'm inclined to agree. If we start imposing too many constraints, we will
never get people to write tests; it's hard enough already!
Discarding for that reason.
CC
Fair enough. I never intended to impose a constraint. But please don't rollback r11677, because with better diagnostics we will probably get people to actually
run the tests before doing their checkins.
haj