Skip to content
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

NUnit3TestAdapter 4.0.0 - DiscoveryException: Not a TestFixture, SetUpFixture or TestSuite, but ParameterizedFixture #884

Closed
thomhurst opened this issue Sep 17, 2021 · 5 comments

Comments

@thomhurst
Copy link

I have a pipeline in TeamCity, and I recently upgraded the NUnit3TestAdapter package from 3.17.0 to 4.0.0

I noticed that the pipeline didn't fail, but TeamCity didn't show my tests as having being run.

I looked into the build log and can see this exception:

	[dotnet test] Exception NUnit.VisualStudio.TestAdapter.NUnitEngine.DiscoveryException,    Exception thrown executing tests in C:\BuildAgent\work\bdda9fcf3e0e8340\test\AcceptanceTests\bin\Debug\netcoreapp3.1\AcceptanceTests.dll
[15:11:35]	[dotnet test] Not a TestFixture, SetUpFixture or TestSuite, but ParameterizedFixture
[15:11:35]	[dotnet test]    at NUnit.VisualStudio.TestAdapter.NUnitEngine.DiscoveryConverter.ExtractTestFixtures(NUnitDiscoveryCanHaveTestFixture parent, XElement node) in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnitEngine\DiscoveryConverter.cs:line 252
[15:11:35]	[dotnet test]    at NUnit.VisualStudio.TestAdapter.NUnitEngine.DiscoveryConverter.ExtractAllFixtures(NUnitDiscoveryTestSuite parent, XElement node) in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnitEngine\DiscoveryConverter.cs:line 223
[15:11:35]	[dotnet test]    at NUnit.VisualStudio.TestAdapter.NUnitEngine.DiscoveryConverter.ExtractAllFixtures(NUnitDiscoveryTestSuite parent, XElement node) in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnitEngine\DiscoveryConverter.cs:line 192
[15:11:35]	[dotnet test]    at NUnit.VisualStudio.TestAdapter.NUnitEngine.DiscoveryConverter.ExtractAllFixtures(NUnitDiscoveryTestSuite parent, XElement node) in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnitEngine\DiscoveryConverter.cs:line 192
[15:11:35]	[dotnet test]    at NUnit.VisualStudio.TestAdapter.NUnitEngine.DiscoveryConverter.ExtractAllFixtures(NUnitDiscoveryTestSuite parent, XElement node) in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnitEngine\DiscoveryConverter.cs:line 192
[15:11:35]	[dotnet test]    at NUnit.VisualStudio.TestAdapter.NUnitEngine.DiscoveryConverter.ExtractAllFixtures(NUnitDiscoveryTestSuite parent, XElement node) in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnitEngine\DiscoveryConverter.cs:line 192
[15:11:35]	[dotnet test]    at NUnit.VisualStudio.TestAdapter.NUnitEngine.DiscoveryConverter.ExtractAllFixtures(NUnitDiscoveryTestSuite parent, XElement node) in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnitEngine\DiscoveryConverter.cs:line 192
[15:11:35]	[dotnet test]    at NUnit.VisualStudio.TestAdapter.NUnitEngine.DiscoveryConverter.ExtractAllFixtures(NUnitDiscoveryTestSuite parent, XElement node) in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnitEngine\DiscoveryConverter.cs:line 192
[15:11:35]	[dotnet test]    at NUnit.VisualStudio.TestAdapter.NUnitEngine.DiscoveryConverter.ConvertXml(NUnitResults discovery) in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnitEngine\DiscoveryConverter.cs:line 180
[15:11:35]	[dotnet test]    at NUnit.VisualStudio.TestAdapter.NUnitEngine.DiscoveryConverter.Convert(NUnitResults discoveryResults, String assemblyPath) in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnitEngine\DiscoveryConverter.cs:line 134
[15:11:35]	[dotnet test]    at NUnit.VisualStudio.TestAdapter.NUnit3TestExecutor.RunAssembly(String assemblyPath, IGrouping`2 testCases, TestFilter filter) in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnit3TestExecutor.cs:line 280
[15:11:35]	[dotnet test] NUnit Adapter 4.0.0.0: Test execution complete
[15:11:35]	[dotnet test] No test is available in C:\BuildAgent\work\bdda9fcf3e0e8340\test\AcceptanceTests\bin\Debug\netcoreapp3.1\AcceptanceTests.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.

Tests are being run on .NET Core 3.1

@mikkelbu mikkelbu transferred this issue from nunit/nunit Sep 17, 2021
@mikkelbu
Copy link
Member

I've transferred the issue to the adapter project. This sounds related to #867

@OsirisTerje
Copy link
Member

Yes, except we lack a repro, perhaps @thomhurst can provide a small repro ?

@OsirisTerje OsirisTerje added confirm We need a separate confirmation of this issue reproNeeded labels Sep 17, 2021
@thomhurst
Copy link
Author

@OsirisTerje Clone this repo and run the powershell script (or run dotnet test from the same directory as the solution)

https://github.com/thomhurst/NUnitTestAdapterIssueRepro

@OsirisTerje OsirisTerje added is:bug pri:high and removed confirm We need a separate confirmation of this issue labels Sep 22, 2021
@OsirisTerje OsirisTerje added this to the 4.1 milestone Sep 22, 2021
@OsirisTerje
Copy link
Member

OsirisTerje commented Sep 22, 2021

Thanks @thomhurst !

I've added the discovery xml from your repro to a unit test (ThatSetUpFixtureWorksIssue884) in the project, and it confirmed the issue! I've also added a fix for this.

I thought this case was covered but turned out the XML was slightly off, so this triggered.

Using the fixed adapter, it also works on your repro:
image

and command line
image

An alpha01 package is attached to this comment. Very nice if you could verify on your system too.

Thanks for reporting this, and providing the repro!
NUnit3TestAdapter.4.1.0-alpha01.zip

@thomhurst
Copy link
Author

@OsirisTerje brilliant, that works for me! Glad I could help :)
image

OsirisTerje added a commit that referenced this issue Sep 23, 2021
Fix for issue #884.  Added ParameterizedFixtures as children of Setup…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants