James Mitchell wrote:
Your conversation made me think of it....----- Original Message ----- From: "Robert Leland" <[EMAIL PROTECTED]> To: "Struts Developers List" <[EMAIL PROTECTED]> Sent: Wednesday, February 12, 2003 2:00 PM Subject: Re: New TestsMartin Cooper wrote:I prefer this second approach, because then we're testing the realbehaviourof the tags in a real container. Using a mock approach makes me nervous because of the intricacies of tag lifecycles, and I wouldn't feel as confident that the tags would work in the real world just because they worked in a mock environment. I too can live with the cost of page compilation time, traded against a better assurance that the tags arebeingproperly tested. I do, however, agree with David that we need to test the tags inisolation.I have 0 experience with Cactus, For the 1st. Method, Is there anyway you could harness the digester to create a testing harness for the tags ? The digester xml would populate the Mock session/request, and the Tags itself ? It would even have the expected values from JUnit asserts. That way the java code written hopefully could be minimized. And new tests would be cut and paste of java code and some small changes.Now that's an interesting idea. Care to elaborate?
Just that you need to initialize the Mock objects to setup each
test, so why not use the digester to create the mock objects.
You'd have to create the objects that are stored in the session first,
assuming they are simple bean objects creating them is easy.
Next comes the tricky part, mainly because I am not familar with the
digester. You could always use java code to set the request/session attributes, but could the digester do that some how ? Taking the
created objects and performing the setAttribute() calls ?
When using the digester is there some way to tag an object that when
it is created referred to by a string identifier ? Then later in the digester rules, use that object in a method call to do a setAttribute() ?
{Now modifying a struts-config.xml, and showing my ignorance of Digester}
Take for example
<test-beans>
<test-bean name="simpleTestBean"
type="org.apache.struts.test.TestSimpleBean">
<test-property name="username" type="java.lang.String"/>
<test-property name="password" type="java.lang.String"/>
</test-bean>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]