NUnit Testing

Posts   
 
    
Dave avatar
Dave
User
Posts: 48
Joined: 28-Jan-2004
# Posted on: 16-Aug-2004 21:55:32   

Tiny Forum lost my original post. Bad Tiny... Bad, Bad, Bad simple_smile

I am doing some Unit Testing with NUnit for the first time against a database using LLBLGen Pro. It is a web application in development local to my PC.

When I open the test assembly from the bin directory of my web application and run a simple test involving LLBLGen Pro I get the error:

'ConnectionString' cannot be found...

ConnectionString is in the web.config of the web application root folder, but that probably doesn't do me much good during the test simple_smile

How do I get LLBLGen Pro to use a connection string during NUnit Testing? I am not sure how this unit testing stuff works when you need information from an app.config or web.config file?

Thanks.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39826
Joined: 17-Aug-2003
# Posted on: 16-Aug-2004 22:10:58   

Dave wrote:

Tiny Forum lost my original post. Bad Tiny... Bad, Bad, Bad simple_smile

hmmm. you got an error or something?

I am doing some Unit Testing with NUnit for the first time against a database using LLBLGen Pro. It is a web application in development local to my PC.

When I open the test assembly from the bin directory of my web application and run a simple test involving LLBLGen Pro I get the error:

'ConnectionString' cannot be found...

ConnectionString is in the web.config of the web application root folder, but that probably doesn't do me much good during the test simple_smile

How do I get LLBLGen Pro to use a connection string during NUnit Testing? I am not sure how this unit testing stuff works when you need information from an app.config or web.config file?

Thanks.

The FAQ on the website has an item for this simple_smile I'll quote it here:

I want to unit test the generated code together with my code using NUnit. However it doesn't work, NUnit can't connect to the database, how come? If you want to use NUnit for testing purposes, you have to create an app.dll.config file (where app is the name of the project created for NUnit testing) and place it in the bin\debug directory for the NUnit project. For example if you create a new project called "UnitTest" for NUnit testing, and after adding the appropriate references (see LLBLGen Pro and NUnit documentation) you must copy the App.config file that LLBLGen Pro creates to the directory where the NUnit test dll resides (bin\debug) and rename it to "UnitTest.dll.config".

I use unittesting for a month now or so with my new developments with llblgen pro and had to use this same info to get it running simple_smile .

Frans Bouma | Lead developer LLBLGen Pro
Dave avatar
Dave
User
Posts: 48
Joined: 28-Jan-2004
# Posted on: 16-Aug-2004 23:23:57   

I clicked on "Preview" and poof. Although it did not take me back to the login screen, I bet my session timed out as it did just a minute ago simple_smile

My apologies. I forgot about the FAQ. I am so used to going to the forum for my answers.

That did the trick! Thanks, Frans.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39826
Joined: 17-Aug-2003
# Posted on: 17-Aug-2004 00:00:10   

Dave wrote:

I clicked on "Preview" and poof. Although it did not take me back to the login screen, I bet my session timed out as it did just a minute ago simple_smile

You have automatic login checked? If not that would be it I think simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Devildog74
User
Posts: 719
Joined: 04-Feb-2004
# Posted on: 17-Aug-2004 04:07:28   

you need to tell nunit to use a config file. In the config file you need to put the same connection string that is expected in your web app.

If you are curious what config file nunit is looking for and where it is looking for it at, simply use nunit gui, place a break point in your code, start the test and print out ?AppDomain.CurrentDoman.SetupInformation.ConfigurationFile or something along those lines and you can see what nunit is looking for.

Hope this helps