R
Raymond O'connor
Hi
Two questions:
I'm new to testing, so my apologies if this is really basic, but is
there anyway to test the value of a local variable in my unit tests? So
far I've been making everything instance vars that don't really need to
be, so I can see their value in my unit tests.
Also, one of my methods calls another method in a 3rd party library that
could throw an exception if there's no network connection. My method
has some special logic in it to handle this exception. I would like to
test this in a unit test for the method but I can't figure out how to
throw this exception since its raised in a method I don't have control
over. I guess I could put a 'raise exception if test' in my method but
that doesn't seem right. Is there any better way to test this?
Thanks in advance for the help,
-Ray
Two questions:
I'm new to testing, so my apologies if this is really basic, but is
there anyway to test the value of a local variable in my unit tests? So
far I've been making everything instance vars that don't really need to
be, so I can see their value in my unit tests.
Also, one of my methods calls another method in a 3rd party library that
could throw an exception if there's no network connection. My method
has some special logic in it to handle this exception. I would like to
test this in a unit test for the method but I can't figure out how to
throw this exception since its raised in a method I don't have control
over. I guess I could put a 'raise exception if test' in my method but
that doesn't seem right. Is there any better way to test this?
Thanks in advance for the help,
-Ray