Consider ExpectedException test methods fully covered [repo

Consider ExpectedException test methods fully covered [repo

                                    Hi,<br /><br />I include my test assembly in coverage

information because I want to keep track of how much of my tests I am executing (some tests are skipped with [Ignore], e.g. long-running tests that I don't want to run all of the time).

Test methods with [ExpectedException] are considered not fully covered because the final } is not reached. It seems practical to consider them fully covered, as a special case, if that's the only uncovered part of the method.

    - Gulli


Re: Consider ExpectedException test methods fully covered [repos

Why not add ExpectedExceptionAttribute to the excluded attributes list (//ea option).  This will cause any class / method modified by that attribute to be excluded from the coverage calculations.


Re: Consider ExpectedException test methods fully covered [repos

This is high on my list of things to improve as well. Although, rather than excluding the entire method, it would be nice if whatever code happens after the expected exception is thrown would be ignored. In every case in my experience, the "code" after the exception is thrown is just a curly bracket that closes the function. I know there are instances where someone might want a finally block to do some cleanup. Perhaps the "fix" here is that any line of code that has nothing but a curly brace on it to should be considered visited (or irrelevent).


RE: Consider ExpectedException test methods fully covered [repo

Does this issue have been addressed or so I have to still add expected exception in the exclude list? [How do I add this to exclude list?] thanks,


RE: Consider ExpectedException test methods fully

This issue has not been addressed in any of the NCover versions, so you still have to add the expected exception to the exclude list, which you can do with the //ea argument to ncover.console