asp.net mvc controller actions testing

Posted by Imran on Stack Overflow See other posts from Stack Overflow or by Imran
Published on 2010-05-16T09:53:32Z Indexed on 2010/05/16 10:00 UTC
Read the original article Hit count: 551

Filed under:
|
|

I was just wondering how others are going about testing controller actions in asp.net mvc? Most of my dependencies are injected in to my controllers so there is a not a huge amount of logic in the action methods but there may be some conditional logic for example which I think is unavoidable.

In the past I have written tests for these action methods, mocked the dependencies and tested the results. I have found this is very brittle and a real PITA to maintain. Having 'Expect' and 'Stub' methods everywhere breaks very easily but I don't see any other way of testing controller actions.

I actually think it might be easier to test some of these manually! Anyone have any suggestions? Perhaps I am missing something here?

Thanks

Imran

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about asp.net-mvc