gdUnit4.analyzers 1.1.0

dotnet add package gdUnit4.analyzers --version 1.1.0
                    
NuGet\Install-Package gdUnit4.analyzers -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="gdUnit4.analyzers" Version="1.1.0">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="gdUnit4.analyzers" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="gdUnit4.analyzers">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add gdUnit4.analyzers --version 1.1.0
                    
#r "nuget: gdUnit4.analyzers, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package gdUnit4.analyzers@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=gdUnit4.analyzers&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=gdUnit4.analyzers&version=1.1.0
                    
Install as a Cake Tool

The C# GdUnit4 Analyzers

What is GdUnit4.Analyzer

GdUnit4.Analyzer is a Roslyn-based analyzer package designed to enhance the development experience when writing tests with GdUnit4. It provides compile-time validation for GdUnit4 test attributes and helps developers catch configuration errors early in the development process.

Features

The analyzer must be included by referencing the gdUnit4.analyzer package:

<PackageReference Include="gdUnit4.api" Version="5.0.0"/>
<PackageReference Include="gdUnit4.test.adapter" Version="3.0.0"/>
<PackageReference Include="gdUnit4.analyzers" Version="1.0.0">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
  • Attribute Validation: The analyzer enforces correct usage of GdUnit4 test attributes

    Example: DataPoint and TestCase Combination Validation

    Validates proper combination of DataPoint and TestCase attributes:

    // ✅ Valid: Single TestCase with DataPoint
    [TestCase]
    [DataPoint(nameof(TestData))]
    public void ValidTest(int a, int b) { }
    
    // ❌ Invalid: Multiple TestCase with DataPoint
    [TestCase]
    [TestCase]                         // GdUnit0201 error: Method 'InvalidTest' cannot have multiple TestCase attributes when DataPoint attribute is present
    [DataPoint(nameof(TestData))]
    public void InvalidTest(int a, int b) { }
    

Technical Details

The analyzer is built using:

  • .NET Standard 2.0
  • Roslyn Analyzer Framework
  • Microsoft.CodeAnalysis.CSharp

Documentation

For more detailed documentation about the entire GdUnit4 ecosystem, visit our documentation site.

You are welcome to

License

This project is licensed under the MIT License - see the LICENSE file for details.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (6)

Showing the top 6 popular GitHub repositories that depend on gdUnit4.analyzers:

Repository Stars
luxkun/ReGoap
Generic C# GOAP (Goal Oriented Action Planning) library with Unity3d examples
godot-gdunit-labs/gdUnit4Net
Official C# implementation of GDUnit4 - a comprehensive unit testing framework for Godot 4. Features VS/Rider test adapter integration, parameterized tests, scene runners, and extensive assertion methods.
CSharpGodotTools/Template
A template used for quickly setting up new Godot 4 C# games that features ENet multiplayer, visual in-game debugging and more.
ShenCiao/Ciallo
The next-generation vector paint program built with Godot C#.
Delsin-Yu/GDTask.Nuget
Nuget package for adding async/await functionality in Godot
emptylower/STS2-Game-Lobby
《Slay the Spire 2》第三方联机大厅方案 | Third-party multiplayer lobby mod for Slay the Spire 2 — client MOD + lobby service + relay fallback
Version Downloads Last Updated
1.1.0 1,035 10/25/2026
1.0.0 93,150 6/21/2025

v1.1.0

✨ New Features
* GD-502: GdUnit0202: Test case names must be unique, reports TestCase attributes of a test method that set the same TestName,
         contributed by @Tayrtahn.

✨ Improvements
* GD-478: The DataPoint attribute analysis caches the resolved types per compilation and runs faster, contributed by @Tayrtahn.
* GD-520: The analyzers run with the .NET SDK 8.0.100 and Visual Studio 17.8 or newer, v1.0.0 needed the .NET SDK 9.0.300.
         The package no longer adds the analyzers as a library reference to the projects that use it.

🪲 Bug Fixes
* GD-462: Fixing a stack overflow that crashes the compiler when a test or test hook calls a recursive method,
         the Godot runtime check now stops on methods it is already analyzing.

v1.0.0
This is the Initial release of the analyzers.

GdUnit0201: Multiple TestCase attributes not allowed with DataPoint
GdUnit0500: Godot Runtime Required for Test Class
GdUnit0501: Godot Runtime Required for Test Method

Features:
- Compile-time validation of GdUnit4 attribute combinations
- Provides clear error messages with method name identification
- Integrates seamlessly with Visual Studio and other IDEs

Integration:
- Built for .NET Standard 2.0 compatibility

Technical Details:
- Implementation based on Roslyn analyzer framework
- IDE support for real-time error detection
- Includes a help link to documentation