I am using NHibernate against an Oracle database with the NHibernate.Driver.OracleDataClientDriver driver class. I have an integration test that pulls back expected data properly when executed through the IDE using TestDriven.net. However, when I run the unit test through the NUnit GUI or Console, NHibernate throws an exception saying it cannot find the Oracle.DataAccess assembly. Obviously, this prevents me from running my integration tests as part of my CI process.
NHibernate.HibernateException : The IDbCommand and IDbConnection implementation in the assembly Oracle.DataAccess could not be found. Ensure that the assembly Oracle.DataAccess is located in the application directory or in the Global Assembly Cache. If the assembly is in the GAC, use element in the application configuration file to specify the full name of the assembly.*
I have tried making the assembly available in two ways, by copying it into the bindebug folder and by adding the element in the config file. Again, both methods work when executing through TestDriven in the IDE. Neither work when executing through NUnit GUI/Console.
The NUnit Gui log displays the following message.
21:42:26,377 ERROR [TestRunnerThread] ReflectHelper [(null)]- Could not load type Oracle.DataAccess.Client.OracleConnection, Oracle.DataAccess. System.BadImageFormatException: Could not load file or assembly Oracle.DataAccess, Version=2.111.7.20, Culture=neutral, PublicKeyToken=89b483f429c47342 or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: Oracle.DataAccess, Version=2.111.7.20, Culture=neutral, PublicKeyToken=89b483f429c47342 ---> System.BadImageFormatException: Could not load file or assembly Oracle.DataAccess or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: Oracle.DataAccess
I am running NUnit 2.4.8, TestDriven.net 2.24 and VS2008sp1 on Windows 7 64bit. Oracle Data Provider v2.111.7.20, NHibernate v2.1.0.4.
Has anyone run into this issue, better yet, fixed it?
Sly, Thanks for the reply. However, the NUnit test runner was using the correct configuration file as I was testing by pulling a known value out of the expected configuration file.
I am assuming this has something to do with my configuration, specifically with either Windows 7 in general or the 64bit version. I went ahead and installed/configured the Oracle client on the build server (W2k3 Server). I moved the test onto the build server and ran the same scenarios described above and the tests worked as expected in all cases.
I followed this up by running through the scenarios on two of the other developer workstations (Win XP 32bit with same toolset versions) and the tests worked as expected in all cases.
I m perplexed but satisfied for now. I can run my integration tests through the IDE and can execute them on the build server through our CI automation. Only problem now is I can t test the automation build project on my development workstation.