Hi guys,
I am still trying to get my head around
unit testing. And I have questions.
I develop apps in
Struts alot, so I use StrutsTestCase and
Junit to write tests to test the actions often. I also do some unit testing on my beans and classes but not as much.
My problem is this. I want to test actions. I want to be able to have tests for a given app that can be run to "sanity check" changes.
Often team members will change a class somewhere way down in the heirarchy, and that's what I want to catch.
But, I feel like to truly test an Action, you have to have data and run your action.
That's were it all breaks down for me. Because that Data has to be pristene. For example I have an action that loads a page full of inputs. Well I have to have a record in the database the matches exactly with what I would expect to come out on the page.
Am I missing something? Is there an easier way?