Reputation: 6126
I am writing a selenium project with test cases, here's a link to my earlier post about it for further information. Here's my project structure:
SeleniumTestSuite
+-- Properties
+-- References
+-- Pages
| +-- BasePage.cs
+-- App.config
+-- HomePageTest.cs
+-- packages.config
I am using common-logging for my logging implementation. Here's the code inside of BasePage.cs
using Common.Logging;
using OpenQA.Selenium;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SeleniumTestSuite.pages
{
class BasePage
{
private static readonly ILog log = LogManager.GetLogger("BasePage");
private IWebDriver driver;
private By banner = By.ClassName("banner");
public BasePage(IWebDriver driver)
{
this.driver = driver;
}
public bool isBannerVisible()
{
log.Info("Testing default page body");
return driver.FindElement(banner).Displayed;
}
}
}
But when I run my test case:
public void testBasePage()
{
basePage = new BasePage(driver);
Assert.IsTrue(basePage.isBannerVisible());
}
I just get the following in the output window:
------ Discover test started ------
========== Discover test finished: 1 found (0:00:00.1990199) ==========
------ Run test started ------
========== Run test finished: 1 run (0:00:07.3237323) ==========
I don't see any of the log information. Here's my App.config
:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="common">
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
</sectionGroup>
</configSections>
<common>
<logging>
<factoryAdapter type="Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter, Common.Logging">
<arg key="level" value="INFO" />
<arg key="showLogName" value="true" />
<arg key="showDateTime" value="true" />
<arg key="dateTimeFormat" value="yyyy/MM/dd HH:mm:ss:fff" />
</factoryAdapter>
</logging>
</common>
</configuration>
What is the issue here?
Upvotes: 0
Views: 2608
Reputation: 973
I've Selenium tests running from my test assembly using XUnit, it's fairly simple to output data:
https://xunit.github.io/docs/capturing-output.html
At the end, I've the full logs attached to the test cases on Visual Studio Online
Upvotes: 1