Toolbelt.NUnit.TestName 1.0.1

dotnet add package Toolbelt.NUnit.TestName --version 1.0.1                
NuGet\Install-Package Toolbelt.NUnit.TestName -Version 1.0.1                
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="Toolbelt.NUnit.TestName" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Toolbelt.NUnit.TestName --version 1.0.1                
#r "nuget: Toolbelt.NUnit.TestName, 1.0.1"                
#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.
// Install Toolbelt.NUnit.TestName as a Cake Addin
#addin nuget:?package=Toolbelt.NUnit.TestName&version=1.0.1

// Install Toolbelt.NUnit.TestName as a Cake Tool
#tool nuget:?package=Toolbelt.NUnit.TestName&version=1.0.1                

Test Name for NUnit NuGet Package tests

Summary

This package provides test attributes that alternate NUnit's [Test] and [TestCaseSource] attribute to add TestName property.

Before:
alternate text is missing from this package README image

After:
alternate text is missing from this package README image

How to use

  1. Add package to your project like this.
dotnet add package Toolbelt.NUnit.TestName
  1. Add two global using ... statements in the Usings.cs C# source code file in the NUnit test project.
/* 📜 "Usings.cs" */
global using NUnit.Framework;

// 👇 Add these tow lines.
global using Test = Toolbelt.NUnit.TestName.TestAttribute;
global using TestCaseSource = Toolbelt.NUnit.TestName.TestCaseSourceAttribute;
  1. After doing the above step, You will see the compile errors like below if you have already implemented some test methods.
  • error CS1614: 'Test' is ambiguous between 'TestAttribute' and 'TestAttribute'. Either use '@Test' or explicitly include the 'Attribute' suffix.
  • error CS1614: 'TestCaseSource' is ambiguous between 'TestCaseSourceAttribute' and 'TestCaseSourceAttribute'. Either use '@TestCaseSource' or explicitly include the 'Attribute' suffix.
  1. If so, please replace existing [Test] to [@Test] and replace existing [TestCaseSource] to [@TestCaseSource]. And later, please use [@Test] instead of [Test], and use [@TestCaseSource] instead of [TestCaseSource]. In short, please make those test attribute names start with @.
[@Test] // 👈 Use [@Test] instead of [Test]
public void MyTestMethod() {
  ...

[@TestCaseSource("...")] // 👈 Use [@TestCaseSource] instead of [TestCaseSource]
public void MyTestCasesMethod(...) {
  ...
  1. Finally, you can use the TestName attribute in [@Test] and [@TestCaseSource] attributes to show more readable test names in a display such as Visual Studio Test Explorer or the dotnet test command.
// 👇 You can use the "TestName" property.
[@Test(TestName = "...")] 
public void MyTestMethod() {
  ...
// 👇 You can use the "TestName" property.
[@TestCaseSource("...", TestName = "...")]
public void MyTestCasesMethod(...) {
  ...

Aside: Why doesn't this package provide the TestCase attribute?

Because the TestCase attribute in NUnit already has the TestName property. Honestly, I don't know why NUnit doesn't provide the TestName property on the Test and TestCaseSource attributes.

License

Mozilla Public License Version 2.0

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Toolbelt.NUnit.TestName:

Repository Stars
jsakamoto/Toolbelt.Blazor.HeadElement
Head element support (change the document title, "meta" elements such as OGP, and "link" elements) for Blazor apps.
Version Downloads Last updated
1.0.1 711 9/24/2022

v.1.0.1
- Fix: incorrect the package project URL.


To see all the change logs, please visit the following URL.
- https://github.com/jsakamoto/Toolbelt.NUnit.TestName/blob/main/RELEASE-NOTES.txt