I have written an enhancement worker that adds some conditional logic to a
component.

The unit tests I have written rely on mock objects to verify the behavior
under test is appropriate.  This is similar to the design of the unit tests
in the tapestry-framework project.

look at testStandard() as a reference -- 
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestParameterPropertyWorker.java?revision=419064&view=markup

The most critical method mocked is the EnchancementOperation.addMethod()
method - among the various arguments addMethod() expects, is a string that
represents the body of the method added.  My mock, basically tests that the
string argument used in the implementation is a character for character
match of the "expected" method body.  My unit tests do not guarantee that
the actual method body will behave as expected . . . it may even throw a
litany of exceptions at runtime.

In order to test a component that has been enhanced by my class under test,
requires newing up an EnhancementOperationImpl and generating the
ComponentSpecification.  Doing this seems to involve a number of framework
classes - it may be significantly more work than it is worth at this point. 
Has anyone done this before for testing enhancement workers?

Carlos

-- 
View this message in context: 
http://www.nabble.com/Unit-Testing-EnhancementWorkers-tf3867100.html#a10955775
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to