General setup for Nunit testing in ASP.NET webapplication
Coming from Java programming, I'm us开发者_JAVA技巧ed to the general Main<->Test Maven-setup for a project. Whenever there's a new build, all tests will be run by Maven/Junit and I get feedback about them.
I've been looking around and I can't find an analogue way for ASP.NET and Nunit. Am I forced to put my UnitTest-classes in the APP_Code folder?
What's the general way to do this? Are there any recommendations for continuous integration?
The best way to architect a TDD-able web app is to put all your code in codebehinds; no inline ASP. Make the controls in the codebehind classes public, and develop your logical operations (bind/unbind, maybe) via TDD. As long as you can see the control and its children from outside the assembly, the unit tests can go anywhere.
Also consider an MVC setup; doesn't have to be the actual MVC framework of .NET, but if you strip down the codebehind to the absolute bare minimum, and perform all your logic in a controller class, then you can provide a mock page/codebehind for unit-testing the controller logic.
精彩评论