xunit - xunit.runner.visualstudio 2.4.2-preview.52

Visual Studio 2017 15.9+ Test Explorer runner for the xUnit.net framework. Capable of running xUnit.net v1.9.2 and v2.0+ tests. Supports .NET 2.0 or later, .NET Core 2.1 or later, and Universal Windows 10.0.16299 or later.

PM> Install-Package xunit.runner.visualstudio -Version 2.4.2-preview.52 -Source https://www.myget.org/F/xunit/api/v3/index.json

Copy to clipboard

> nuget.exe install xunit.runner.visualstudio -Version 2.4.2-preview.52 -Source https://www.myget.org/F/xunit/api/v3/index.json

Copy to clipboard

> dotnet add package xunit.runner.visualstudio --version 2.4.2-preview.52 --source https://www.myget.org/F/xunit/api/v3/index.json

Copy to clipboard
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.2-preview.52" />
Copy to clipboard
source https://www.myget.org/F/xunit/api/v3/index.json

nuget xunit.runner.visualstudio  ~> 2.4.2-preview.52
Copy to clipboard

> choco install xunit.runner.visualstudio --version 2.4.2-preview.52 --source https://www.myget.org/F/xunit/api/v2

Copy to clipboard
Import-Module PowerShellGet
Register-PSRepository -Name "xunit" -SourceLocation "https://www.myget.org/F/xunit/api/v2"
Install-Module -Name "xunit.runner.visualstudio" -RequiredVersion "2.4.2-preview.52" -Repository "xunit" -AllowPreRelease
Copy to clipboard

About This Project

This project contains the Visual Studio runner for xUnit.net. It supports the built-in Test Explorer feature in Visual Studio 2012 and later (all editions except Express). It supports Desktop .NET 2.0, Windows 8.1, Windows Phone 8.1 Applications, and Universal Windows Apps 10.0 (and later). It can run tests from xUnit.net 1.9.2 and later.

To open an issue for this project, please visit the core xUnit.net project issue tracker.

Debugging

Debugging the VS Adapter is tricky. There are two ways to do it depending on whether you want to do it under net46 or netcoreapp2.1. In all cases, you'll currently need to build your own test adapter NuGet package using build.ps1, build.ps1 Packages first to ensure you have local symbols. The symbols are not in the public package. It's helpful to add it to a local \packages directory and then use an entry like <add key="Local Packages" value=".\packages" /> in your NuGet.config file to point to it. Don't forget to eventually delete it from your global profile .nuget\packages\xunit... when you're done.

net46

Easiest thing to do is add a launchSettings.json file that adds the vstest.console.exe as a startup project and point it to an xunit dll. Something like the following (use /listtests if you just want to debug the discovery portion):

{
  "profiles": {
    "vstest console": {
      "executablePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\CommonExtensions\\Microsoft\\TestWindow\\vstest.console.exe",
      "commandLineArgs": ".\\bin\\Debug\\net46\\Tests.System.Reactive.dll /TestAdapterPath:.\\bin\\Debug\\net46 /listtests",
      "workingDirectory": "C:\\dev\\RxNET\\Rx.NET\\Source\\Tests.System.Reactive\\"
    }
  }
}

With that as the startup project, you can set breakpoints and then hit them. You may need to manually load symbols the first time if it's not detected automatically.

netcoreapp2.1

Debugging the .NET Core version of the runner is currently much more difficult. You'll need Process Explorer to help locate the correct process to debug. This limitation should be improved in subsequent .NET Test Platform releases.

  1. Start a PowerShell console and navigate to the directory with your test project
  2. Set an environment variable in that console session: $env:VSTEST_HOST_DEBUG = 1
  3. Build your test project: dotnet build
  4. Have VS open with the xUnit solution loaded
  5. Have Process Explorer open and in Tree View mode. You may want to update the "highlight delay" settings to 2-3 settings. Defaults to 1. Make the list scroll roughly to the "d's"
  6. Execute the test: dotnet vstest .\bin\debug\netcoreapp2.1\MyTest.dll (you can use the -lt switch to do discovery only)
  7. The test adapter will wait for about 30 seconds for you to attach a debugger. You need to look for the "lowest" dotnet.exe process in the tree like this: img. In this case, the PID you're looking for is 79404.
  8. In VS, go to Debug -> Attach to Process and look for the PID (easiest to sort the column by PID). Ensure the debugger type is "Automatic" and it'll choose the CoreCLR debugger.
  9. Attach and then quickly hit Continue. It should load up the adapter and related code with symbols.

About xUnit.net

xUnit.net is a free, open source, community-focused unit testing tool for the .NET Framework. Written by the original inventor of NUnit v2, xUnit.net is the latest technology for unit testing C#, F#, VB.NET and other .NET languages. xUnit.net works with ReSharper, CodeRush, TestDriven.NET and Xamarin. It is part of the .NET Foundation, and operates under their code of conduct. It is licensed under Apache 2 (an OSI approved license).

