cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to find Test Logs, not sure if they are being logged

Highlighted
Occasional Contributor

Unable to find Test Logs, not sure if they are being logged

Hi,

 

I am using SpecFlow and Nunit 3 with NUnit3Adaptor.

 

Within my test steps I am logging some test messages and capturing screenthot but I can't find anything in the bin folder nor in the Project directory. I don't even see TestResults folder.

 

LaunchApplication();

IDriver Driver = new LocalDriver();
Driver.Log.Message("Application Launched");
Driver.Log.Screenshot(test.controlGrid, "Screenhot of a Grid table");
Driver.Log.Message("Test Again");
Assert.Fail();// force failing in case the logs are being cleared

 

Am I missing something here ? Can anyone please help me how to use the TestLeft's capturing Test Log and screenshot funtionality?

Thanks in advance

 

 

3 REPLIES 3
Community Hero

Re: Unable to find Test Logs, not sure if they are being logged

Hi,

 

> I am using SpecFlow and Nunit 3 with NUnit3Adaptor.

What about TestLeft (as this is TestLeft's dedicated forum) ?

 

> Am I missing something here ?

Do you save test log? https://support.smartbear.com/testleft/docs/using/creating-tests/log/viewing-logs.html, https://support.smartbear.com/testleft/docs/using/creating-tests/log/saving-logs.html

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Occasional Contributor

Re: Unable to find Test Logs, not sure if they are being logged

Thanks Alex, 

 

I know whats happening, when we add a TestLeft to our project it creates TestFixtureBase with NUnit hook attributes ([OneTimeSetUp], [OneTimeTearDown] ..etc) methods

 

[OneTimeSetUp]
public void InitializeFixture()
{
_driver.Log.OpenFolder(TestContext.CurrentContext.Test.FullName);
}

[OneTimeTearDown]
public void FinalizeFixture()
{
_driver.Log.CloseFolder();
_driver.Log.Save(TestContext.CurrentContext.TestDirectory + @"\TestResults", Log.Format.Html);
}

[SetUp]
public void TestSetUp()
{
_driver.Log.OpenFolder(TestContext.CurrentContext.Test.Name);
}

[TearDown]....

 

When running the NUnit tests, the logging and saving logs, works fine. But when we add SpecFlow on top of this, then these methods with NUnit hook attribute won't get run as SpecFlow has its own hook attributes [BeforeScenario], [BeforeTestRun], [AfterScenario]... etc.

 

So we would need to replace [OneTimeSetUp] to [BeforeTestRun] and [OneTimeTearDown] to [AfterTestRun] and make the binding methods static and add "[Binding]" on top of the class signature

Community Hero

Re: Unable to find Test Logs, not sure if they are being logged

@VinnyK :

Hi,

 

Thank you for the detailed description. Hope it will help someone else who will use the configuration like yours.

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================