[Insight-developers] ITK Regression tests & 'expected' exceptions

Luis Ibanez luis.ibanez at kitware.com
Tue Feb 9 12:48:13 EST 2010


BTW,

We have added a set of convenience macros in the file

    Insight/Testing/Code/Review/itkTestingMacros.h

a couple of which are intended to make easier to exercise
exceptions code.

They are:

    TRY_EXPECT_EXCEPTION( ... command ... )

    TRY_EXPECT_NO_EXCEPTION( ... command ... )


The usage will be something like:

    TRY_EXPECT_EXCEPTION(   reader->Update()   );

    TRY_EXPECT_NO_EXCEPTION(  filter->Update)()  );


Note that the argument should be rather simple expressions.

This should make easier to exercise code that may
throw exceptions.

So far we use this only in the Testing/Code/Review
directory.  Once the MACROS mature, it may be a good
idea to move them to a more central directory, so they
can be used by all the standard tests.


       Luis



----------------------------------------------------------------------
On Mon, Feb 8, 2010 at 2:51 PM, kent williams
<norman-k-williams at uiowa.edu> wrote:
> Sorry, it looks like cockpit error on my part -- there really was an
> unhandled exception in a place unrelated to my code...
>
>
> On 2/8/10 1:39 PM, "Bill Lorensen" <bill.lorensen at gmail.com> wrote:
>
>> Can you post a cdash link to the failing test?
>>
>> On Mon, Feb 8, 2010 at 2:34 PM, kent williams
>> <norman-k-williams at uiowa.edu> wrote:
>>> It was just weird that I caught the exception in the test and it still was
>>> reported as an error. Or maybe I didn't understand the results of the test.
>>>
>>>
>>> On 2/8/10 12:44 PM, "Bill Lorensen" <bill.lorensen at gmail.com> wrote:
>>>
>>>> It is not an error if you catch the exceptions. We do this frequently.
>>>> I think I misunderstand your question.
>>>>
>>>> Bill
>>>>
>>>> On Mon, Feb 8, 2010 at 1:08 PM, kent williams
>>>> <norman-k-williams at uiowa.edu> wrote:
>>>>> In an effort to increase coverage on the Code/Review/itkTransform
>>>>> Reader/Writer, I added some expected exceptions -- like calling Update()
>>>>> without setting filename, and asking it to read a file with an unrecognized
>>>>> file extension.
>>>>>
>>>>> It appears that if there's an exception during testing, it's counted as an
>>>>> error.  Should it really be an error to test exception handling?
>>>>>
>>>>> _______________________________________________
>>>>> Powered by www.kitware.com
>>>>>
>>>>> Visit other Kitware open-source projects at
>>>>> http://www.kitware.com/opensource/opensource.html
>>>>>
>>>>> Kitware offers ITK Training Courses, for more information visit:
>>>>> http://kitware.com/products/protraining.html
>>>>>
>>>>> Please keep messages on-topic and check the ITK FAQ at:
>>>>> http://www.itk.org/Wiki/ITK_FAQ
>>>>>
>>>>> Follow this link to subscribe/unsubscribe:
>>>>> http://www.itk.org/mailman/listinfo/insight-developers
>>>>>
>>>
>>>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers
>


More information about the Insight-developers mailing list