2

I have a problem with running automated tests on my Jenkins build server since I moved the connection strings from my config files to searate files using <connectionStrings configSource="connectionStrings.config"/>

When I open the project from the Jenkins workspace in VS2013 and run the tests, everything works fine. When I try running the tests as part of the build job with the command

"C:\Program Files (x86)\NUnit 2.6.4\bin\nunit-console.exe" Path\To\Project\ProjectName.Tests.csproj /xml=TestResults.xml 

I get errors in the console saying:

Test Error : ProjectName.Tests.TestClass.TestIfSomethingWorks
   System.InvalidOperationException : No connection string named 'ConnectionStringName' could be found in the application config file.

Of course, both the app.config file and the connectionStrings.config file are in the root folder of the test project AND the projects in the solution that use these connection strings.

Am I doing something wrong? How to fix this?

K.L.
  • 2,419
  • 1
  • 21
  • 26

1 Answers1

2

I believe what is happening is that nunit-console.exe is able to find your test assembly when you point it to the csproj file, but it's unable to locate the configuration file as it's running in a different working directory. You should be able to fix the issue by pointing NUnit to your test assembly DLL. Something like this:

"C:\Program Files (x86)\NUnit 2.6.4\bin\nunit-console.exe" Path\To\Project\ProjectName.Tests\bin\Debug\ProjectName.Tests.dll /xml=TestResults.xml 

Give that a go, and good luck!

Chris Missal
  • 5,987
  • 3
  • 28
  • 46