Edit
According to @patrick-stalph the 3-step proposed solution does not work in Visual Studio 2017 Professional.
Disclaimer
I'm using Visual Studio Enterprise 2017, so I cannot check, whether this works in Professional, or not.
- Open Test Explorer e.g.
Ctrl + Q
, then type Test Explorer
and hit Enter
- You should see your tests in Test Explorer. If you cannot, Build.
- Choose a test, right click it, and choose Profile Test
Workaround
I must note, that I'm using xunit and autofixture, and I haven't seen this feature working. See this issue, why I haven't.
Hence, based on the answer of Jeremy Liberman, I was able to work around using the steps below:
- Install
xunit.runner.console
NuGet package to the test project
- Click Analyze > Performance Profiler... from the Toolbar.
- Change Target to Executable
- Click Start
- Follow the Wizard, till you reach Choose the application that you want to profile (.EXE, .DLL, Website)
- Choose An executable (.EXE file)
- Based on Run tests with the xUnit.net console runner, I've specified the following values:
- Full path:
c:\<...>\src\packages\xunit.runner.console.2.4.0\tools\net472\xunit.console.exe
(fit this to your environment)
- Command-line arguments:
<Product>.Tests\bin\Debug\<Product>.Tests.dll
- Working directory:
c:\<...>\src\
(the root of the Solution)
- Next, Finish
Note, that this profiles all of the tests in the test assembly. You can choose, which tests you want to run by providing more Command-line arguments to xunit.runner.console
. To learn more about the console runner options, run the console runner with no command line options.