Kyle
Kyle

Reputation: 416

NUnit not looking the file in the right folder

I just updated nUnit from 2.6.4 to 3.0.1 on my VS2015. Everything went well with just ONE problem.

In my Test method, I have to load a xml file, let's call it UnitTestConfiguration.xml, it is saved inside the same root folder as the app.Config and package.Config file. With NUnit 2.6.4, this xml file is being found and load perfectly.

But, with Nunit 3.0.1, I receive this error:

System.IO.FileNotFoundException : Could not find file 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 14.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\UnitTestConfiguration.xml'.

So my question is, why would 3.0.1 not look into the root folder of the test project to begin with, but somewhere else? Is there any setting(s) to correct it?

Upvotes: 1

Views: 524

Answers (1)

Chris
Chris

Reputation: 6062

Yes, this is a Breaking Change in NUnit3, tests are no longer ran in the root folder.

Use TestContext.TestDirectory to reach it.

Upvotes: 1

Related Questions