For project documentation, please visit the xUnit.net project home.

  • .NETFramework 4.5.2
  • .NETCoreApp 2.1
  • UAP 10.0.16299
  • .NETCoreApp 2.1: 2.1.0.0
  • .NETFramework 4.5.2: 4.5.2.0
  • UAP 10.0.16299: 10.0.16299.0

Owners

Brad Wilson Oren Novotny

Authors

.NET Foundation and Contributors

Project URL

https://github.com/xunit/visualstudio.xunit

License

Apache-2.0

Info

55143 total downloads
0 downloads for version 2.4.2-preview.52
Download (766.27 KB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
2.5.1-pre.5 214.52 KB Thu, 27 Jul 2023 19:53:38 GMT 0
2.5.1-pre.4 548.25 KB Fri, 21 Jul 2023 02:31:20 GMT 0
2.5.1-pre.3 548.12 KB Fri, 14 Jul 2023 20:20:47 GMT 0
2.5.1-pre.2 545.6 KB Tue, 11 Jul 2023 22:26:01 GMT 0
2.5.1-pre.1 545.57 KB Thu, 06 Jul 2023 22:07:59 GMT 0
2.5.0 545.52 KB Thu, 06 Jul 2023 21:39:07 GMT 0
2.5.0-pre.28 545.65 KB Thu, 06 Jul 2023 01:34:49 GMT 0
2.5.0-pre.27 545.72 KB Mon, 03 Jul 2023 19:48:37 GMT 0
2.5.0-pre.26 545.83 KB Sat, 01 Jul 2023 05:04:03 GMT 0
2.5.0-pre.25 545.66 KB Sat, 01 Jul 2023 02:50:59 GMT 0
2.5.0-pre.24 545.45 KB Sat, 01 Jul 2023 00:34:59 GMT 0
2.5.0-pre.22 545.4 KB Wed, 21 Jun 2023 21:53:18 GMT 0
2.5.0-pre.21 545.35 KB Sun, 18 Jun 2023 00:59:11 GMT 0
2.5.0-pre.20 545.06 KB Thu, 15 Jun 2023 01:03:06 GMT 0
2.5.0-pre.19 545.14 KB Thu, 08 Jun 2023 07:46:52 GMT 0
2.5.0-pre.17 544.77 KB Sun, 04 Jun 2023 22:43:55 GMT 0
2.5.0-pre.16 544.35 KB Sun, 04 Jun 2023 17:43:19 GMT 0
2.5.0-pre.15 544.42 KB Wed, 31 May 2023 20:07:50 GMT 0
2.5.0-pre.14 544.34 KB Fri, 26 May 2023 05:05:19 GMT 0
2.5.0-pre.13 546.06 KB Fri, 26 May 2023 04:43:31 GMT 0
2.4.2-preview.52.g19fc37fb0a 735.81 KB Mon, 26 Aug 2019 16:46:14 GMT 0
2.4.2-preview.52 766.27 KB Mon, 26 Aug 2019 16:53:55 GMT 0
2.4.2-preview.50.g153048c51e 735.81 KB Mon, 19 Aug 2019 18:53:55 GMT 0
2.4.2-preview.50 766.25 KB Mon, 19 Aug 2019 19:00:07 GMT 0
2.4.2-preview.48.g7f49203be5 735.81 KB Mon, 12 Aug 2019 16:00:05 GMT 0
2.4.2-preview.48 766.27 KB Mon, 12 Aug 2019 16:06:37 GMT 0
2.4.2-preview.46.g5fb1bf9427 735.82 KB Mon, 05 Aug 2019 15:44:56 GMT 0
2.4.2-preview.46 766.22 KB Mon, 05 Aug 2019 15:48:03 GMT 0
2.4.2-preview.44.g652fd79def 735.84 KB Wed, 17 Jul 2019 14:24:18 GMT 0
2.4.2-preview.44 766.3 KB Wed, 17 Jul 2019 14:33:28 GMT 0
2.4.2-preview.42.ge4c4ffd0e0 735.86 KB Tue, 16 Jul 2019 14:19:07 GMT 0
2.4.1 675.53 KB Mon, 29 Oct 2018 04:24:48 GMT 0
2.4.0 674.21 KB Tue, 17 Jul 2018 04:19:42 GMT 0
2.3.1 660.4 KB Fri, 27 Oct 2017 05:37:35 GMT 102
2.3.0 726.17 KB Fri, 06 Oct 2017 22:15:12 GMT 40
2.2.0 302.56 KB Sun, 19 Feb 2017 23:24:31 GMT 1390
2.1.0 183.46 KB Sun, 27 Sep 2015 17:45:48 GMT 53611