Author
AuthorAttribute adds information about the author of tests. This metadata can be used by test runners and reporting tools to track test ownership and contact information.
Constructors
AuthorAttribute(string name)
AuthorAttribute(string name, string email)
| Parameter | Type | Description |
|---|---|---|
name |
string |
The name of the test author. |
email |
string |
The email address of the author. When provided, stored as "name <email>". |
Applies To
| Test Methods | Test Fixtures (Classes) | Assembly |
|---|---|---|
| ✅ | ✅ | ✅ |
Alternative Syntax
Author can also be specified as a named parameter on [TestFixture] or [Test] attributes (name only, no email):
[TestFixture(Author = "Jane Doe")]
[Test(Author = "Joe Developer")]
Example
[TestFixture]
[Author("Jane Doe", "jane.doe@example.com")]
[Author("Another Developer", "email@example.com")]
public class MyTests
{
[Test]
public void Test1() { /* ... */ }
[Test]
[Author("Joe Developer")]
[Author("Yet Another Developer", "not.my.email@example.com")]
public void Test2() { /* ... */ }
}
[TestFixture(Author = "Jane Doe")]
public class MyOtherTests
{
[Test]
public void Test1() { /* ... */ }
[Test(Author = "Joe Developer")]
public void Test2() { /* ... */ }
}
Notes
- This attribute inherits from
PropertyAttributeand sets theAuthorproperty. - Multiple
Authorattributes can be applied to the same fixture or test (since NUnit 3.7). - Prior to NUnit 3.7, only one Author attribute was allowed per fixture or test.
- When using the named parameter syntax (
Author = "name"), only the name can be specified, not the email.