-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Problem loading dialect with NUnit
PostPosted: Wed Dec 07, 2005 10:23 am 
Beginner
Beginner

Joined: Thu Oct 20, 2005 9:26 am
Posts: 27
Location: Barcelona
Hi all,

I'm having a problem trying to implement NUnit tests on my ORM-methods.
Basically what happens is that if I execute the project (winforms) normally my access to the database (SQLLite) works without problems, but when I try to do the same through the NUnitGui on my tester methods, I get an exception saying that the "dialect was not set". Both projects create, fill and save a business-object that is contained in another project, so they call the same method, just not with the same result.
I thought that this might be because of a problem loading the app.config file, since when I execute the solution, it is my main GUI-project that is run, and when NUnit executes the tests, it is the test project (in same solution) that is executed. But the config-files are the same and I really don't know what else to look for. Anyone got any idea?

Regards,
David Givoni
david@givoni.dk


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 07, 2005 11:12 am 
Contributor
Contributor

Joined: Thu May 12, 2005 8:45 am
Posts: 226
It does sound like your app.config is not being loaded. What steps have you taken to make sure it gets loaded? You can copy app.config to ${your.test.assembly.name}.dll.config, or you can write a *.nunit file and specify the config file to use, or you can use nunit-gui.exe setup options to specify what config file to use. You can even use nant's nunit2 task and specify what config file to use. A quick Google of "nunit app.config" should return some nice examples. Google is your friend.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 07, 2005 11:37 am 
Beginner
Beginner

Joined: Thu Oct 20, 2005 9:26 am
Posts: 27
Location: Barcelona
Thanks for the answer. I did indeed google the subject before asking here, and what I had done is to add a postbuild event to copy the config file into the /debug directory:
copy /Y "$(ProjectDir)App.config" "$(TargetDir)$(TargetFileName).config"
I have also checked that the file is copied alright, and that it's called the same name as the dll that is being loaded by NUnit (Tester.dll.config), but yes, as you say the config file definately isn't being loaded. I made some more tests to check it, and no, ConfigurationSettings.GetConfig("nhibernate") returns null.
I will try to indicate the file specifically as you suggested and see if that helps, but I really don't understand why the other doesn't work.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 07, 2005 6:01 pm 
Beginner
Beginner

Joined: Thu Oct 20, 2005 9:26 am
Posts: 27
Location: Barcelona
Well, I solved the problem the following way:
In NUnit-Gui in the Project menu, choosing Edit, I could see which file was loaded as the config file as default. And it was actually <the name of the NUnit-project>.config and not the assembly.config as I had read elsewhere. On top of that I had to place the config file, not beside the dll, but beside the nunit project file.
At least it works now... thanks for the help.

Regards,
David Givoni


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 07, 2005 6:04 pm 
Beginner
Beginner

Joined: Thu Oct 20, 2005 9:26 am
Posts: 27
Location: Barcelona
And I just made a quick check now, and found out that if I in NUnit-gui do not create a new project, but just open the .dll directly, it works the other way I was trying to as well.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.