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

Problem with executing NUnit testcases in Visual Studio #393

Closed
MrSoerenAndersen opened this issue Jan 9, 2025 · 2 comments
Closed

Problem with executing NUnit testcases in Visual Studio #393

MrSoerenAndersen opened this issue Jan 9, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@MrSoerenAndersen
Copy link

Reqnroll Version

2.2.1

Which test runner are you using?

NUnit

Test Runner Version Number

2.2.1

.NET Implementation

.NET 6.0

Test Execution Method

Visual Studio Test Explorer

Content of reqnroll.json configuration file

No response

Issue Description

In my Visual Studio solution I am having both traditional NUnit testcase and ReqnRoll BDD tests.
Executing the NUnit testcases fails after updating ReqnRoll NuGet packages to version 2.2.1 with following message...

Message: 
OneTimeSetUp: System.InvalidOperationException : Only static OneTimeSetUp and OneTimeTearDown are allowed for InstancePerTestCase mode.

Stack Trace: 
StaticMethodValidator.Validate(MethodInfo method)
SetUpTearDownItem.RunSetUpOrTearDownMethod(TestExecutionContext context, IMethodInfo method)
SetUpTearDownItem.RunSetUp(TestExecutionContext context)
<.ctor>b__0(TestExecutionContext context)
BeforeTestCommand.Execute(TestExecutionContext context)
CompositeWorkItem.PerformOneTimeSetUp()

image

Best regards
Soeren Andersen
Email: [email protected]

Steps to Reproduce

<PropertyGroup>
	<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
	<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.0" />
	<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.0" />
	<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0" />
	<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
	<PackageReference Include="NUnit" Version="4.3.2" />
	<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
	<PackageReference Include="WebDriverManager" Version="2.17.5" />

	<!-- Nunit Testcases passes when using the below version of ReqnRoll... -->
	<!--<PackageReference Include="Reqnroll" Version="2.1.0" />
	<PackageReference Include="Reqnroll.NUnit" Version="2.1.0" />
	<PackageReference Include="Reqnroll.Tools.MsBuild.Generation" Version="2.1.0" />-->

	<!-- Nunit Testcases fails when using the below version of ReqnRoll... -->
	<PackageReference Include="Reqnroll" Version="2.2.1" />
	<PackageReference Include="Reqnroll.NUnit" Version="2.2.1" />
	<PackageReference Include="Reqnroll.Tools.MsBuild.Generation" Version="2.2.1" />
</ItemGroup>
Always

Link to Repro Project

No response

@MrSoerenAndersen MrSoerenAndersen added the bug Something isn't working label Jan 9, 2025
@MrSoerenAndersen
Copy link
Author

ReqnRoll-NUnit-Bug.zip

Example project

@obligaron
Copy link
Contributor

Thanks for the repro and the good description. 👍

We currently have another issue open with the same problem, #379, so I will close this one.

@SeanKilleen has also opened a draft PR to work on the fix, see #388.

@obligaron obligaron closed this as not planned Won't fix, can't repro, duplicate, stale Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants