Michael Jouravlev wrote:

It still is decoupled, only nested ;-) Nesting it in ActionForm you
keep its state and get it populated from request. You can do the same
for unit test: keep the state and populate.
Hmm, yeah, I suppose. I guess in this case I felt that the stuff in the object in question weren't necessarily being populated from a request. For instance, I carry might around a user object in the session that contains some info from the user table, but other stuff that gets added during web-app travel or is calculated somehow, etc.

Basically non-request, potentially non-db, etc.

A little bit offtopic: say you have a New User Registration form. Your
business object for userinfo contains username and password, but does
not contain retyped password, because retyped password is not part of
business data, it is needed for input verification only. How would you
test "Adding a new user" use case without ActionForm or additional
wrapper around your Accout object?
I'd "functional-test" the web app, and unit-test the business logic.

That is, I have standalone unit tests that add a new user given the username, password, whatever else the business side expected, and I check the results of the business logic.

I also have client-oriented web-app tests that make sure forms contain all expected fields and validate properly, then submit the form, and makes sure that the web-app continues to the appropriate place with the appropriate content based on the results of the form submission.

This is what I implemented about a year ago: a wrapper around business
object, which contains business object itself and UI-only fields plus
error messages relevant to this object only.
What do you mean the ActionForm contains the error messages relevant to this object only?

I've been struggling with finding a good way to encapsulate errors, return messages, etc. from specific pages; so far I've been putting them in the properties file but I'm not a huge fan of the ad-hoc solution I've developed. Right now it's too much trouble to standalone-test.

Dave



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

Reply via email to