Search Unity

Performance Testing Extension for Unity Test Runner and IL2CPP

Discussion in 'Testing & Automation' started by sebas77, May 6, 2020.

  1. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,380
    Hi,

    I use successfully the API using tests that run with the Standalone Windows 64bit player, but this only if I run them with mono. if I run them with IL2CPP, I get this crash:

    Code (CSharp):
    1.  
    2. UnloadTime: 0.284600 ms
    3. ArgumentException: Type provided to TestRunCallbackAttribute does not implement ITestRunCallback
    4.   at UnityEngine.TestRunner.TestRunCallbackAttribute..ctor (System.Type type) [0x00000] in <00000000000000000000000000000000>:0
    5.   at System.MonoCustomAttrs.GetCustomAttributesBase (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inheritedOnly) [0x00000] in <00000000000000000000000000000000>:0
    6.   at System.MonoCustomAttrs.GetCustomAttributes (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inherit) [0x00000] in <00000000000000000000000000000000>:0
    7.   at UnityEngine.TestRunner.Utils.TestRunCallbackListener+<>c.<GetAllCallbacks>b__2_1 (System.Reflection.Assembly assembly) [0x00000] in <00000000000000000000000000000000>:0
    8.   at System.Runtime.CompilerServices.ConditionalWeakTable`2+CreateValueCallback[TKey,TValue].Invoke (TKey key) [0x00000] in <00000000000000000000000000000000>:0
    9.   at System.Linq.Enumerable+<SelectManyIterator>d__17`2[TSource,TResult].MoveNext () [0x00000] in <00000000000000000000000000000000>:0
    10.   at Newtonsoft.Json.Utilities.BidirectionalDictionary`2[TFirst,TSecond]..ctor (System.Collections.Generic.IEqualityComparer`1[T] firstEqualityComparer, System.Collections.Generic.IEqualityComparer`1[T] secondEqualityComparer, System.String duplicateFirstErrorMessage, System.String duplicateSecondErrorMessage) [0x00000] in <00000000000000000000000000000000>:0
    11.   at System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00000] in <00000000000000000000000000000000>:0
    12.   at UnityEngine.TestRunner.Utils.TestRunCallbackListener.GetAllCallbacks () [0x00000] in <00000000000000000000000000000000>:0
    13.   at UnityEngine.TestRunner.Utils.TestRunCallbackListener.InvokeAllCallbacks (System.Action`1[T] invoker) [0x00000] in <00000000000000000000000000000000>:0
    14.   at System.Action`1[T].Invoke (T obj) [0x00000] in <00000000000000000000000000000000>:0
    15.   at UnityEngine.Events.InvokableCall`1[T1].Invoke (T1 args0) [0x00000] in <00000000000000000000000000000000>:0
    16.   at UnityEngine.Events.UnityEvent`1[T0].Invoke (T0 arg0) [0x00000] in <00000000000000000000000000000000>:0
    17.   at UnityEngine.TestTools.TestRunner.PlaymodeTestsController+<Run>d__16.MoveNext () [0x00000] in <00000000000000000000000000000000>:0
    18.   at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <00000000000000000000000000000000>:0
    19.   at UnityEngine.TestTools.TestRunner.PlaymodeTestsController+<Start>d__12.MoveNext () [0x00000] in <00000000000000000000000000000000>:0
    20.   at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <00000000000000000000000000000000>:0
    21. UnityEngine.TestTools.TestRunner.<Start>d__12:MoveNext()
    22. UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
    23.  
    My code looks like:

    Code (CSharp):
    1. [Test, Performance]
    2.         public void TestStandardRandomInsert()
    3.         {
    4.             Measure.Method(() =>
    5.                     {
    6.                         for (int index = 0; index < dictionarySize; index++)
    7.                             standardDictionary[randomIndices[index]] = new Test(index);
    8.                     })
    9.                    .WarmupCount(3)
    10.                    .MeasurementCount(10)
    11.                    .IterationsPerMeasurement(10)
    12.                    .Run();
    13.         }
    if it's not my fault, can someone look at it? I really need to run those profilings with IL2CPP as well. Otherwise please let me know what I am doing wrong.
     
  2. Warnecke

    Warnecke

    Unity Technologies

    Joined:
    Nov 28, 2017
    Posts:
    72
  3. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,380
    thank you! I scanned and googled but didn't notice that thread. IT's surely the same thing
     
unityunity