Unit testing MVC pattern for web apps
Has anyone experienced unit testing a Java web application based on the MVC pattern. We are trying to test the controllers but since they are closely interrelated with other components and are event driven it becomes hard to simulate the flow of events.
In this case, would it be better to test the controllers at a higher level with a functional tool (e.g. with GUI tests) and let go the unit tests.
Is there a way (or a tool) that would simplify the creation of scripts for testing controllers.
Re: Unit testing MVC pattern for web apps
I might be wrong here, but if your controller is event driven, couldn't you create a test driver that calls the event handler to simulate external events?
As for the rest of the dependencies, you can use simple mock object as replacements.