百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
G

gdUnit4Net

> 测试质量
开源

GDUnit4 的官方 C# 实现 - 这是一个面向 Godot 4 的全面性单元测试框架。特点包括 VS/Rider 测试适配器集成、参数化测试、场景测试等。

178 stars0 点赞5 次浏览
访问官网GitHub

工具介绍

GDUnit4 的官方 C# 实现 - 这是一个面向 Godot 4 的全面性单元测试框架。特点包括 VS/Rider 测试适配器集成、参数化测试、场景测试等。

The Unit Testing Framework in C# for Godot

This version of GdUnit4.api is based on Godot v4.4.stable.mono.official [4c311cbee] (master branch)

Supported Godot Versions

Supported .NET Versions

What is gdUnit4Net

GdUnit4Net is a feature-complete unit testing framework for Godot C# projects that is fully compatible with the VSTest standard. It provides an API and VS test adapter to run your Godot C# tests seamlessly in Visual Studio (Code), JetBrains Rider, and any VSTest-compatible environment.

Key Highlights

High Performance: Up to 10x faster test execution for logic-only tests
VSTest Compatible: Full integration with Visual Studio Test Platform
⚡ Smart Runtime: Tests run without Godot runtime by default, with opt-in Godot features
Feature Complete: All standard testing features you expect from modern frameworks

Main Features

  • Writing, executing and debugging tests with full IDE integration
  • Wide range of assertion methods for verifying the behavior and output of your code
  • Parameterized Tests (Test Cases and DataPoints) for testing functions with multiple sets of inputs and expected outputs
  • Advanced Test Filtering with VSTest filter support, test categories, and traits
  • Scene runner for simulating different kinds of inputs and actions, such as mouse clicks and keyboard inputs
    For example, you can simulate mouse clicks and keyboard inputs by calling the appropriate methods on the runner instance. Additionally, you can wait for a specific signal to be emitted by the scene, or you can wait for a specific function to return a certain value.
  • VSTest Adapter to run and debug your tests with full VSTest compatibility
  • Powerful test filtering capabilities to selectively run tests based on various criteria
  • Exception monitoring with automatic capture of Godot exceptions and runtime errors
  • Test output capture including stdout and Godot log integration
  • Roslyn Analyzers for compile-time validation of test attributes and combinations
  • Flexible test execution - tests run without Godot runtime by default for maximum performance, with [RequireGodotRuntime] for Godot-specific features

Architecture Redesign (v5.0+)

GdUnit4Net v5.0 introduces a major architecture overhaul that revolutionizes test performance and compatibility:

  • Smart Runtime Detection: Tests run in lightweight mode by default, only spinning up Godot runtime when explicitly needed
  • Performance Boost: Logic-only tests execute up to 10x faster than previous versions
  • VSTest Standard Compliance: Full compatibility with Visual Studio Test Platform and all VSTest features
  • Selective Godot Integration: Use [RequireGodotRuntime] attribute only for tests that actually need Godot features

⚠️ Please read the release notes about breaking changes. ⚠️

There are three packages available in this project:

  • gdUnit4.api - The core package to enable writing and running unit tests in C#.
  • gdUnit4.test.adapter - The test adapter to integrate GdUnit4 with Visual Studio Test Platform.
  • gdUnit4.analyzers - A Roslyn-based analyzer that provides compile-time validation for GdUnit4 test attributes.

gdunit4.api

Checkout the gdUnit4.api README to install and use the core testing framework.

gdUnit4.test.adapter

Checkout the gdUnit4.test.adapter README to install and use the test adapter. This adapter now supports powerful test filtering capabilities for selectively running tests based on specific criteria.

gdUnit4.analyzers

For compile-time validation of your test code, check out the gdUnit4.analyzers README.

Examples

The gdUnit4NetExamples repository provides comprehensive example projects demonstrating both basic and advanced GdUnit4Net usage patterns. It includes foundational examples for newcomers learning unit testing fundamentals, as well as sophisticated examples covering professional configurations, complex testing scenarios, input simulation, signal testing, and exception handling. These working examples showcase GdUnit4Net v5.0 features including selective Godot runtime usage, advanced scene testing, and production-ready test setups.

Short Example

…

VSTest Integration Example

Run tests with advanced filtering using VSTest standard syntax:

bash
# Run only fast tests
dotnet test --filter "Trait=Speed:Fast"

# Run integration tests
dotnet test --filter "Category=Integration"

# Run tests by name pattern
dotnet test --filter "FullyQualifiedName~Calculator"

# Combine multiple filters
dotnet test --filter "(Category=Integration)|(Trait=Speed:Fast)"

The test run looks like this:

What's New in v5.0

Performance Revolution

  • Up to 10x faster test execution for logic-only tests
  • Tests run without Godot runtime by default
  • Only use [RequireGodotRuntime] when you actually need Godot features

VSTest Standard Compliance

  • Full compatibility with Visual Studio Test Platform
  • Advanced test filtering with categories and traits
  • Seamless integration with CI/CD pipelines

Enhanced Test Capabilities

  • DataPoint attributes for dynamic parameterized tests
  • Exception monitoring with automatic Godot error capture
  • Output capture including stdout and Godot logs
  • Roslyn analyzers for compile-time validation

Developer Experience

  • Better error reporting and diagnostics
  • Improved test discovery and execution
  • Enhanced debugging capabilities
  • Environment variable support from runsettings

Documentation

How to setup GdUnit4 for C#

Supported IDE's

Test Filtering Guide

Migration from v4.x to v5.0

Important: v5.0 includes breaking changes that require minimal code updates: ⚠️ Please read the release notes about breaking changes. ⚠️

  1. Add [RequireGodotRuntime] to tests that use Godot features (Nodes, Scenes, Resources)
  2. Remove unnecessary Godot dependencies from pure logic tests for better performance
  3. Update test filtering to use new VSTest-compatible syntax

You Are Welcome To

  • Give Feedback
  • Suggest Improvements
  • Report a Bug related to GdUnit4 API
  • Report a Bug related to GdUnit4 Test Adapter

Contribution Guidelines

Thank you for your interest in contributing to GdUnit4!

To ensure a smooth and collaborative contribution process, please review our contribution guidelines before getting started. These guidelines outline the standards and expectations we uphold in this project.

Code of Conduct: We strictly adhere to the Godot code of conduct in this project. As a contributor, it is important to respect and follow this code to maintain a positive and inclusive community.

Using GitHub Issues: We utilize GitHub issues for tracking feature requests and bug reports. If you have a general question or wish to engage in discussions, we recommend joining the GdUnit Discord Server for specific inquiries.

We value your input and appreciate your contributions to make GdUnit4 even better!

Thank you for supporting my project

Sponsors

Jeff


License

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

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C#csharpdotnetgame-developmentgdunit4

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类测试质量
定价开源

> 相关工具

J
Jest
JavaScript 测试框架
P
Playwright
现代端到端测试框架
E
eslint-plugin-test-selectors
Enforces that data-test-id attributes are added to interactive DOM elements (JSX) to help with UI testing. JSX only.