See the version list below for details.
dotnet add package NUnit.Analyzers --version 3.6.1
NuGet\Install-Package NUnit.Analyzers -Version 3.6.1
<PackageReference Include="NUnit.Analyzers" Version="3.6.1"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add NUnit.Analyzers --version 3.6.1
#r "nuget: NUnit.Analyzers, 3.6.1"
// Install NUnit.Analyzers as a Cake Addin #addin nuget:?package=NUnit.Analyzers&version=3.6.1 // Install NUnit.Analyzers as a Cake Tool #tool nuget:?package=NUnit.Analyzers&version=3.6.1
This is a suite of analyzers that target the NUnit testing framework. Right now, the code is separate from the NUnit framework, so if you want to try out the analyzers you'll need to download the analyzers separately as a nuget package. In the future the analyzers may be added as part of the NUnit framework package but that hasn't been done yet.
The latest stable release of the NUnit Analyzers is available on NuGet or can be downloaded from GitHub. Note that for Visual Studio 2017 one must use versions below 3.0. Version 3.0 and upwards require Visual Studio 2019, these versions also enables supression of compiler errors such as errors arising from nullable reference types.
Prerelease nuget packages can be found on MyGet. Please try out the package and report bugs and feature requests.
The full list of analyzers can be found in the documentation.
Below we give two examples of analyzers. One will look for methods with the
[TestCase] attribute and makes sure the argument values are correct for the types of the method parameters along with the
ExpectedResult value if it is provided.
<img src="https://user-images.githubusercontent.com/1007631/44311794-269a7200-a3ee-11e8-86a0-1d290b355ac5.gif" alt="testcase analyzers" width="750"/>
The other analyzer looks for classic model assertions (e.g.
Assert.IsTrue(), etc.). This analyzer contains a fixer that can translate the classic model assertions into constraint model assertions (
<img src="https://user-images.githubusercontent.com/1007631/44311791-213d2780-a3ee-11e8-90b8-6d144c0e3dbd.gif" alt="classic model assertions analyzers" width="1000"/>
Which version works with Unity Test Framework
If your Unity project is made by Unity under 2021.2, then use NUnit.Analyzers v2.x.
If your Unity project is made by Unity 2021.2 or later, then use NUnit.Analyzers v3.3 (v3.4 or later of the analyzers does not work with Unity).
You should use an analyzer built with the same version of Microsoft.CodeAnalysis.CSharp as the one embedded in the Unity Editor.
NUnit analyzers are Open Source software and released under the MIT license, which allow the use of the analyzers in free and commercial applications and libraries without restrictions.
There are several ways to contribute to this project. One can try things out, report bugs, propose improvements and new functionality, work on issues (especially the issues marked with the labels help wanted and Good First Issue), and in general join in the conversations. See Contributing for more information.
This package has no dependencies.
NuGet packages (3)
Showing the top 3 NuGet packages that depend on NUnit.Analyzers:
Test Files and some helper classes used for Linql Tests
GitHub repositories (77)
Showing the top 5 popular GitHub repositories that depend on NUnit.Analyzers:
🛠「Watt Toolkit」是一个开源跨平台的多功能 Steam 工具箱。
Clean Architecture Solution Template for ASP.NET Core
Distributed Application Framework for .NET
Interactive plotting library for .NET
Extensions to LINQ to Objects
See the release notes on https://github.com/nunit/nunit.analyzers/blob/master/CHANGES.txt.