reportportal / agent-net-vstest

Logger extension for VsTest
Apache License 2.0
8 stars 10 forks source link

VStest failed to send statistics to reportportal web #18

Closed heilwood closed 5 years ago

heilwood commented 5 years ago

When executing tests using vstest the results are not appear in reportportal web.

Such error found in log:

  1. Error: TpTrace Error: 0 : 7324, 3, 2019/03/15, 14:06:40.942, 14052382115029, vstest.console.exe, InternalTestLoggerEvents.SendTestResult: Exception occurred while calling handler of type ReportPortal.VSTest.TestLogger.ReportPortalLogger for TestResultEventArgs: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at ReportPortal.VSTest.TestLogger.ReportPortalLogger.Events_TestResult(Object sender, TestResultEventArgs e) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Delegate.DynamicInvokeImpl(Object[] args) at Microsoft.VisualStudio.TestPlatform.Utilities.MulticastDelegateUtilities.SafeInvoke(Delegate delegates, Object sender, EventArgs args, String traceDisplayName) TpTrace Error: 0 : 7324, 3, 2019/03/15, 14:06:40.942, 14052382148185, vstest.console.exe, InternalTestLoggerEvents.SendTestResult: Exception occurred while calling handler of type ReportPortal.VSTest.TestLogger.ReportPortalLogger for TestResultEventArgs: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at ReportPortal.VSTest.TestLogger.ReportPortalLogger.Events_TestResult(Object sender, TestResultEventArgs e) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Delegate.DynamicInvokeImpl(Object[] args) at Microsoft.VisualStudio.TestPlatform.Utilities.MulticastDelegateUtilities.SafeInvoke(Delegate delegates, Object sender, EventArgs args, String traceDisplayName)

  2. Error: TpTrace Error: 0 : 7324, 3, 2019/03/15, 14:06:48.606, 14052458866824, vstest.console.exe, InternalTestLoggerEvents.SendTestRunComplete: Exception occurred while calling handler of type ReportPortal.VSTest.TestLogger.ReportPortalLogger for TestRunCompleteEventArgs: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: The tasks argument included a null value. Parameter name: tasks at System.Threading.Tasks.TaskFactory.CheckMultiContinuationTasksAndCopy(Task[] tasks) at System.Threading.Tasks.TaskFactory1.ContinueWhenAllImpl(Task[] tasks, Func2 continuationFunction, Action1 continuationAction, TaskContinuationOptions continuationOptions, CancellationToken cancellationToken, TaskScheduler scheduler, StackCrawlMark& stackMark) at System.Threading.Tasks.TaskFactory.ContinueWhenAll[TResult](Task[] tasks, Func2 continuationFunction) at ReportPortal.Shared.Reporter.TestReporter.Finish(FinishTestItemRequest request) at ReportPortal.VSTest.TestLogger.ReportPortalLogger.Events_TestRunComplete(Object sender, TestRunCompleteEventArgs e) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Delegate.DynamicInvokeImpl(Object[] args) at Microsoft.VisualStudio.TestPlatform.Utilities.MulticastDelegateUtilities.SafeInvoke(Delegate delegates, Object sender, EventArgs args, String traceDisplayName)

My json:

{ "$schema": "https://raw.githubusercontent.com/reportportal/agent-net-vstest/master/ReportPortal.VSTest.TestLogger/ReportPortal.config.schema", "enabled": true, "server": { "url": "http://myhost:8080/api/v1/", "project": "superadmin_personal", "authentication": { "uuid": "74c2b0f9-90f4-474f-bcaf-52fb48249ce6" } }, "launch": { "name": "superadmin_TEST_EXAMPLE", "description": "this is description", "debugMode": true, "tags": ["t1", "t2"] } }

nvborisenko commented 5 years ago

Try to upgrade ReportPortal.Shared package.

heilwood commented 5 years ago

TpTrace Error: 0 : 4616, 3, 2019/03/18, 06:32:15.828, 16371736106253, vstest.console.exe, InternalTestLoggerEvents.SendTestResult: Exception occurred while calling handler of type ReportPortal.VSTest.TestLogger.ReportPortalLogger for TestResultEventArgs: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at ReportPortal.VSTest.TestLogger.ReportPortalLogger.Events_TestResult(Object sender, TestResultEventArgs e) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Delegate.DynamicInvokeImpl(Object[] args) at Microsoft.VisualStudio.TestPlatform.Utilities.MulticastDelegateUtilities.SafeInvoke(Delegate delegates, Object sender, EventArgs args, String traceDisplayName)

TpTrace Error: 0 : 4616, 3, 2019/03/18, 06:32:21.154, 16371789384666, vstest.console.exe, InternalTestLoggerEvents.SendTestRunComplete: Exception occurred while calling handler of type ReportPortal.VSTest.TestLogger.ReportPortalLogger for TestRunCompleteEventArgs: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: The tasks argument included a null value. Parameter name: tasks at System.Threading.Tasks.TaskFactory.CheckMultiContinuationTasksAndCopy(Task[] tasks) at System.Threading.Tasks.TaskFactory1.ContinueWhenAllImpl(Task[] tasks, Func2 continuationFunction, Action1 continuationAction, TaskContinuationOptions continuationOptions, CancellationToken cancellationToken, TaskScheduler scheduler, StackCrawlMark& stackMark) at System.Threading.Tasks.TaskFactory.ContinueWhenAll[TResult](Task[] tasks, Func2 continuationFunction) at ReportPortal.Shared.Reporter.TestReporter.Finish(FinishTestItemRequest request) at ReportPortal.VSTest.TestLogger.ReportPortalLogger.Events_TestRunComplete(Object sender, TestRunCompleteEventArgs e) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Delegate.DynamicInvokeImpl(Object[] args) at Microsoft.VisualStudio.TestPlatform.Utilities.MulticastDelegateUtilities.SafeInvoke(Delegate delegates, Object sender, EventArgs args, String traceDisplayName)

heilwood commented 5 years ago

looks like same error

nvborisenko commented 5 years ago

Please share you versions of packages. I'wondering about ReportPortal packages, MSTestFramework, MsTestFramework.TestAdapter. This issue is easy for fixing, need just to reproduce it.

heilwood commented 5 years ago

<package id="ReportPortal.Client" version="2.1.10" targetFramework="net461" /> <package id="ReportPortal.Shared" version="2.1.4" targetFramework="net461" /> <package id="ReportPortal.VSTest.TestLogger" version="2.0.0-beta.4" targetFramework="net461" /> <package id="SpecRun.Runner" version="1.8.5" targetFramework="net461" /> <package id="SpecRun.SpecFlow" version="1.8.5" targetFramework="net461" />

This line should be added in Default.srporile of SpecRun:

<VSTest testRetryResults="Unified" passRateAbsolute="1"/>

Im not using MsTestFramework, im running tests using SpecRun which are integrated with vsts.

nvborisenko commented 5 years ago

Is it possible to prepare simple solution with dummy tests to reproduce the issue? Thanks you.

heilwood commented 5 years ago

not today, it will take several hours :)

heilwood commented 5 years ago

Here is it: Common.Test.Automation.zip

P.S. Sorry for not adding to source control, have no time :)

nvborisenko commented 5 years ago

Thanks. How to execute tests with integrated RP to reproduce the issue?

nvborisenko commented 5 years ago

Reproduced it via 'vstest'.

nvborisenko commented 5 years ago

Fix is available in 2.0.0-beta.5