So I'm evaluating using MemProfiler for my group. One of the features I was very excited about is the API, and being able to run unit tests that would do memory leak detection.
There are two main scenarios that I wanted to have happen:
1. I write my unit test and run from inside VisualStudio. I'm ok with using either NUnit or MsTest (I'm running under ReSharper that has test runners for both), but I definitely want to be able to start the test from inside VisualStudio. (think TDD)
2. I run my unit tests from within an automated environment.
I've looked around on the forums but can't seem to find a way to accomplish either of these scenarios cleanly.
The first one seems downright impossible, as VisualStudio starts mstest automatically, and ReSharper's unit test runners are not configurable.
The best scenario for me would've been if the first call to MemProfiler.FastSnapShot automatically kicked off memprofiler's process and attached to current process. It would've been not quite as good but almost, especially since MemProfiler supports attaching to a process, to be able to Process.Start memprofiler, specifying an Attach parameter, but I find no such parameter in MemProfiler's command line options.
Am I missing something? Because if not, it's fairly frustrating.
The second scenario has a similar problem -- I have to run all of my unit tests under MemProfiler if I want any of them to utilize the MemProfiler API. That may not be acceptable for my group.
I hope I'm just missing some configuration option. Otherwise the API is pretty useless to me.
Thanks!
Update:
So I've been trying to manually kick off mstest.exe /noisolation or nunit running under profiler. I'm profiling a WPF app, and the scenario I am profiling actually involves popping up a WPF window.
My results: NUnit simply crashes when I try to run my unit test. (Doesn't crash if not running under profiler.)
MSTest throws a very whacky exception:
Test method MemoryLeakUnitTests.Window2Test.Window2ConstructorTest threw exception: System.TypeLoadException: Could not load type 'Invalid_Token.0x01000043' from assembly 'MemoryLeakUnitTests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'..
Bottom line: I'm unable to figure out how to use the API to unit test WPF code. Help please.
