reportportal / agent-dotnet-reqnroll

ReportPortal agent for Reqnroll BDD Test Framework
Apache License 2.0
1 stars 1 forks source link

Logs are not written #3

Closed 4OTbIPE closed 1 month ago

4OTbIPE commented 6 months ago

After migration from SpecFlow to Reqnroll, and from Specflow-Agent to Reqnroll-Agent, logs with NLog and ReportPortal.NLog logs have stopped being written to the ReportPortal.

There is a line in the ReportPortal.Shared logs "1-Automation : Cannot track OnBeforeLaunchStarting event". Maybe it has something to do with it.

nvborisenko commented 6 months ago

@4OTbIPE please expand the entire error message including stacktrace.

4OTbIPE commented 6 months ago

@nvborisenko ReportPortal.Shared.*****.log:

AnalyticsReportEventsObserver Error: 0 : 13:41:41.9926371 : 1-Automation : Cannot track OnBeforeLaunchStarting event: System.Net.Http.HttpRequestException: The proxy tunnel request to proxy 'http://10.0.25.3:8080/' failed with status code '407'." at System.Net.Http.HttpConnectionPool.EstablishProxyTunnelAsync(Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem queueItem) at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpClient.g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) at ReportPortal.Shared.Extensibility.Embedded.Analytics.AnalyticsReportEventsObserver.<>cDisplayClass26_0.<b0>d.MoveNext()

But I discovered that when using SpecFlow and the corresponding agent, the same log file with the same contents is created. But at the same time, the logs are written correctly to the portal. However, when switching to Reqnroll and the corresponding agent, the logs stop being written. I would like to note that logs specifically from NLog (logger.Debug(), etc.) are not written. The Reqnroll steps themselves are displayed correctly in the portal, as are AssertionExceptions and their text and stack trace.

I also noticed that in ReportPortal.json you need to specify the apiKey, but IntelliSense also asks you to specify the authentication field

nvborisenko commented 5 months ago

Reproduced, tried to fix - no success. Please be patient, seems it will not be quick-fix.

victorBychinski commented 2 months ago

@4OTbIPE hey. Maybe It would be helpful for you - it my case the combination of Serilog, Reqnroll and ReportPortal.Serilog works - serilog logs are shown on the reportPortal

image
nvborisenko commented 1 month ago

Just verified with Reqnroll 2.0.3 (NUnit provider) - it works:

[Given("the first number is {int}")]
public void GivenTheFirstNumberIs(int number)
{
    ReportPortal.Shared.Context.Current.Log.Info("my test message");
    ReportPortal.Shared.Context.Current.Log.Info("my next test message");
}

[Given("the second number is {int}")]
public void GivenTheSecondNumberIs(int number)
{
    ReportPortal.Shared.Context.Current.Log.Info("my test message");
}

image

I guess it was fixed by Reqnroll team.

UPD: And it works with MsTest provider. Please just upgrade to the latest version. I am closing this issue as not reproducible anymore.