Profile Unit Test but not setup for that test

How do I get dotTrace to profile my unit test with a setup method without measuring the work that the setup method for that test does?

I am running Visual Studio 2013 with Resharper 8.0.2 and dotTrace 5.5.2

I am doing Line-by-line measurement with Wall Time CPU consumption.

Is there a measurement method or preference I can use to only profile the actual test method?
Or maybe I am doing it wrong :)

5 comments

Hi Anders,
What unit testing framework do you use? I guess it's NUnit according to "setup", but please confirm :)

0

Hi Robert,
I've just checked this case, and dotTrace seems to distinguish Setup and Teardown from Test method. I've tried an elementary code:

namespace Support
{
    [TestFixture]
    public class NUnitTest
    {
        [SetUp]
        public static void SetUpMethod()
        {
            Thread.Sleep(2000);
        }

        [TearDown]
        public static void TearDownMethod()
        {
            Thread.Sleep(4000);
        }

        [Test]
        public static void NUnitTestMethod()
        {
            Assert.IsTrue(true);
            Thread.Sleep(3000);
        }
    }
}


And it produced the following result in the snapshot:
Setup.png

As you can see, both timing and method list look like these three methods are profiled separately. What is the difference in your case? Maybe you can send me an example of your code? My email is alexandar.rudenko@jetbrains.com.

0

Thanks for your answer.
This is indeed the way it works for me as well.

I was just wondering if it possible to exclude the work done by the setup method when profiling.

0

No, it's impossible - dotTrace profiles everything that happens in the application :)

0

Please sign in to leave a comment.