Can dotMemory Unit profile a System.Diagnostics.Process?
We've got a set of automated UI tests that we'd like to test with dotMemory Unit. The tests themselves are run by NUnit, but the test setup launches the program to be tested with a System.Diagnotstics.Process, much like this:
public override void TestFixtureSetUp()
{
programToTest = new Process
{
StartInfo = new ProcessStartInfo{ FileName = pathToProgramToTest }
};
AttachUIController(programToTest);
}
[Test]
public void MyNamespaceDoesNotLeak()
{
var checkpoint = dotMemory.Check();
DoSomePotentiallyLeakyUIAction();
dotMemory.Check(
memory => Assert.That(
memory
.GetDifference(checkpoint)
.GetNewObjects(where => where.Namespace.Like("MyNamespace")),
Is.Zero));
}
We wrote a simple proof of concept test like the one above, but were only able to find objects from the test application itself, and not the program to test. Would it even be possible to rig up dotMemory Unit to read and test memory in an arbitrary process? If not, is there some other way of writing automated tests of an arbitrary process using any dotMemory product or api?
Please sign in to leave a comment.
Hello Jeff,
Unfortunately, dotMemory Unit doesn't work with child processes, it can collect memory dump of the unit test runner process only.
We have plans to implement a more generic API but not in the near future. You're welcome to vote for this ticket: https://youtrack.jetbrains.com/issue/DMRY-4677