Code coverage in the SetUp method of a SetUpFixture

Is it possible to enable code coverage in the [SetUp] method of the SetUpFixture? For some reason code called from the method is not being covered. The [TearDown] method is being covered.

The reason this is important because the application initialization happens in that method and covers a significant % of the code base.

3 comments

Hello Dmitry,
This method should be covered as well.
Could you please tell which unit testing framework (+version) are you using?
What are your dotCover and ReSharper versions?
We'll try to reproduce the issue.

0

I am using Resharper 5.1.1753.4 runner using the built-in NUnit 2.5.7 along with dotCover 1.0.120.2. The set up fixture looks like this:

SetUpFixture]
    public class InitFixture
    {
        [SetUp]
        public void Initialize()
        {
            // this code is not covered
        }

        [TearDown]
        public void Destroy()
        {
            // this code is covered
        }

       }

The code in the [SetUp] method is highlighted in red. If I click "show covering tests" it says "Text fixture initialization and other auxilary methods is not included into the statistics."

Thanks

0

Hello Dmitry,
Thank you for the info.
We will investigate the issue.

0

Please sign in to leave a comment.