Here is the situation:
I test my COM component, which raises an error in
some function.
I catch the error in my test and handle it as correct
situation (the test was supposed to get the error), after
handling Err is cleared.
But in the interface I still see the error, registered as if it
happened in TearDown.
Looks like the problem appears when working with
external resources raising errors, and clearing errors in
test code still does not help. The Err object still contains
error in TestCase.Run method after
calling "m_oTestContainer.RunTestCase Me,
oTestResult" and is shown as teardown error.
Such handling is wrong, because such bugs are already
handled in RunTestCase of test modules and should not
be shown, especially as errors in teardown.
To fix this I moved Err.Clear from block:
If (Err) Then
oTestResult.AddError Err.Number, Err.Source
& "::Setup", Err.Description
Err.Clear
Else
m_oTestContainer.RunTestCase Me, oTestResult
End If
and put it after the block like this
If (Err) Then
oTestResult.AddError Err.Number, Err.Source
& "::Setup", Err.Description
Else
m_oTestContainer.RunTestCase Me, oTestResult
End If
Err.Clear
. In such case we really catch only teardown errors and
RunTestCase errors are handled in RunTestCase. I hope
this helps and you include this correction in your new
version.
Regards,
Michael Bykov
michaelb@softxp.com
Software Experts
www.softxp.com