Ask a Question

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

VinnyK
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
AlexKaras
Champion Level 2

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 Champion]
____
[Community Champions] 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. Posts made by [Community Champions]
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.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
VinnyK
Occasional Contributor

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

AlexKaras
Champion Level 2

@VinnyK :

Hi,

 

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

 

Regards,
  /Alex [Community Champion]
____
[Community Champions] 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. Posts made by [Community Champions]
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.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
cancel
Showing results for 
Search instead for 
Did you mean: