I have loggers in all complicated tests. Some simply verify that there is
logging used at all. Others use ConsoleLogger to help finding a good break
point and condition in case of failures. That cuts debugger time by half at
least.

I always use DI and inject StreamLoggers and ConsoleLoggers into SUT. Using
log4Net for this case is simply overkill.

-Markus

2009/3/24 Ben Lovell <[email protected]>

> I'm also curious to know why you would ever want logging in your tests?
>
>
> On Tue, Mar 24, 2009 at 9:33 AM, Colin Ramsay <[email protected]>wrote:
>
>>
>> Logging is set up as a Monorail service:
>>
>> http://castleproject.org/monorail/documentation/trunk/index.html
>>
>> I guess your problem is due to the fact that the services have not
>> been initialised as you are not running the "full" MR pipeline when
>> you call the controller through tests. Because of this even if you do
>> get the logging working you're not going to see all of the same log
>> messages you do when running the web application. The more pressing
>> concern is why you need to see MR logging in your unit tests....
>>
>> On Tue, Mar 24, 2009 at 8:45 AM, Flominator <[email protected]> wrote:
>> >
>> > Hi there,
>> >
>> > I have some problems with BaseControllerTest vs. Log4net:
>> >
>> > In my application everything works fine:
>> >
>> > Log4net is configured and logs everything to a file. The Logger
>> > property of the controllers is set at my BaseController class at
>> > Initialize(). The model classes get theirs manually in each class.
>> >
>> > Global Application calls log4net.Config.XmlConfigurator.Configure();
>> >
>> >
>> > Now I wanted my unit tests to produce log files as well when they run
>> > in Gallio. I set up a similar app.config file like the web.config in
>> > the web project.
>> >
>> > Model tests: I invoked log4net.Config.XmlConfigurator.Configure(); at
>> > [Setup] of the unit test and the model classes started loggin.
>> >
>> > Controller tests: I did the same and put
>> > log4net.Config.XmlConfigurator.Configure() before the initialization
>> > of the controller in the [Setup] of the controller test class, but it
>> > didn't work. After initialization but before PrepareController didn't
>> > work as well.
>> >
>> > My question: Does BaseControllerTest support logging of controllers at
>> > all?
>> >
>> >
>> > Regards,
>> >
>> > Flo
>> >
>> >
>> > >
>> >
>>
>>
>>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to