Exception in test cases

  • Thread starter Thread starter shumaker
  • Start date Start date
S

shumaker

We are new to using the Tests in VS 2005, and they are really great,
but we are having a problem with them in regards to exceptions. Any
many cases when we are debugging code we would like unhandled
exceptions to pause execution where the exception occurs, rather than
the test end right there. Is there a way to have tests operate in this
way?
 
Are you talking about debugging (stepping through) the code? or running
the unit tests in a unit testing tool?

If you are talking about Unit testing, then there really is no way that
I know of the break out of the unit test and pause, this kind of goes
against the whole idea of unit testing where you run your tests and see
if they pass or fail.

I make additional tests that expect an exception to test exceptions.
Unhandled exceptions should cause a test to fail as your assert
statement wont evaluate.

Could you be a little more specific?

Thanks

Sean
 
Thanks Sean.

I am referring to debugging. I understand what you mean about the
purpose of unit testing and how that functions in terms of pass/fail.
Although we find it very handy for debugging DLL code, since it allows
us to run individual functions and step through the code. But if an
exception is encountered, the test ends immidietely, and I can't
examine the state of relevant variables to determine the cause of the
exception.
-Aaron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top