Running test dll in a different folder than the test project folder
See original GitHub issueI have a project called StandardTest which contains tests and is located in some folder Projects\StandardTest\StandardTest.csproj. If I run one of those tests and call Assembly.GetExecutingAssembly().Location, it returns Projects\StandardTest\bin\Debug\StandardTest.dll.
My solution also contains a second project called CustomTest, which has a reference to StandardTest and is located in Projects\CustomTest\CustomTest.csproj. When I compile CustomTest, the folder Projects\CustomTest\bin\Debug\ contains both CustomTest.dll and StandardTest.dll.
I would like to run the tests defined in StandardTest using the dll located in Projects\CustomTest\bin\Debug\StandardTest.dll. I can easily do this with the console runner, but not with the Visual Studio runner. I need VS in order to debug my tests, so I’m looking for a way to do this using VS. Is it possible?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (4 by maintainers)

Top Related StackOverflow Question
First let’s dispose of
TestContext.WorkDirectory. In NUnit, unfortunately, this has a specific meaning: the directory where work files and reports are created by default. This is not the current working directory and the name was probably a bad choice. User sets work directory to tell NUnit where to put stuff like the XML or any text output. User may also access it in the code and save other things there. Think of it as the directory for saving stuff. 😄NUnit also supports
TestContext.TestDirectory, which is the directory where the current test assembly is located. Note that if you have several test assemblies in different directories, the value will be different when each one of them accesses it. Note also that there is no way you can set theTestDirectorybecause it’s always where the assembly is located.The BasePath is a .NET thing. It’s the base directory where assemblies are searched for. You can also have subdirectories listed in the PrivateBinPath. NUnit take scare of all this automatically now, so the old console options are no longer supported. For finding things you want to read at runtime, the TestDirectory and the BasePath will usually be the same thing.
@Wain123 If I missed anything you need to know, please ask.
Thanks @CharliePoole . I am adding your comments here to the relevant items in https://github.com/nunit/docs/wiki/Tips-And-Tricks, which lists the options for the adapter (Should probable be a different name on that page, but will do that later)