You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by "Lear, Russell" <Ru...@xerox.com> on 2007/11/08 01:34:35 UTC

Enabling logging in NUnit

This is probably a question with a very obvious answer, but ....

I'm trying to run some unit tests using NUnit.  I'm not sure how to
enable logging in iBATIS.  I assume I create an app.config file for the
test DLL. (as opposed to an app.config file for the DLL under test).
But I'm not sure how to convince iBATIS to read that file and Do the
Right Thing.  Any pointers appreciated!

Thanks,
Russell.


Re: Enabling logging in NUnit

Posted by Gilles Bayon <ib...@gmail.com>.
I not have this problem.

-- 
Cheers,
Gilles

<a href="http://www.amazon.com/gp/registry/6JCP7AORB0LE">Wish List</a>

RE: Enabling logging in NUnit

Posted by "Lear, Russell" <Ru...@xerox.com>.
Thanks for the help!
 
Looking through the iBATIS test project is quite interesting - thanks
for that suggestion.
 
Actually, I think my problem with logging and NUnit may have been my
misunderstanding of NUnit (and I'm not sure I understand yet).  When I
got things set up just as the iBatis test project had, I still wasn't
getting log output.  It was only when I closed and re-opened my NUnit
GUI that I started getting something.
 
Russell.


________________________________

	From: Gilles Bayon [mailto:ibatis.net@gmail.com] 
	Sent: Wednesday, November 07, 2007 11:04 PM
	To: user-cs@ibatis.apache.org
	Subject: Re: Enabling logging in NUnit
	
	
	You have 2 solutions,
	- create an app.config in your test porject with this content

	<?xml version="1.0" encoding="utf-8" ?>
	<configuration>
	 <!-- Register a section handler for the log4net section -->
	 <configSections>
	  <sectionGroup name="iBATIS"> 
	   <section name="logging"
type="IBatisNet.Common.Logging.ConfigurationSectionHandler,
IBatisNet.Common" />
	  </sectionGroup> 
	 </configSections>

	 <iBATIS>
	   <logging>

	     <logFactoryAdapter
type="IBatisNet.Common.Logging.Impl.ConsoleOutLoggerFA,
IBatisNet.Common">
	    <arg key="showLogName" value="true" />
	    <arg key="showDataTime" value="true" /> 
	    <arg key="level" value="ALL" />
	    <arg key="dateTimeFormat" value="yyyy/MM/dd HH:mm:ss:SSS" />
	   </logFactoryAdapter> 
	      
	  </logging> 
	 </iBATIS>
	   
	</configuration>

	or create an an MyNamespace.Test.dll.config in the bin/debug of
your test project.
	You can have a look a the ibatis test project
	 
	Cheers,
	Gilles
	
	<a href="http://www.amazon.com/gp/registry/6JCP7AORB0LE">Wish
List</a> 


Re: Enabling logging in NUnit

Posted by Gilles Bayon <ib...@gmail.com>.
You have 2 solutions,
- create an app.config in your test porject with this content

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
 <!-- Register a section handler for the log4net section -->
 <configSections>
  <sectionGroup name="iBATIS">
   <section name="logging" type="
IBatisNet.Common.Logging.ConfigurationSectionHandler, IBatisNet.Common" />
  </sectionGroup>
 </configSections>

 <iBATIS>
   <logging>

     <logFactoryAdapter type="
IBatisNet.Common.Logging.Impl.ConsoleOutLoggerFA, IBatisNet.Common">
    <arg key="showLogName" value="true" />
    <arg key="showDataTime" value="true" />
    <arg key="level" value="ALL" />
    <arg key="dateTimeFormat" value="yyyy/MM/dd HH:mm:ss:SSS" />
   </logFactoryAdapter>

  </logging>
 </iBATIS>

</configuration>
or create an an MyNamespace.Test.dll.config in the bin/debug of your test
project.
You can have a look a the ibatis test project

Cheers,
Gilles

<a href="http://www.amazon.com/gp/registry/6JCP7AORB0LE">Wish List</a>

Re: Enabling logging in NUnit

Posted by Vincent Apesa <va...@hotmail.com>.
Enabling logging in NUnitRussell,
    I think I understand what you're trying to do. 

In our solution we keep the unit tests in a separate class library called UnitTests. I added some pre-build events in Visual Studio on the UnitTests class library to copy our web.config file to the bin folder of the unit tests and rename it as UnitTests.config. The map files are copied in this way too. 

It's what I can up with. I would be interested to see how other people have done this. There's probably an easier way.

Vince
  ----- Original Message ----- 
  From: Lear, Russell 
  To: user-cs@ibatis.apache.org 
  Sent: Wednesday, November 07, 2007 7:34 PM
  Subject: Enabling logging in NUnit


  This is probably a question with a very obvious answer, but .. 

  I'm trying to run some unit tests using NUnit.  I'm not sure how to enable logging in iBATIS.  I assume I create an app.config file for the test DLL. (as opposed to an app.config file for the DLL under test).  But I'm not sure how to convince iBATIS to read that file and Do the Right Thing.  Any pointers appreciated!

  Thanks, 
  Russell.