-
Notifications
You must be signed in to change notification settings - Fork 129
Logging
Jakub Raczek edited this page Apr 25, 2019
·
5 revisions
We are using NLog in our test framework for logging messages during test execution.
Our framework allows to enable EventFiringWebDriver logs. It's disabled by default, to enable it: set in App.config EnableEventFiringWebDriver to "true" and set nlog trace level to "trace" for at least one logger.
<add key="EnableEventFiringWebDriver" value="true"/>
NLog is set in nlog section of App.config.
<?xml version="1.0" encoding="utf-8"?>
...
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
autoReload="true"
throwExceptions="false"
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log" >
<targets>
<target name="logfile" xsi:type="File" fileName="${basedir}\Test.log" layout="${longdate}|${level}|${callsite}|${message}" />
<target name="console" xsi:type="ColoredConsole" layout="${longdate}|${level}|${callsite}|${message}"/>
</targets>
<rules>
<logger name="*" minlevel="Trace" writeTo="logfile" />
<logger name="*" minlevel="Debug" writeTo="console" />
</rules>
</nlog>
...
</configuration>
To use NLog in your test project create logger and use it:
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
Logger.Info("Log message");
More info about configuring NLog can be find here.
- Home
- Getting started
- Parallel tests execution
- MsTest DataDriven tests from Xml and CSV files
- NUnit DataDriven tests from Xml, CSV and Excel files
- Comparing files by NUnit DataDriven tests
- Visual Testing
- Screen shots: full desktop, selenium. PageSource saving
- Verify-asserts without stop tests
- Downloading files
- Helpers
- Override browser profile preferences, install browser extensions, Headless mode
- Debugging Test.Automation framework
- Logging
- Performance measures
- Webdriver Extends
- More common locators
- Selenium-Grid-support
- Advanced Browser Capabilities and Options
- AngularJS synchronization
- Update App.config or appsettings.json
- Cross browser parallel test execution with testing-Cloud-Providers\SeleniumGrid
- Verifying Javascript Errors from browser
- Enabling Performance Log for Chrome
- Azure DevOps Support
- Edge browser Support
- Downloading and running Selenium Grid with Powershell
- Run Ocaramba tests with Docker container
- HTTP auth in Internet explorer
- ExtentReports Support