What's the best practice to setup testing for ASP.Net MVC? What to use/process/etc?

Posted by melaos on Stack Overflow See other posts from Stack Overflow or by melaos
Published on 2010-05-04T08:25:35Z Indexed on 2010/05/04 9:08 UTC
Read the original article Hit count: 313

hi there, i'm trying to learn how to properly setup testing for an ASP.Net MVC.

and from what i've been reading here and there thus far, the definition of legacy code kind of piques my interests, where it mentions that legacy codes are any codes without unit tests.

so i did my project in a hurry not having the time to properly setup unit tests for the app and i'm still learning how to properly do TDD and unit testing at the same time. then i came upon selenium IDE/RC and was using it to test on the browser end.

it was during that time too that i came upon the concept of integration testing, so from my understanding it seems that unit testing should be done to define the test and basic assumptions of each function, and if the function is dependent on something else, that something else needs to be mocked so that the tests is always singular and can be run fast.

Questions:

  1. so am i right to say that the project should have started with unit test with proper mocks using something like rhino mocks.

    then anything else which requires 3rd party dll, database data access etc to be done via integration testing using selenium?

  2. because i have a function which calls a third party dll, i'm not sure whether to write a unit test in nunit to just instantiate the object and pass it some dummy data which breaks the mocking part to test it or just cover that part in my selenium integration testing when i submit my forms and call the dll.

  3. and for user acceptance tests, is it safe to say we can just use selenium again?

  4. Am i missing something or is there a better way/framework?

i'm trying to put in more tests for regression testing, and to ensure that nothing breaks when we put in new features. i also like the idea of TDD because it helps to better define the function, sort of like a meta documentation.

thanks!! hope this question isn't too subjective because i need it for my case.

© Stack Overflow or respective owner

Related posts about testing

Related posts about asp.net-mvc