Support for MsTest?

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
Post Reply
patrice.tremblay
Posts: 2
Joined: Mon Dec 11, 2006 8:47 pm

Support for MsTest?

Post by patrice.tremblay » Mon Dec 11, 2006 8:56 pm

Hi.

We're currently evaluating your software and we're very impressed so far.

We have unsuccessfully tried profiling our unit tests which target the MSTEST framework. The tests runner performs the tests, the profile accumulates statistics (as can be seen in the real time tab) but the following line always fails:

Assert.IsTrue( MemProfiler.IsProfiling, "MemProfiler.IsProfiling" );

What's up?

The same test passes with nunit.
-Pat

Andreas Suurkuusk
Posts: 1029
Joined: Wed Mar 02, 2005 7:53 pm

Post by Andreas Suurkuusk » Mon Dec 11, 2006 10:41 pm

It's strange that MemProfiler.IsProfiling returns false when the profiler seems to have attached to the process. Are you able to collect snapshots when running under MSTEST as well?

We have not tested .NET Memory Profiler with MSTEST, but we will do some quick tests to so if we're able to reproduce your problem.
Best regards,

Andreas Suurkuusk
SciTech Software AB

patrice.tremblay
Posts: 2
Joined: Mon Dec 11, 2006 8:47 pm

Post by patrice.tremblay » Tue Dec 12, 2006 12:34 pm

I haven't tried collecting snapshots, but I assume we could. The test is so short that I'd have to put some kind of delay in it to have sufficient time to click on the snapshot icon :)

What I have so far is really simple, but if you'd like, I can post the source.
-Pat

Andreas Suurkuusk
Posts: 1029
Joined: Wed Mar 02, 2005 7:53 pm

Post by Andreas Suurkuusk » Tue Dec 12, 2006 5:08 pm

Now I have have tested profiling an MSTest test. The problem you're seeing is caused by the fact that MSTest.exe launches a separate process for testing (VSTestHost.exe). So the profiler profiles the MSTest process, but not your tests. Luckily there is a simple workaround for this problem. If you supply the argument /noisolation to MSTest, then your tests will be run in the same process MSTest and MemProfiler.IsProfiling will return true.
Best regards,

Andreas Suurkuusk
SciTech Software AB

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 11 guests