Search code examples
.netunit-testingapproval-tests

How to remove approval's debug info from build logs


When I am running approval tests some debug output from approval test gets to my logs. It looks like 2/15/2016 1:58:48 PM ~000002ms Variable: approvalFrame = '' 2/15/2016 1:58:48 PM ~000025ms Variable: approvalFrame = '' 2/15/2016 1:58:48 PM ~000003ms Variable: approvalFrame = '' 2/15/2016 1:58:48 PM ~000002ms Variable: approvalFrame = '......

Is there any way to hide it from logs?

Thanks.


Solution

  • ApprovalTests uses the SimpleLogger for logging. If you set it to null it won't log to your files. If you want to use the SimpleLogger afterwards, reset it.

     ApprovalUtilities.SimpleLogger.Logger.Writer = NullWriter.Instance;
    

    To reset

    Logger.Writer = new MultiWriter(new ConsoleWriter(),new DebugerWriter());
    

    There are lot's of other writers of course and you can make your own composites or very own versions as well.

    Happy Testing!