### Basic .runsettings Setup Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/README.md Configure test execution behavior using a .runsettings file. This example shows basic run configuration, environment variables, and logger settings. ```xml 1 . ./TestResults 1800000 true C:\Path\To\Godot_v4.4-stable_mono_win64.exe normal test-result.html test-result.trx --verbose FullyQualifiedName true 20000 10000 ``` -------------------------------- ### Install GdUnit4 API Package Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/Api/README.md Add the gdUnit4.api package as a reference to your project to install the GdUnit4 API. ```xml ``` -------------------------------- ### Install GdUnit4Net Test Adapter Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/README.md Add the gdUnit4.test.adapter NuGet package to your test project to integrate the test adapter. ```xml ``` -------------------------------- ### Example Test Filters Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/README.md Examples of applying test filters to target specific tests. Filters can be combined using logical operators like '&'. ```text # Run only tests in a specific class Class=CalculatorTests ``` ```text # Run tests with a specific category TestCategory=UnitTest ``` ```text # Run tests with specific traits Trait.Priority=High ``` ```text # Combine filters with logical operators TestCategory=UnitTest&Trait.Owner=TeamA ``` -------------------------------- ### GdUnit4 Configuration Options Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/ReleaseNotes.txt Example of how to configure gdUnit4 settings within a .runsettings file. These options control test execution behavior, such as capturing stdout and setting compile timeouts. ```xml true --verbose --headless FullyQualifiedName 30000 ``` -------------------------------- ### VSTest Integration Command-Line Filters Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/README.md Examples of using the `dotnet test` command with VSTest filters to selectively run tests based on traits, categories, or names. ```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)" ``` -------------------------------- ### Error: Missing RequireGodotRuntime Annotation Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/Analyzers/documentation/GdUnit0501.md This example shows a test method that uses Godot functionality but lacks the `[RequireGodotRuntime]` attribute, which will result in a GdUnit0501 error. ```csharp [TestCase] // ❌ GdUnit0501: Test method 'TestWithGodot' uses Godot functionality but is not annotated with '[RequireGodotRuntime]'. public void TestWithGodot() { var instance = new Node2D() AssertThat(instance).IsNotNull(); } ``` -------------------------------- ### Run Fast Tests for PR Builds using dotnet test Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/TestFilterGuide.md Example of using the --filter argument with dotnet test to run unit and fast tests, suitable for Pull Request builds. ```bash dotnet test --filter "TestCategory=UnitTest|TestCategory=Fast" ``` -------------------------------- ### Run Integration Tests for Nightly Builds using dotnet test Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/TestFilterGuide.md Example of using the --filter argument with dotnet test to run only integration tests, typically used for nightly builds. ```bash dotnet test --filter "TestCategory=IntegrationTest" ``` -------------------------------- ### Fix: Add RequireGodotRuntime Annotation to Method Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/Analyzers/documentation/GdUnit0501.md This example demonstrates the correct way to fix the GdUnit0501 error by adding the `[RequireGodotRuntime]` attribute directly to the test method. ```csharp [RequireGodotRuntime] // ✅ Correct: Method level annotation [TestCase] public void TestWithGodot() { var instance = new Node2D(); AssertThat(instance).IsNotNull(); } ``` -------------------------------- ### OverrideFailureMessage Usage Example Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/Api/ReleaseNotes.txt Demonstrates the correct usage of OverrideFailureMessage at the beginning of an assertion chain. Using it later in the chain will result in a compile error. ```csharp AssertString("foo").OverrideFailureMessage("Custom failure message").IsEqual("bar"); // ✅ AssertString("foo").IsEqual("bar").OverrideFailureMessage("Custom failure message"); // ❌ Compile error ``` -------------------------------- ### Run Critical Tests for Quick Feedback using dotnet test Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/TestFilterGuide.md Example of filtering tests by a high priority trait using dotnet test, providing quick feedback on critical tests. ```bash dotnet test --filter "Trait.Priority=High" ``` -------------------------------- ### Fix: Add RequireGodotRuntime Annotation to Class Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/Analyzers/documentation/GdUnit0501.md This example shows how to apply the `[RequireGodotRuntime]` attribute at the class level, ensuring all test methods within that class that use Godot functionality are correctly annotated. ```csharp [RequireGodotRuntime] // ✅ Correct: Class level annotation public class MyTestClass { [TestCase] public void TestWithGodot() { var instance = new Node2D(); AssertThat(instance).IsNotNull(); } } ``` -------------------------------- ### Fix: Single TestCase attribute with DataPoint Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/Analyzers/documentation/GdUnit0201.md This example demonstrates the correct way to use DataPoint attributes by ensuring only a single TestCase attribute is applied to the test method. ```csharp [TestCase] // ✅ Correct: Single TestCase with DataPoint [DataPoint(nameof(ArrayDataPointProperty))] public void TestDataPointProperty(int a, int b, int expected) { AssertThat(a + b).IsEqual(expected); } ``` -------------------------------- ### Error: Multiple TestCase attributes with DataPoint Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/Analyzers/documentation/GdUnit0201.md This example shows the incorrect usage of multiple TestCase attributes on a method that also uses the DataPoint attribute, leading to the GdUnit0201 error. ```csharp [TestCase] [TestCase] // ❌ GdUnit0201: Method 'TestDataPointProperty' cannot have multiple TestCase attributes when DataPoint attribute is present [DataPoint(nameof(ArrayDataPointProperty))] public void TestDataPointProperty(int a, int b, int expected) { AssertThat(a + b).IsEqual(expected); } ``` -------------------------------- ### Run Component-Specific Tests for Feature Branches using dotnet test Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/TestFilterGuide.md Example of filtering tests by a specific component trait using dotnet test, useful for feature branch testing. ```bash dotnet test --filter "Trait.Component=Authentication" ``` -------------------------------- ### Error: Test Class Missing [RequireGodotRuntime] Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/Analyzers/documentation/GdUnit0500.md This example shows a test class that uses Godot functionality in a test hook without the required attribute, triggering the GdUnit0500 error. ```csharp [TestSuite] public class SceneRunnerTest // ❌ GdUnit0500: Test class 'SceneRunnerTest' contains Godot dependencies in test hooks and requires [RequireGodotRuntime] attribute { [Before] public void Setup() => Engine.PhysicsTicksPerSecond = 60; // Using Godot Engine in test hook [TestCase] public void TestMethod() => AssertThat(true).IsTrue(); } ``` -------------------------------- ### Fix: Add [RequireGodotRuntime] to Test Class Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/Analyzers/documentation/GdUnit0500.md This example demonstrates the correct way to fix the GdUnit0500 error by adding the [RequireGodotRuntime] attribute to a test class that utilizes Godot engine features in its hooks. ```csharp [RequireGodotRuntime] // ✅ Correct: Uses [RequireGodotRuntime] for class with Godot dependencies in hooks [TestSuite] public class SceneRunnerTest { [Before] public void Setup() => Engine.PhysicsTicksPerSecond = 60; [TestCase] public void TestMethod() => AssertThat(true).IsTrue(); } ``` -------------------------------- ### Run Tests with .runsettings via Command Line Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/README.md Execute tests using the dotnet CLI and specify a .runsettings file with the --settings argument. ```bash dotnet test --settings .runsettings ``` -------------------------------- ### Configuring Godot Runtime Connection Timeout Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/Api/ReleaseNotes.txt Shows how to set a custom timeout for the Godot runtime connection using the .runsettings file. This allows for more flexibility in environments with slower startup times. ```xml 10000 ``` -------------------------------- ### Basic GdUnit4Net C# Test Suite Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/README.md Demonstrates various assertion types and test configurations including fast execution, Godot runtime requirements, exception monitoring, data-driven tests, and category/trait filtering. ```csharp namespace GdUnit4.Tests { using static Assertions; [TestSuite] public class StringAssertTest { // Fast execution - no Godot runtime needed [TestCase] public void IsEqual() { AssertThat("This is a test message").IsEqual("This is a test message"); } // Godot runtime required for Node operations [TestCase] [RequireGodotRuntime] public void TestGodotNode() { AssertThat(new Node2D()).IsNotNull(); } // Exception monitoring for Godot-specific errors [Test] [RequireGodotRuntime] [GodotExceptionMonitor] public void TestNodeCallback() { var node = new MyNode(); // Will catch exceptions in _Ready() AddChild(node); } // Data-driven tests with dynamic test data [Test] [DataPoint(nameof(TestData))] public void TestCalculations(int a, int b, int expected) { AssertThat(Calculator.Add(a, b)).IsEqual(expected); } // Exception validation with specific messages [Test] [ThrowsException(typeof(ArgumentNullException), "Value cannot be null")] public void TestValidation() { Calculator.Add(null, 5); } // Test categories and traits for filtering [Test] [Category("Integration")] [Trait("Speed", "Fast")] public void FastIntegrationTest() { // This test can be filtered by category or trait } // Data source for parameterized tests public static IEnumerable TestData => new[] { new object[] { 1, 2, 3 }, new object[] { 5, 7, 12 }, new object[] { -1, 1, 0 } }; } } ``` -------------------------------- ### Advanced Logging Configuration with Multiple Output Formats Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/README.md Configure the test adapter to output logs in multiple formats, such as console, HTML reports, and TRX files for CI/CD integration. This provides comprehensive reporting capabilities. ```xml detailed TestResults/test-report.html TestResults/test-results.trx ``` -------------------------------- ### Apply Test Filters from Command Line Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/TestFilterGuide.md Use the `--filter` option with the `dotnet test` command to apply test filters. ```bash dotnet test --filter "TestCategory=UnitTest" ``` ```bash dotnet test --filter "(TestCategory=UnitTest|TestCategory=Fast)&Namespace=MyProject.Tests" ``` -------------------------------- ### v5.0.0 Logic Test (No Godot Runtime) Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/Api/ReleaseNotes.txt Logic tests in v5.0.0 run independently of the Godot runtime for faster execution. ```csharp [Test] public void MyLogicTest() { // Runs fast without Godot runtime var result = Calculator.Add(1, 2); AssertThat(result).IsEqual(3); } ``` -------------------------------- ### SceneRunner Input Action Simulation Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/Api/ReleaseNotes.txt Simulate input actions within the SceneRunner for testing. Use these methods to trigger press, release, or general action events. ```csharp SimulateActionPressed(string action) SimulateActionPress(string action) SimulateActionRelease(string action) ``` -------------------------------- ### Applying Test Categories in C# Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/TestFilterGuide.md Demonstrates how to apply TestCategory attributes to test methods in C#. ```csharp [TestCategory("UnitTest")] [Trait("Category", "Fast")] public void TestMethod() { // This test has both "UnitTest" and "Fast" categories } ``` -------------------------------- ### Basic String Assertion Test Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/Api/README.md Demonstrates a basic string equality assertion using the AssertThat method. This test case is suitable for general string comparisons. ```csharp AssertThat("This is a test message").IsEqual("This is a test message"); ``` -------------------------------- ### Pre-v5.0.0 Godot Runtime Test Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/Api/ReleaseNotes.txt Tests before v5.0.0 inherently ran within the Godot runtime. ```csharp [Test] public void MyTest() { // All tests ran in Godot runtime var node = new Node(); AddChild(node); } ``` -------------------------------- ### Configure .runsettings Path in VS Code Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/README.md Set the path to your .runsettings file within VS Code's settings.json for automatic detection. ```json { "dotnet-test-explorer.runSettingsPath": ".runsettings" } ``` -------------------------------- ### v5.0.0 Godot Runtime Test with Attribute Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/Api/ReleaseNotes.txt Tests requiring the Godot runtime in v5.0.0 must be explicitly marked with the [RequireGodotRuntime] attribute. ```csharp [Test] [RequireGodotRuntime] // Required for Godot-dependent tests public void MyGodotTest() { var node = new Node(); AddChild(node); } ``` -------------------------------- ### Include GdUnit4 Analyzers Package Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/Analyzers/README.md Reference the gdUnit4.analyzer package in your project file to enable compile-time validation. ```xml all runtime; build; native; contentfiles; analyzers; buildtransitive ``` -------------------------------- ### Configure Environment Variables in .runsettings Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/README.md Define environment variables within the .runsettings file to make them accessible to your tests. These variables can be used to configure paths, modes, or other test-specific settings. ```xml C:\Godot\Godot.exe ./TestData true ``` -------------------------------- ### Inheriting Categories and Traits in C# Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/TestFilterGuide.md Shows how categories and traits defined at the class level are inherited by test methods. ```csharp [TestSuite] [TestCategory("Integration")] public class DatabaseTests { [TestCase] // Inherits "Integration" category from the class public void TestConnection() { } [TestCase] [TestCategory("Slow")] // Has both "Integration" and "Slow" categories public void TestBulkInsert() { } } ``` -------------------------------- ### Parameterized Test with Data Points Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/Api/README.md Implements a data-driven test for a Calculator's Add function using the [DataPoint] attribute to specify input and expected output values. The 'TestData' method provides the data sets. ```csharp [Test] [DataPoint(nameof(TestData))] // ← Data-driven tests public void TestCalculations(int a, int b, int expected) { AssertThat(Calculator.Add(a, b)).IsEqual(expected); } ``` ```csharp // Data source for parameterized tests public static IEnumerable TestData => new[] { new object[] { 1, 2, 3 }, new object[] { 5, 7, 12 } }; ``` -------------------------------- ### Filter Tests by Namespace Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/TestFilterGuide.md Use the Namespace filter to run tests from a specific namespace. ```plaintext Namespace=GdUnit4.Tests.Core ``` -------------------------------- ### Node Assertion Test with Godot Runtime Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/Api/README.md Tests if a Node2D instance is not null. Requires the Godot runtime to be available, indicated by the [RequireGodotRuntime] attribute. ```csharp [TestCase] [RequireGodotRuntime] // ← Add this for Godot-dependent tests public void IsEqual() { AssertThat(new Node2D()).IsNotNull(); } ``` -------------------------------- ### v5.0.0 Data-Driven Test Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/Api/ReleaseNotes.txt Supports data-driven tests using the [DataPoint] attribute to specify test data sources. ```csharp [Test] [DataPoint(nameof(TestData))] // Data-driven tests public void TestCalculations(int a, int b, int expected) { AssertThat(Calculator.Add(a, b)).IsEqual(expected); } ``` ```csharp public static IEnumerable TestData => new[] { new object[] { 1, 2, 3 }, new object[] { 5, 7, 12 } }; ``` -------------------------------- ### Basic Test Filter Syntax Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/README.md Use the PropertyName=Value format for basic test filtering. This allows selective execution of tests based on criteria like class, category, or traits. ```text PropertyName=Value ``` -------------------------------- ### Godot Exception Monitoring Test Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/Api/README.md Monitors Godot exceptions that might occur during the execution of a test, specifically within the _Ready() method of a custom node. Use the [GodotExceptionMonitor] attribute for this purpose. ```csharp [Test] [RequireGodotRuntime] [GodotExceptionMonitor] // ← Monitor Godot exceptions public void TestNodeCallback() { var node = new MyNode(); // Will catch exceptions in _Ready() AddChild(node); } ``` -------------------------------- ### Filter Tests by Priority and Component Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/TestFilterGuide.md Combine Trait filters to select tests based on priority and component metadata. ```plaintext Trait.Priority=High&Trait.Component=Core ``` -------------------------------- ### DataPoint and TestCase Combination Validation Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/Analyzers/README.md Validates the proper combination of DataPoint and TestCase attributes. GdUnit0201 error is raised for invalid combinations. ```csharp // ✅ Valid: Single TestCase with DataPoint [TestCase] [DataPoint(nameof(TestData))] public void ValidTest(int a, int b) { } ``` ```csharp // ❌ 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) { } ``` -------------------------------- ### Filter Tests by Naming Pattern Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/TestFilterGuide.md Use the FullyQualifiedName filter with a wildcard pattern to match tests based on their names. ```plaintext FullyQualifiedName~Test.*Add.* ``` -------------------------------- ### v5.0.0 Exception Test Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/Api/ReleaseNotes.txt Allows testing for specific exceptions thrown by a method using the [ThrowsException] attribute. ```csharp [Test] [ThrowsException(typeof(ArgumentNullException), "Value cannot be null")] public void TestValidation() { Calculator.Add(null, 5); // Expects specific exception } ``` -------------------------------- ### Access Environment Variables in C# Tests Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/README.md Retrieve environment variable values within your C# test methods using `Environment.GetEnvironmentVariable()`. This allows tests to dynamically adapt to the configured environment. ```csharp [Test] public void TestWithEnvironmentVariable() { var godotPath = Environment.GetEnvironmentVariable("GODOT_BIN"); var debugMode = Environment.GetEnvironmentVariable("DEBUG_MODE"); // Use environment variables in your tests } ``` -------------------------------- ### Categorize Tests with Trait Attribute Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/TestFilterGuide.md Use the flexible key-value Trait attribute to categorize tests, applicable to methods or classes. ```csharp using GdUnit4.Attributes; [TestSuite] public class UserServiceTests { [TestCase] [Trait("Category", "Integration")] [Trait("Owner", "TeamA")] [Trait("Priority", "High")] public void TestUserRegistration() { // Test code here } } ``` ```csharp using GdUnit4.Attributes; [TestSuite] [Trait("Category", "Performance")] [Trait("Environment", "Production")] public class BenchmarkTests { // All tests in this class will have these traits } ``` -------------------------------- ### Filter Tests with Complex Conditions Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/TestFilterGuide.md Combine multiple filters using logical AND (&) and OR (|) operators to create complex filtering expressions. ```plaintext (TestCategory=UnitTest|TestCategory=Fast)&Class=CalculatorTests ``` -------------------------------- ### Filter Tests by Class and Exclude Category Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/TestFilterGuide.md Combine Class and TestCategory filters to select tests from a specific class while excluding certain categories. ```plaintext Class=CalculatorTests&TestCategory!=Integration ``` -------------------------------- ### Filter Tests by Category Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/TestFilterGuide.md Use the TestCategory filter to run tests belonging to a specific category. ```plaintext TestCategory=UnitTest ``` -------------------------------- ### GdUnit4 Filter Logical Operators Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/TestFilterGuide.md Combine multiple filter conditions using logical AND, OR, and NOT operators. ```markdown | Operator | Description | Example | |----------|-------------|--------------------------------------------| | `&` | AND | `TestCategory=UnitTest&Class=Calculator` | | `|` | OR | `TestCategory=UnitTest|TestCategory=Fast` | | `!` | NOT | `!TestCategory=SlowTest` | ``` -------------------------------- ### GdUnit4 Filter Comparison Operators Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/TestFilterGuide.md These operators allow for different types of comparisons when filtering tests. ```markdown | Operator | Description | Example | |----------|------------------|---------------------------------| | `=` | Equal to | `TestCategory=UnitTest` | | `!=` | Not equal to | `TestCategory!=IntegrationTest` | | `~` | Contains | `FullyQualifiedName~Calculator` | | `!~` | Does not contain | `Name!~Legacy` | ``` -------------------------------- ### GdUnit4 Grouped Filter Expression Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/TestFilterGuide.md Use parentheses to group filter expressions for complex filtering logic. ```plaintext (TestCategory=UnitTest|TestCategory=Fast)&Namespace=MyProject.Tests ``` -------------------------------- ### Categorize Tests with TestCategory Attribute Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/TestFilterGuide.md Apply the TestCategory attribute to individual test methods or entire test classes to categorize them. ```csharp using GdUnit4.Attributes; [TestSuite] public class CalculatorTests { [TestCase] [TestCategory("UnitTest")] [TestCategory("Math")] public void TestAddition() { // Test code here } } ``` ```csharp using GdUnit4.Attributes; [TestSuite] [TestCategory("Integration")] public class DatabaseTests { [TestCase] public void TestConnection() { // All tests in this class will have the "Integration" category } } ``` -------------------------------- ### Filter Properties for GdUnit4 Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/TestFilterGuide.md These properties can be used to filter tests based on their fully qualified name, display name, class, namespace, category, or custom traits. ```markdown | Property | Description | |------------------------|---------------------------------------------| | **FullyQualifiedName** | The fully qualified name of the test method | | **Name** | The display name of the test | | **Class** | The class name containing the test | | **Namespace** | The namespace of the test class | | **TestCategory** | The category assigned to the test | | **Trait.{name}** | Custom traits | ``` -------------------------------- ### Filter Tests Excluding a Name Pattern Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/TestFilterGuide.md Use the Name filter with a negation operator to exclude tests that match a specific naming pattern. ```plaintext Name!~Legacy ``` -------------------------------- ### Exception Assertion Test Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/Api/README.md Tests if a specific exception (ArgumentNullException) with a particular message is thrown when calling a function with invalid input. The [ThrowsException] attribute is used to define the expected exception and message. ```csharp [Test] [ThrowsException(typeof(ArgumentNullException), "Value cannot be null")] public void TestValidation() { Calculator.Add(null, 5); // Expects specific exception } ``` -------------------------------- ### Filter Tests by Trait Owner Source: https://github.com/godot-gdunit-labs/gdunit4net/blob/master/TestAdapter/TestFilterGuide.md Use the Trait filter to select tests based on specific trait metadata, such as the owner. ```plaintext Trait.Owner=TeamA ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.