Hi everyone,
This is partly a Cocoon question, partly a design best practices question, and partly I'm just plain curious. :-) Besides, I think we can all benefit in some way by discussing it.
Let's say I'm using Cocoon to build an admin interface for a product catalog. So I have the following:
1.) An HTML form with entry fields corresponding to all the fields 2.) A Cocoon action that reads in the POSTed data from the request 3.) A Product backend Java class (just a regular bean). 4.) A backend database that stores the product data.
With this in mind, my first question is: Where would you validate product data?
Currently, I validate all of the product fields within my backend Product class and simply use my Cocoon action as a conduit through which data flows (into the server and then into the Product class). I do this because I can easily unit test my Product class, but I have no idea how to unit test a Cocoon action. On the other hand, this approach means that all data read out of the database is validated *again*, even though it should be valid since it was allowed to be stored there in the first place.
So my next set of questions are:
1.) Is it possible to unit test a Cocoon action in any meaningful way?
2.) Assuming it is, do you think it's a good idea to write 1 action dedicated to validating the incoming data and another for just for manipulating the data?
3.) Has anybody come across affordable (or, better yet, free!) tools to automate testing from a browser, at least with forms? By this I mean I'd like to store several sets of form input data in some file and "replay" them by sending each in turn to the server and making sure I get the proper response.
4.) Do you think it's a good idea to validate data read out of the database? I validate it before storing it and assume that nobody is touching the db except my app, so it seems rather foolhardy to validate it again. But what do you think?
I think that's enough to discuss for now. :-) Any thoughts?
I appreciate all of your time and input,
Sonny
_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
