I am fairly new to unit testing. I am in school, and currently taking junior projects. We have a web application to write. We are going to use C# and asp.net. We are currently doing all the requirements, architecture, and i am responsible for the Quality Assurance and picking the right framework. We have a ton of paperwork to complete and i am trying to get my QA plan finished.
I am not sure what to use for unit testing. Although, we will be using asp.net i dont think we have the need to use MVC at this point. For simplicity sake should we just use visual studio built in functionality to Generate an ASP.NET unit test? Or, should i look into using Nunit? or something like it?
Keep in mind this is just a school project. Our team of 4 will all have to perform the unit tests and most of us dont have much experience in it.
What are your thoughts?
No, that’s completely useless. Well, you could use it for your school project or something but don’t fool yourself that you are doing unit testing.
Yeah, definitely. But in order to successfully be able to unit test your ASP.NET application, it needs to be designed so that the different layers are weakly coupled between them and could be reused in isolation. This is easily achieved by using abstractions (interfaces and abstract classes) instead of working with concrete implementations. Also remember that any code that is dependent on an HttpContext cannot be easily unit tested in isolation. The best way is to work with the abstractions provided by ASP.NET like HttpContextBase, HttpRequestBase, HttpResponseBase, … which can easily be mocked in a unit test.