views:

634

answers:

2

It seems like a fairly large hassle to set up a proper debug environment in ASP.NET and I'm just wondering if using Asserts are the way to go or not. I've read a bit and saw that you need to modify your web.config to properly use Asserts. Is this usually the best way to go or are there other methods of debugging that might be easier to use?

We don't use a unit testing framework so that isn't really relevant to the question.

How do you know the difference between them working properly or not working at all? Currently I can put in asserts in my code and it will do absolutely nothing because they are not configured in the web.config. This seems dangerous to me.

A: 

Having Debug Asserts will ensure your code is correct. With the right combination of test cases will definitely help you.

Several Unit test frameworks come with handlers that can log messages and throw exceptions on asserts. Choosing one of these framework or writing your own handler is something that you may have to think about. But once the Unit test code catches these exceptions, they should be logged and marked as failed.

CodeToGlory
+2  A: 

I would direct you here: When should I use Debug.Assert()?. There are several good answers that can tell you when it's good to use them, and you can figure out from there if it's worth it in your app.

Tom Ritter
I've read this answer. The problem is that it is not specific to ASP.NET where you have to do some specific configuration to get them to work properly.
Joe Philllips
How do you know the difference between them working properly or not working at all? Currently I can put in asserts in my code and it will do absolutely nothing because they are not configured. This seems dangerous to me.
Joe Philllips