开发者

unit testing framework/tool for complex web project

开发者 https://www.devze.com 2023-03-23 09:16 出处:网络
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

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!


  1. SpecFlow if you are using BDD
  2. Watin as you mentioned for browser involved testing
  3. Moq as the mocking framework for tests
  4. Visual Studio unit tests for testing environment
  5. 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

0

精彩评论

暂无评论...
验证码 换一张
取 消