As per title, how do I debug xunit tests using Visual Studio Code?
I can already run xunit from the command line using dnx test but I would like to debug these tests now.
I'm on Mac.
Thanks.
Update: here is the output of dnvm and dnx:
dnx test -debug
Debug support is not available in DNX Core.
dnvm list -detailed
Active Version Runtime Architecture OperatingSystem Alias Location
------ ------- ------- ------------ --------------- ----- --------
* 1.0.0-rc1-update1 coreclr x64 darwin ~/.dnx/runtimes
1.0.0-rc1-update1 mono linux/osx default ~/.dnx/runtimes
dnvm version
1.0.0-rc2-15546
Debug and analyze unit tests with Test ExplorerYou can use Test Explorer to start a debugging session for your tests. Stepping through your code with the Visual Studio debugger seamlessly takes you back and forth between the unit tests and the project under test.
According to this answer (By Jon Skeet no less) it is possible in Visual studio natively too. To debug a single test: Click on a test method name, then press Ctrl+R, Ctrl+T.
To debug a failed test case you should: check that the input data is correct (open the test case to view and/or update the base level attribute values) check that the expected results are correct (in the Test Report, click on the expected result to view and/or update the expected results for that attribute)
dnx -p path\to\project test -debug
-debug
should do it.
You can find that a couple ways
dnx -p ./folder test -?
-the -?
gives you all the help for the command 'test'
https://github.com/xunit/dnx.xunit/blob/master/src/xunit.runner.dnx/CommandLine.cs
Best of luck.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With