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

Improved location of extensions #1749

Closed
Chraneco opened this issue Aug 15, 2016 · 6 comments
Closed

Improved location of extensions #1749

Chraneco opened this issue Aug 15, 2016 · 6 comments

Comments

@Chraneco
Copy link

Chraneco commented Aug 15, 2016

Hi!

We recently updated to NUnit 3.4.1 which unfortunately broke the integration with TeamCity. After some research I found out that this is because the TeamCity integration was moved to a separate NuGet package.

In our build pipeline we copy the contents of packages\NUnit.ConsoleRunner.3*\tools as part of a build artifact to a separate location, leaving behind the contents of all other packages (including NUnit.Extension.TeamCityEventListener.*).
I was hoping that it was enough to copy the "teamcity-event-listener" DLL into the folder next to "nunit3-console.exe", but it didn't help. That is because the NUnit engine only looks at the following hard-coded directories for extensions (listed in the nunit.engine.addins file):

../../NUnit.Extension.*/**/tools/     # nuget v2 layout
../../../NUnit.Extension.*/**/tools/  # nuget v3 layout

Unfortunately, this directory structure does not exist where we run our tests.

Making the following adjustment solves the problem for us

../../NUnit.Extension.*/**/tools/     # nuget v2 layout
../../../NUnit.Extension.*/**/tools/  # nuget v3 layout
teamcity-event-listener.dll

because we now copy the DLL into the directory where the console runner is put but we don't want to make this change every time we update NUnit. Is there a more generic solution for this? For example, letting the console runner always search in its own location for extension DLLs would be a possibility.

@NikolayPianikov
Copy link
Member

NikolayPianikov commented Aug 15, 2016

@Chraneco you could restore NUnit using this command line nuget.exe install NUnit.Runners -Version 3.4.1 -o packages and copy all installed packages

@Chraneco
Copy link
Author

Chraneco commented Aug 15, 2016

@NikolayPianikov Thanks for your comment. At the point when we execute the unit tests we are completely outside of a Visual Studio project. The build artifacts contain only the necessary files and in a different directory structure. Restoring NuGet packages there is not possible and also not wanted.

@NikolayPianikov
Copy link
Member

Is it possible to update the .addins file in the script where you make your own NUnit tool directory?

@Chraneco
Copy link
Author

All the files and directories are put in place by TeamCity itself via Artifact dependencies.

@CharliePoole CharliePoole changed the title teamcity-event-listener cannot be found Improved location of extensions Aug 15, 2016
@CharliePoole
Copy link
Contributor

@Chraneco Yes... we are discovering that the existing setup for locating extensions is not sufficient.

The main problem is that extensions are looked for relative to the directory containing the engine. The paths in the .addins file are tailored for an engine installed as an extension to find an engine installed as an extension to find other engines installed as an extension. In a case like yours, it would be handy to be able to locate addins relative to the VS project or the test assembly itself.

Since we don't already have an issue on this general topic, I changed the title of this issue accordingly. Things we may consider:

  1. Adding additional roots where we look for .addins files
    • test assembly directory
    • global per-user location
    • global per-machine location
    • parent directory of the engine directory, recursively
  2. Add an option to the command-line to specify extension paths to search
  3. Convention-based approach, by which .addins files reference one another
    • Raises the question of which should be the true root

@CharliePoole
Copy link
Contributor

Issue moved to nunit/nunit-console #4 via ZenHub

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

4 participants