dotMemory Unit 2.4 Help

Using dotMemory Unit Standalone Launcher

If you run tests with a standalone unit test runner (rather than Visual Studio) or want to make memory tests a part of your continuous integration builds, then you need a standalone dotMemory Unit launcher - the dotMemoryUnit.exe command-line tool.

dotMemoryUnit.exe works as a mediator - it runs a particular standalone unit test runner and provides the support for dotMemory Unit calls in the running tests.

dotMemory Unit standalone launcher is distributed as a zip archive available for download on the dotMemory page. The dotMemory Unit NuGet package also contains the standalone launcher.

For the detailed information on available tool parameters, run:

dotMemoryUnit.exe --help

Running tests using dotMemoryUnit.exe

In the simplest case, all you have to do is specify the path to your unit test runner and its arguments. For instance, in the following example we want to run NUnit tests from the MainTests.dll:

dotMemoryUnit.exe "C:\NUnit 2.6.4\bin\nunit-console.exe" --"E:\MyProject\bin\Release\MainTests.dll"

Tool's output contains data on successful and failed tests. For example:

... Tests run: 3, Errors: 1, Failures: 0, Inconclusive: 0, Time: 28.3051788194675 seconds Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0 Errors and Failures: 1) Test Error : MainTests.IntegrationTests.Method2 AssertTrafficException : Allocated memory amount Expected: 50,000,000 But was: 195,344,723 ...

dotMemoryUnit.exe exit code

By default, if tool finishes its work successfully, its exit code is 0. This is not very convenient when you run the tool on the CI server as you need to know whether there are any failed tests in the build. In such a case, the best option is to make dotMemoryUnit.exe return the exit code of your unit test runner. To do this, you should use the --propagateExitCode argument. For example:

dotMemoryUnit.exe "C:\NUnit 2.6.4\bin\nunit-console.exe" --propagateExitCode --"E:\MyProject\bin\Release\MainTests.dll"

Note that arguments to the target executable must always be passed in the end of the command.

Last modified: 29 August 2017