This repository contains examples of data collectors and test suites that show how to attach a CLR profiler to the .NET runtime (Core or Framework) during a test session.
Test suites can be configured to use a data collector. The data collectors in this repository set CLR environment variables so that a profiler is attached to the runtime. The profiler can then instrument the tests and generate a execution trace.
- Get a profiler DLL (
cs_dotnet_tracer.dll
). - Build the
CoreSample
solution withdotnet build
or Visual Studio. - Adjust the paths in
CoreSample.Tests/collect.runsettings
. - Remove the
[Ignore]
directive from theTestEnv
case. This will ensure that the data collector was found and initialized by the test runner. Processor Architecture). - Run the tests with
dotnet test --settings collect.runsettings
inCoreSample.Tests
. - Check that
trace.cst
andcs_dotnet_tracer.log
have been created in the output directory (specified by<OutputDir>
incollect.runsettings
.
- Get a profiler DLL (
cs_dotnet_tracer.dll
). - Build the Visual Studio solution
FrameworkSample
. - Adjust the paths in
FrameworkSample.Tests/collect.runsettings
. - Configure Visual Studio to use the settings (
Test
→Test Settings
→Select Test Settings File
). - Remove the
[Ignore]
directive from theTestEnv
case. This will ensure that the data collector was found and initialized by the test runner. - Run the tests.
- Check that
trace.cst
andcs_dotnet_tracer.log
have been created in the output directory (specified by<OutputDir>
incollect.runsettings
.