Search Unity

Is this a bug in Unity Test Framework 2.0.1 preivew ?

Discussion in 'Testing & Automation' started by Will_ByteDance, Jul 20, 2022.

  1. Will_ByteDance

    Will_ByteDance

    Joined:
    Nov 25, 2020
    Posts:
    1
    There are tesecases of both Editor mode and Play mode in my project.
    Exception is thrown when switch to TestRunner widnow after finishing run all testcases in editor:

    ArgumentException: An item with the same key has already been added. Key: TestAssetManagerLoadBundleAsync
    UnityEditor.TestTools.TestRunner.GUI.TestListGUI.get_ResultsByKey () (at Packages/com.unity.test-framework/UnityEditor.TestRunner/GUI/Views/TestListGUIBase.cs:56)
    UnityEditor.TestTools.TestRunner.GUI.TestListTreeViewDataSource.FetchData () (at Packages/com.unity.test-framework/UnityEditor.TestRunner/GUI/TestListTreeView/TestListTreeViewDataSource.cs:28)
    UnityEditor.IMGUI.Controls.TreeViewDataSource.ReloadData () (at <c1da2d3b31364fe390649500fcb0efe5>:0)
    UnityEditor.IMGUI.Controls.TreeViewController.ReloadData () (at <c1da2d3b31364fe390649500fcb0efe5>:0)
    UnityEditor.TestTools.TestRunner.GUI.TestListGUI.Reload () (at Packages/com.unity.test-framework/UnityEditor.TestRunner/GUI/Views/TestListGUIBase.cs:301)
    UnityEditor.TestTools.TestRunner.TestRunnerWindow.<StartRetrieveTestList>b__21_0 (UnityEditor.TestTools.TestRunner.Api.ITestAdaptor rootTest) (at Packages/com.unity.test-framework/UnityEditor.TestRunner/TestRunnerWindow.cs:128)
    UnityEditor.TestTools.TestRunner.Api.TestRunnerApi+<>c__DisplayClass21_0.<RetrieveTestTree>b__1 (UnityEditor.TestTools.TestRunner.Api.ITestAdaptor testRoot) (at Packages/com.unity.test-framework/UnityEditor.TestRunner/Api/TestRunnerApi.cs:411)
    UnityEditor.TestTools.TestRunner.TestListJob.EditorUpdate () (at Packages/com.unity.test-framework/UnityEditor.TestRunner/TestRunner/Utils/TestListJob.cs:32)
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
    System.Delegate.DynamicInvokeImpl (System.Object[] args) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
    System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
    System.Delegate.DynamicInvoke (System.Object[] args) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
    UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at <c1da2d3b31364fe390649500fcb0efe5>:0)
     
  2. firegate666

    firegate666

    Joined:
    Nov 20, 2015
    Posts:
    19
    I figured out that by default if I run EditMode and PlayMode tests together, I'll get the same error on 2.*
    If I deselect one of them or click on a subtree in the tests, then it works.

    My test project only has 2 tests and they have different names, so that can't be the issue