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

Warn if testproject includes multiple versions of the Nunit.Engine #515

Open
mikkelbu opened this issue Feb 12, 2023 · 4 comments
Open

Warn if testproject includes multiple versions of the Nunit.Engine #515

mikkelbu opened this issue Feb 12, 2023 · 4 comments

Comments

@mikkelbu
Copy link
Member

From nunit/nunit#4279 (comment)

PS: The NUnit.Analyzer should be extended to warn if the versions do not match up. Tha adapter can probably not do this, since it might fail before it manages to output anything, we can try though.....

As far as I can Google it is not possible to analyze the csprojs directly, but perhaps we can determine if the are multiple versions of the engine loaded at the same time (this could also be a more general solution).

@OsirisTerje
Copy link
Member

The wrongly added engine package will overwrite the version embedded with the adapter, so it needs to know [ read ] which version is the adapter, and then check if the engine is the correct version, based on the table here: https://docs.nunit.org/articles/vs-test-adapter/Adapter-Engine-Compatibility.html.

@manfred-brands
Copy link
Member

Is there any practical reason to include the NuGet-console NuGet package when using the adapter?
Isn't it an either or?

@OsirisTerje
Copy link
Member

@manfred-brands I would say so, but in some cases, some people want the console, and since the engine follows the console, they have to match.
Earlier it might have been a need for the console, but right now I am not quite sure if it has anything that one really would want. , but can't really say. There might be differences for Linux environments though, but I am not sure there either. I've been trying to add stuff to the adapter to make it do what the console does (by enabling those for e.g. dotnet test), but there might be more in the console than what I know about.

@manfred-brands
Copy link
Member

I created a test project with both, but it doesn't seem to matter.
The NUnit3TestAdapter uses the build folder and those dlls will get copied to the bin output folder, but NOT passed to the compiler.
The NUnit.ConsoleRunner uses the tools folder which will neither be used, nor copied by the build process.

I also tried to create an analyzer to see if I can detect this.
Although I can get a list of Compilation.Reference, I don't get package references, but references to dlls that are used in the build process. Package resolution is before the compiler and not available to analyzers
Neither of the 2 packages has dlls in the lib or ref folders, so not detectable by the compilation aka the analyzers.

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