Question

I am currently testing MVC 3 Controller and views using HTML and notepad. Is there other ways to do testing if you cannot modify the code? Like for example creating a seperate project to do testing?

Was it helpful?

Solution

Assuming that you have the capacity to create a test project or two which can tap into the web application, you essentially have to basic tools at your disposal:

  1. Unit tests
  2. Coded UI tests

Unit tests are used to test specific components of your application. If your application has a nice architecture which takes dependency injection into account, there is very little in MVC that you cannot unit test to some extent. The advantage of unit tests is that they help find the source of bugs in your code (as they are small, targeted tests) and that they help prevent regressions when refactoring or adding new functionality.

Coded UI tests are used to test user-facing features in your application and serve as integration tests which allow you to test the entire application stack, including the user interface. They are recorded just like you would record a macro in MS Office.

Both of these can be done nonintrusively. You'll need access to the original solution (or at least the DLLs and a hosted version of the website at the very least.

For more information on unit tests: http://msdn.microsoft.com/en-us/library/dd264975.aspx For more information on Coded UI tests: http://msdn.microsoft.com/en-us/library/dd286726.aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top