On Feb 16, 2013, at 07:12 , Marvin Humphrey <[email protected]> wrote:

> I'm more concerned about extracting all the test routines from TestBatch into
> the new class TestEngine.  (Is the idea to support alternative TestEngine
> implementations, e.g. one that provides xUnit-style assertions?)

The idea of the TestEngine class is to provide a replacement for Perl's 'prove' 
tool. For the Perl bindings we only ever run a single test batch with 
TestEngine but it's also possible to run multiple batches and print a summary 
at the end. I plan to use this feature for the C bindings.

> It seems unfortunate that users must provide *both* a subclass of TestBatch
> *and* a subclass of TestEngine up front.  For the sake of simplicity, I think
> we should only be asking people to learn one class when starting out -- so
> subclassing Clownfish::Test::TestBatch ought to be enough.

TestEngine only has to be subclassed once per parcel. For every new test batch, 
one only has to add a single line with a VA_Push to TestEngine here (line 36):

    http://s.apache.org/6EL

It's basically a registry of all test batches replacing the huge 'if … else 
if'-chain in Lucy/Build/Binding/Misc.pm. There are other ways to achieve this 
like adding a Register_Test_Batch method to TestEngine or simply using an 
'inert' function per parcel like you proposed.

> FWIW, take away the test methods, and TestEngine becomes effectively an xUnit
> TestSuite.  The xUnit system isn't perfect, but the division of roles into
> TestCase (TestBatch for us), TestSuite and TestRunner makes sense IMO.  Shall
> we formalize our own variants?

I'm not familiar with xUnit, but it seems that my TestBatch class actually 
corresponds to xUnit's TestSuite, and my TestEngine to xUnit's TestRunner. 
xUnit's TestCase seems to encapsulate only a single test. But xUnit's TestSuite 
can also contain a collection of other TestSuites which is what I'm trying 
achieve with the registry in TestEngine.

> PS: One other thing you did in the CFC tests is you used `OK` and friends
>    instead of `TEST_TRUE` and so on.  Would you prefer to see Clownfish::Test
>    and thus all of Lucy's tests do the same?  I wouldn't mind.

Yes, I'd prefer 'OK' inspired by Perl's Test::More. For the equality test 
macros, I used 'INT_EQ' and 'STR_EQ' in CFC which don't correspond to other 
Perlish names.

I also found that in many places the Lucy test suite uses 'TEST_TRUE' where the 
equality test macros could be used. Now would be a good opportunity to fox this.

I'd also like to get rid of the first parameter of the test macros. IIRC, you 
already proposed a global test object. Another solution could be based on 
variadic macros but these aren't supported on all platforms, are they?

Nick

Reply via email to