Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Bug Using the [UnityTest] attribute combined with the [Retry] attribute causes error

Discussion in 'Testing & Automation' started by Stormy102, May 18, 2019.

  1. Stormy102

    Stormy102

    Joined:
    Jan 17, 2014
    Posts:
    495
    Using the Retry attribute on the UnityTest test fixture results in an InvalidCastException. I would like to be able to use the Retry attribute on Unity Tests as we've got some Unit Tests which have a tendency to fail occasionally due to the way that they are run. As a work around, we've used a for loop, but it would be nice to have this fixed. I've also reported it through the Unity Bug reporter. Case number is 1155655.

    Code (CSharp):
    1. InvalidCastException: Specified cast is not valid.
    2. UnityEngine.TestRunner.NUnitExtensions.Runner.CoroutineTestWorkItem+<PerformWork>d__6.MoveNext () (at Library/PackageCache/com.unity.test-framework@1.0.13/UnityEngine.TestRunner/NUnitExtensions/Runner/CoroutineTestWorkItem.cs:54)
    3. UnityEngine.TestRunner.NUnitExtensions.Runner.CompositeWorkItem+<RunChildren>d__16.MoveNext () (at Library/PackageCache/com.unity.test-framework@1.0.13/UnityEngine.TestRunner/NUnitExtensions/Runner/CompositeWorkItem.cs:200)
    4. UnityEngine.TestRunner.NUnitExtensions.Runner.CompositeWorkItem+<PerformWork>d__12.MoveNext () (at Library/PackageCache/com.unity.test-framework@1.0.13/UnityEngine.TestRunner/NUnitExtensions/Runner/CompositeWorkItem.cs:76)
    5. UnityEngine.TestRunner.NUnitExtensions.Runner.CompositeWorkItem+<RunChildren>d__16.MoveNext () (at Library/PackageCache/com.unity.test-framework@1.0.13/UnityEngine.TestRunner/NUnitExtensions/Runner/CompositeWorkItem.cs:200)
    6. UnityEngine.TestRunner.NUnitExtensions.Runner.CompositeWorkItem+<PerformWork>d__12.MoveNext () (at Library/PackageCache/com.unity.test-framework@1.0.13/UnityEngine.TestRunner/NUnitExtensions/Runner/CompositeWorkItem.cs:76)
    7. UnityEngine.TestRunner.NUnitExtensions.Runner.CompositeWorkItem+<RunChildren>d__16.MoveNext () (at Library/PackageCache/com.unity.test-framework@1.0.13/UnityEngine.TestRunner/NUnitExtensions/Runner/CompositeWorkItem.cs:200)
    8. UnityEngine.TestRunner.NUnitExtensions.Runner.CompositeWorkItem+<PerformWork>d__12.MoveNext () (at Library/PackageCache/com.unity.test-framework@1.0.13/UnityEngine.TestRunner/NUnitExtensions/Runner/CompositeWorkItem.cs:76)
    9. UnityEngine.TestRunner.NUnitExtensions.Runner.CompositeWorkItem+<RunChildren>d__16.MoveNext () (at Library/PackageCache/com.unity.test-framework@1.0.13/UnityEngine.TestRunner/NUnitExtensions/Runner/CompositeWorkItem.cs:200)
    10. UnityEngine.TestRunner.NUnitExtensions.Runner.CompositeWorkItem+<PerformWork>d__12.MoveNext () (at Library/PackageCache/com.unity.test-framework@1.0.13/UnityEngine.TestRunner/NUnitExtensions/Runner/CompositeWorkItem.cs:76)
    11. UnityEngine.TestTools.TestRunner.PlaymodeTestsController+<TestRunnerCorotine>d__15.MoveNext () (at Library/PackageCache/com.unity.test-framework@1.0.13/UnityEngine.TestRunner/TestRunner/PlaymodeTestsController.cs:69)
    12. UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Scripting/Coroutines.cs:17)