-
-
Notifications
You must be signed in to change notification settings - Fork 109
Fix inherited test categories issue in source generation mode #2881
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
41029e7
3d3ee11
5614ff4
97393a9
aabc5f0
6833a5d
7c04b65
72fa4a8
698a893
ae0bc6d
109d292
c639b79
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,24 @@ | ||||||||||
| using TUnit.TestProject.Attributes; | ||||||||||
|
|
||||||||||
| namespace TUnit.TestProject; | ||||||||||
|
|
||||||||||
| [EngineTest(ExpectedResult.Pass)] | ||||||||||
| [InheritsTests] | ||||||||||
| public class InheritedCategoryTestValidation : Library.BaseTests | ||||||||||
| { | ||||||||||
| [Test] | ||||||||||
| public async Task TestInheritedBaseTestHasBaseCategory() | ||||||||||
| { | ||||||||||
| // This test verifies that when we call the inherited BaseTest method, | ||||||||||
| // it retains its BaseCategory attribute | ||||||||||
| await Assert.That(TestContext.Current!.TestDetails.Categories.Contains("BaseCategory")); | ||||||||||
|
Check failure on line 14 in TUnit.TestProject/InheritedCategoryTestValidation.cs
|
||||||||||
|
||||||||||
| await Assert.That(TestContext.Current!.TestDetails.Categories.Contains("BaseCategory")); | |
| await Assert.That(TestContext.Current!.TestDetails.Categories).Contains("BaseCategory"); |
Check failure on line 21 in TUnit.TestProject/InheritedCategoryTestValidation.cs
GitHub Actions / modularpipeline (windows-latest)
'ValueAssertionBuilder<bool>' does not contain a definition for 'GetAwaiter' and no accessible extension method 'GetAwaiter' accepting a first argument of type 'ValueAssertionBuilder<bool>' could be found (are you missing a using directive or an assembly reference?)
Check failure on line 21 in TUnit.TestProject/InheritedCategoryTestValidation.cs
GitHub Actions / modularpipeline (windows-latest)
'ValueAssertionBuilder<bool>' does not contain a definition for 'GetAwaiter' and no accessible extension method 'GetAwaiter' accepting a first argument of type 'ValueAssertionBuilder<bool>' could be found (are you missing a using directive or an assembly reference?)
Check failure on line 21 in TUnit.TestProject/InheritedCategoryTestValidation.cs
GitHub Actions / modularpipeline (ubuntu-latest)
'ValueAssertionBuilder<bool>' does not contain a definition for 'GetAwaiter' and no accessible extension method 'GetAwaiter' accepting a first argument of type 'ValueAssertionBuilder<bool>' could be found (are you missing a using directive or an assembly reference?)
Check failure on line 21 in TUnit.TestProject/InheritedCategoryTestValidation.cs
GitHub Actions / modularpipeline (ubuntu-latest)
'ValueAssertionBuilder<bool>' does not contain a definition for 'GetAwaiter' and no accessible extension method 'GetAwaiter' accepting a first argument of type 'ValueAssertionBuilder<bool>' could be found (are you missing a using directive or an assembly reference?)
Check failure on line 21 in TUnit.TestProject/InheritedCategoryTestValidation.cs
GitHub Actions / modularpipeline (macos-latest)
'ValueAssertionBuilder<bool>' does not contain a definition for 'GetAwaiter' and no accessible extension method 'GetAwaiter' accepting a first argument of type 'ValueAssertionBuilder<bool>' could be found (are you missing a using directive or an assembly reference?)
Check failure on line 21 in TUnit.TestProject/InheritedCategoryTestValidation.cs
GitHub Actions / modularpipeline (macos-latest)
'ValueAssertionBuilder<bool>' does not contain a definition for 'GetAwaiter' and no accessible extension method 'GetAwaiter' accepting a first argument of type 'ValueAssertionBuilder<bool>' could be found (are you missing a using directive or an assembly reference?)
Check failure on line 22 in TUnit.TestProject/InheritedCategoryTestValidation.cs
GitHub Actions / modularpipeline (windows-latest)
'ValueAssertionBuilder<bool>' does not contain a definition for 'GetAwaiter' and no accessible extension method 'GetAwaiter' accepting a first argument of type 'ValueAssertionBuilder<bool>' could be found (are you missing a using directive or an assembly reference?)
Check failure on line 22 in TUnit.TestProject/InheritedCategoryTestValidation.cs
GitHub Actions / modularpipeline (windows-latest)
'ValueAssertionBuilder<bool>' does not contain a definition for 'GetAwaiter' and no accessible extension method 'GetAwaiter' accepting a first argument of type 'ValueAssertionBuilder<bool>' could be found (are you missing a using directive or an assembly reference?)
Check failure on line 22 in TUnit.TestProject/InheritedCategoryTestValidation.cs
GitHub Actions / modularpipeline (ubuntu-latest)
'ValueAssertionBuilder<bool>' does not contain a definition for 'GetAwaiter' and no accessible extension method 'GetAwaiter' accepting a first argument of type 'ValueAssertionBuilder<bool>' could be found (are you missing a using directive or an assembly reference?)
Check failure on line 22 in TUnit.TestProject/InheritedCategoryTestValidation.cs
GitHub Actions / modularpipeline (ubuntu-latest)
'ValueAssertionBuilder<bool>' does not contain a definition for 'GetAwaiter' and no accessible extension method 'GetAwaiter' accepting a first argument of type 'ValueAssertionBuilder<bool>' could be found (are you missing a using directive or an assembly reference?)
Check failure on line 22 in TUnit.TestProject/InheritedCategoryTestValidation.cs
GitHub Actions / modularpipeline (macos-latest)
'ValueAssertionBuilder<bool>' does not contain a definition for 'GetAwaiter' and no accessible extension method 'GetAwaiter' accepting a first argument of type 'ValueAssertionBuilder<bool>' could be found (are you missing a using directive or an assembly reference?)
Check failure on line 22 in TUnit.TestProject/InheritedCategoryTestValidation.cs
GitHub Actions / modularpipeline (macos-latest)
'ValueAssertionBuilder<bool>' does not contain a definition for 'GetAwaiter' and no accessible extension method 'GetAwaiter' accepting a first argument of type 'ValueAssertionBuilder<bool>' could be found (are you missing a using directive or an assembly reference?)
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| await Assert.That(TestContext.Current!.TestDetails.Categories.Contains("AnotherBaseCategory")); | |
| await Assert.That(TestContext.Current!.TestDetails.Categories.Contains("MultipleCategories")); | |
| await Assert.That(TestContext.Current!.TestDetails.Categories).Contains("AnotherBaseCategory"); | |
| await Assert.That(TestContext.Current!.TestDetails.Categories).Contains("MultipleCategories"); |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -22,4 +22,18 @@ | |||||||
| public void NonGenericMethodDataSource(string value) | ||||||||
| { | ||||||||
| } | ||||||||
|
|
||||||||
| [Test] | ||||||||
| public void VerifyInheritedCategoriesAreAvailable() | ||||||||
| { | ||||||||
| // This test validates that categories from inherited methods are properly available at runtime | ||||||||
| // The BaseTest method should have the "BaseCategory" category | ||||||||
| // This will only pass if the source generator correctly includes the category attributes | ||||||||
| var currentTest = TestContext.Current?.TestDetails; | ||||||||
| Assert.That(currentTest).IsNotNull(); | ||||||||
|
Check failure on line 33 in TUnit.TestProject/InheritedTestsFromDifferentProjectTests.cs
|
||||||||
|
||||||||
| Assert.That(currentTest).IsNotNull(); | |
| await Assert.That(currentTest).IsNotNull(); | |
| await Assert.That(currentTest!.Categories).Contains("BaseCategory"); |
Uh oh!
There was an error while loading. Please reload this page.