Rerun tests button does not rerun tests
Closed this issue · 5 comments
Thanks for picking up this project!
When running with xunit 2 on MonoDevelop 6, the Rerun Tests button seems to be non-functional. My expectation is that it will rerun the most recent test(s), but instead it seems to rebuild the test project and then do nothing.
Note that "Rerun Tests" button is on Test Results panel. Will do further investigation on this issue. Thanks for reporting it.
Just found that this issue might be caused by an unhandled exception,
System.NullReferenceException: Object reference not set to an instance of an object
at MonoDevelop.UnitTesting.TestSession..ctor (MonoDevelop.UnitTesting.UnitTest test, MonoDevelop.Projects.ExecutionContext context, MonoDevelop.UnitTesting.TestResultsPad resultsPad, System.Threading.CancellationTokenSource cs) [0x0000d] in /Users/builder/data/lanes/3190/23357635/source/monodevelop/main/src/addins/MonoDevelop.UnitTesting/Services/UnitTestService.cs:405
at MonoDevelop.UnitTesting.UnitTestService+<RunTest>c__async0.MoveNext () [0x002c4] in /Users/builder/data/lanes/3190/23357635/source/monodevelop/main/src/addins/MonoDevelop.UnitTesting/Services/UnitTestService.cs:152
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /private/tmp/source-mono-4.4.0/bockbuild-mono-4.4.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /private/tmp/source-mono-4.4.0/bockbuild-mono-4.4.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /private/tmp/source-mono-4.4.0/bockbuild-mono-4.4.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /private/tmp/source-mono-4.4.0/bockbuild-mono-4.4.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /private/tmp/source-mono-4.4.0/bockbuild-mono-4.4.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113
at MonoDevelop.UnitTesting.UnitTestService+<RunTest>c__async0.MoveNext () [0x001d7] in /Users/builder/data/lanes/3190/23357635/source/monodevelop/main/src/addins/MonoDevelop.UnitTesting/Services/UnitTestService.cs:133
This TestSession
constructor is called in UnitTestServices
, in this method
internal static async Task RunTest (UnitTest test, MonoDevelop.Projects.ExecutionContext context, bool buildOwnerObject, bool checkCurrentRunOperation, CancellationTokenSource cs)
This overloading method is called by another version,
public static AsyncOperation RunTest (UnitTest test, MonoDevelop.Projects.ExecutionContext context)
In turn, this method is used in "Rerun Tests" button in TestResultsPad
,
[CommandHandler (TestCommands.RerunTest)]
protected void OnRerunTest ()
{
UnitTest test = GetSelectedTest ();
if (test == null)
return;
UnitTestService.RunTest (test, null);
}
Note that the second parameter is indeed null
, which leads to the final exception.
More testing shows that NUnit in Xamarin Studio 6.0 also failed at this exception. Related code indicates a possible bug. Will report back to Xamarin.
Temp close this as there is not much we can do on our side. Once the MonoDevelop/Xamarin bug is closed, will revisit this.