Skip to content

taori/Amusoft.XUnit.NLog.Extensions

Repository files navigation

Amusoft.XUnit.NLog.Extensions

Description

This extension allows you to derive your tests from LoggedTestBase which will automatically link NLog with XUnitTestOutputHelper

By adding nlog.config to your test project with this content

<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      throwExceptions="true">
	<extensions>
		<add assembly="Amusoft.XUnit.NLog.Extensions" />
	</extensions>
	<variable name="loggingLayout" value="${time}|${level:uppercase=true}|${logger}|${message}"/>

	<targets async="false">
		<target xsi:type="XUnitOutputTarget"
		        layout="${loggingLayout}"
		        name="XUnitTestOutput" />
		<target xsi:type="Console" name="console"/>
	</targets>

	<rules>
		<logger name="*" minlevel="Warn" writeTo="console,XUnitTestOutput" />
	</rules>

</nlog>

you will now receive log output from your actual library classes

Project state

.GitHub GitHub issues NuGet version (Amusoft.XUnit.NLog.Extensions)

Code Coverage

Package Line Rate Branch Rate Health
Amusoft.XUnit.NLog.Extensions 100% 100%
Summary 100% (6 / 6) 100% (0 / 0)

Minimum allowed line rate is 85%

Coverage details

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks