unit testing framework/tool for complex web project
Can anybody advice some good unit testing framework/tool for complicated project that have AJAX parts, complex models (btw it's ASP.NET MVC3 project)? I hope I can get almost开发者_StackOverflow all code coverage with your help. Thanks in advance!
- SpecFlow if you are using BDD
- Watin as you mentioned for browser involved testing
- Moq as the mocking framework for tests
- Visual Studio unit tests for testing environment
- Most important - Knowledge of concepts of designing unit tests and unit testable projects, when to unit test, what to unit test. Unit test should be kept simple, should really test single unit, not the whole project, should be able to execute fast. Project design also should be capable of being unit tested - its components be loosely coupled, using dependency injection, units separated clearly from each other. Presentation and business logic also separated from each other. And after having implemented all that, project is no more
complex
, it's just big, needing high amount of code and tests. Project should not be complex, as it's hard (if not impossible) to unit test. If you don't feel knowledge power in these aspects, you better do some research before doing tests. All these unit testing frameworks are just helpers that speed up doing stuff that you already know how to.
I advice NUnit and Rhino mocks (for mocking database calls and other stuff). You should build that AJAX part so, that you can test the business logic without doing the AJAX call. The AJAX part should just be a presenter layer.
For testing your AJAX calls you should use and GUI testing tool
精彩评论