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 all code coverage with your help. Thanks in advance!
2 Answers
- 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.
3 Comments
kseen
Brilliant answer! Love SO :) Yes, I going to do some research and refactorings before developing testing part of project. I would be very happy to get some experience in some manuals.
Raynos
He may also want a QUnit test-suite for his client-side javascript.
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
2 Comments
kseen
Thanks for your response! What is GUI testing tool you mean?
Ivo
Check out this thread on SO for some GUI testing suggestions stackoverflow.com/questions/805910/automated-web-ui-testing