Initial Commit
This commit is contained in:
parent
53eb92e9af
commit
270ab7d11f
15341 changed files with 700234 additions and 0 deletions
|
@ -0,0 +1,48 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor.TestTools.TestRunner.Api;
|
||||
using UnityEngine.TestRunner.NUnitExtensions;
|
||||
using UnityEngine.TestTools;
|
||||
|
||||
namespace UnityEditor.TestTools.TestRunner
|
||||
{
|
||||
internal class CachingTestListProvider
|
||||
{
|
||||
private readonly ITestListProvider m_InnerTestListProvider;
|
||||
private readonly ITestListCache m_TestListCache;
|
||||
private readonly ITestAdaptorFactory m_TestAdaptorFactory;
|
||||
public CachingTestListProvider(ITestListProvider innerTestListProvider, ITestListCache testListCache, ITestAdaptorFactory testAdaptorFactory)
|
||||
{
|
||||
m_InnerTestListProvider = innerTestListProvider;
|
||||
m_TestListCache = testListCache;
|
||||
m_TestAdaptorFactory = testAdaptorFactory;
|
||||
}
|
||||
|
||||
public IEnumerator<ITestAdaptor> GetTestListAsync(TestPlatform platform)
|
||||
{
|
||||
var testFromCache = m_TestListCache.GetTestFromCacheAsync(platform);
|
||||
while (testFromCache.MoveNext())
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
|
||||
|
||||
if (testFromCache.Current != null)
|
||||
{
|
||||
yield return testFromCache.Current;
|
||||
}
|
||||
else
|
||||
{
|
||||
var test = m_InnerTestListProvider.GetTestListAsync(platform);
|
||||
while (test.MoveNext())
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
|
||||
test.Current.ParseForNameDuplicates();
|
||||
m_TestListCache.CacheTest(platform, test.Current);
|
||||
yield return m_TestAdaptorFactory.Create(test.Current);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 26f3e7301af463c4ca72fa98d59b429e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,13 @@
|
|||
using System.Linq;
|
||||
using UnityEngine.TestTools.Utils;
|
||||
|
||||
namespace UnityEditor.TestTools.TestRunner
|
||||
{
|
||||
internal class EditorAssembliesProxy : IEditorAssembliesProxy
|
||||
{
|
||||
public IAssemblyWrapper[] loadedAssemblies
|
||||
{
|
||||
get { return EditorAssemblies.loadedAssemblies.OrderBy(a => a.FullName).Select(x => new EditorAssemblyWrapper(x)).ToArray(); }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f96d0ea807c081145a1170ed1b6d71e0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,18 @@
|
|||
using System.Reflection;
|
||||
using UnityEngine.TestTools.Utils;
|
||||
|
||||
namespace UnityEditor.TestTools.TestRunner
|
||||
{
|
||||
internal class EditorAssemblyWrapper : AssemblyWrapper
|
||||
{
|
||||
public EditorAssemblyWrapper(Assembly assembly)
|
||||
: base(assembly) {}
|
||||
|
||||
public override AssemblyName[] GetReferencedAssemblies()
|
||||
{
|
||||
return Assembly.GetReferencedAssemblies();
|
||||
}
|
||||
|
||||
public override string Location { get { return Assembly.Location; } }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 20cdb37e6fea6d946bbb84d2c923db85
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,17 @@
|
|||
using UnityEditor.Scripting.ScriptCompilation;
|
||||
|
||||
namespace UnityEditor.TestTools.TestRunner
|
||||
{
|
||||
internal class EditorCompilationInterfaceProxy : IEditorCompilationInterfaceProxy
|
||||
{
|
||||
public ScriptAssembly[] GetAllEditorScriptAssemblies()
|
||||
{
|
||||
return EditorCompilationInterface.Instance.GetAllEditorScriptAssemblies(EditorCompilationInterface.GetAdditionalEditorScriptCompilationOptions());
|
||||
}
|
||||
|
||||
public PrecompiledAssembly[] GetAllPrecompiledAssemblies()
|
||||
{
|
||||
return EditorCompilationInterface.Instance.GetAllPrecompiledAssemblies();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c9b23632c77de204abfe8bf7168d48c0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,120 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using UnityEditor.Scripting.ScriptCompilation;
|
||||
using UnityEngine.TestTools;
|
||||
using UnityEngine.TestTools.Utils;
|
||||
|
||||
namespace UnityEditor.TestTools.TestRunner
|
||||
{
|
||||
internal class EditorLoadedTestAssemblyProvider : IEditorLoadedTestAssemblyProvider
|
||||
{
|
||||
private const string k_NunitAssemblyName = "nunit.framework";
|
||||
private const string k_TestRunnerAssemblyName = "UnityEngine.TestRunner";
|
||||
internal const string k_PerformanceTestingAssemblyName = "Unity.PerformanceTesting";
|
||||
|
||||
private readonly IEditorAssembliesProxy m_EditorAssembliesProxy;
|
||||
private readonly ScriptAssembly[] m_AllEditorScriptAssemblies;
|
||||
private readonly PrecompiledAssembly[] m_AllPrecompiledAssemblies;
|
||||
|
||||
public EditorLoadedTestAssemblyProvider(IEditorCompilationInterfaceProxy compilationInterfaceProxy, IEditorAssembliesProxy editorAssembliesProxy)
|
||||
{
|
||||
m_EditorAssembliesProxy = editorAssembliesProxy;
|
||||
m_AllEditorScriptAssemblies = compilationInterfaceProxy.GetAllEditorScriptAssemblies();
|
||||
m_AllPrecompiledAssemblies = compilationInterfaceProxy.GetAllPrecompiledAssemblies();
|
||||
}
|
||||
|
||||
public List<IAssemblyWrapper> GetAssembliesGroupedByType(TestPlatform mode)
|
||||
{
|
||||
var assemblies = GetAssembliesGroupedByTypeAsync(mode);
|
||||
while (assemblies.MoveNext())
|
||||
{
|
||||
}
|
||||
|
||||
return assemblies.Current.Where(pair => mode.IsFlagIncluded(pair.Key)).SelectMany(pair => pair.Value).ToList();
|
||||
}
|
||||
|
||||
public IEnumerator<IDictionary<TestPlatform, List<IAssemblyWrapper>>> GetAssembliesGroupedByTypeAsync(TestPlatform mode)
|
||||
{
|
||||
IAssemblyWrapper[] loadedAssemblies = m_EditorAssembliesProxy.loadedAssemblies;
|
||||
|
||||
IDictionary<TestPlatform, List<IAssemblyWrapper>> result = new Dictionary<TestPlatform, List<IAssemblyWrapper>>()
|
||||
{
|
||||
{TestPlatform.EditMode, new List<IAssemblyWrapper>() },
|
||||
{TestPlatform.PlayMode, new List<IAssemblyWrapper>() }
|
||||
};
|
||||
var filteredAssemblies = FilterAssembliesWithTestReference(loadedAssemblies);
|
||||
|
||||
foreach (var loadedAssembly in filteredAssemblies)
|
||||
{
|
||||
var assemblyName = new FileInfo(loadedAssembly.Location).Name;
|
||||
var scriptAssemblies = m_AllEditorScriptAssemblies.Where(x => x.Filename == assemblyName).ToList();
|
||||
var precompiledAssemblies = m_AllPrecompiledAssemblies.Where(x => new FileInfo(x.Path).Name == assemblyName).ToList();
|
||||
if (scriptAssemblies.Count < 1 && precompiledAssemblies.Count < 1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var assemblyFlags = scriptAssemblies.Any() ? scriptAssemblies.Single().Flags : precompiledAssemblies.Single().Flags;
|
||||
var assemblyType = (assemblyFlags & AssemblyFlags.EditorOnly) == AssemblyFlags.EditorOnly ? TestPlatform.EditMode : TestPlatform.PlayMode;
|
||||
result[assemblyType].Add(loadedAssembly);
|
||||
yield return null;
|
||||
}
|
||||
|
||||
yield return result;
|
||||
}
|
||||
|
||||
private IAssemblyWrapper[] FilterAssembliesWithTestReference(IAssemblyWrapper[] loadedAssemblies)
|
||||
{
|
||||
var filteredResults = new Dictionary<IAssemblyWrapper, bool>();
|
||||
foreach (var assembly in loadedAssemblies)
|
||||
{
|
||||
FilterAssemblyForTestReference(assembly, loadedAssemblies, filteredResults);
|
||||
}
|
||||
|
||||
return filteredResults.Where(pair => pair.Value).Select(pair => pair.Key).ToArray();
|
||||
}
|
||||
|
||||
private void FilterAssemblyForTestReference(IAssemblyWrapper assemblyToFilter, IAssemblyWrapper[] loadedAssemblies, IDictionary<IAssemblyWrapper, bool> filterResults)
|
||||
{
|
||||
if (filterResults.ContainsKey(assemblyToFilter))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var references = assemblyToFilter.GetReferencedAssemblies();
|
||||
if (references.Any(IsTestReference))
|
||||
{
|
||||
filterResults[assemblyToFilter] = true;
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var reference in references)
|
||||
{
|
||||
var referencedAssembly = loadedAssemblies.FirstOrDefault(a => a.Name.Name == reference.Name);
|
||||
if (referencedAssembly == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
FilterAssemblyForTestReference(referencedAssembly, loadedAssemblies, filterResults);
|
||||
|
||||
if (filterResults[referencedAssembly])
|
||||
{
|
||||
filterResults[assemblyToFilter] = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
filterResults[assemblyToFilter] = false;
|
||||
}
|
||||
|
||||
private static bool IsTestReference(AssemblyName assemblyName)
|
||||
{
|
||||
return assemblyName.Name == k_NunitAssemblyName ||
|
||||
assemblyName.Name == k_TestRunnerAssemblyName ||
|
||||
assemblyName.Name == k_PerformanceTestingAssemblyName;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 033c884ba52437d49bc55935939ef1c6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,9 @@
|
|||
using UnityEngine.TestTools.Utils;
|
||||
|
||||
namespace UnityEditor.TestTools.TestRunner
|
||||
{
|
||||
internal interface IEditorAssembliesProxy
|
||||
{
|
||||
IAssemblyWrapper[] loadedAssemblies { get; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 98808b11e78f6c84a841a6b4bc5a29d2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,10 @@
|
|||
using UnityEditor.Scripting.ScriptCompilation;
|
||||
|
||||
namespace UnityEditor.TestTools.TestRunner
|
||||
{
|
||||
internal interface IEditorCompilationInterfaceProxy
|
||||
{
|
||||
ScriptAssembly[] GetAllEditorScriptAssemblies();
|
||||
PrecompiledAssembly[] GetAllPrecompiledAssemblies();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 28c8fcb831e6e734a9f564bc4f495eba
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,12 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine.TestTools;
|
||||
using UnityEngine.TestTools.Utils;
|
||||
|
||||
namespace UnityEditor.TestTools.TestRunner
|
||||
{
|
||||
internal interface IEditorLoadedTestAssemblyProvider
|
||||
{
|
||||
List<IAssemblyWrapper> GetAssembliesGroupedByType(TestPlatform mode);
|
||||
IEnumerator<IDictionary<TestPlatform, List<IAssemblyWrapper>>> GetAssembliesGroupedByTypeAsync(TestPlatform mode);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 936b6288befc460409cfdff3ac92fc95
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,13 @@
|
|||
using System.Collections.Generic;
|
||||
using NUnit.Framework.Interfaces;
|
||||
using UnityEditor.TestTools.TestRunner.Api;
|
||||
using UnityEngine.TestTools;
|
||||
|
||||
namespace UnityEditor.TestTools.TestRunner
|
||||
{
|
||||
interface ITestListCache
|
||||
{
|
||||
void CacheTest(TestPlatform platform, ITest test);
|
||||
IEnumerator<ITestAdaptor> GetTestFromCacheAsync(TestPlatform platform);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a704c010bcdb1ec4a9f3417b3c393164
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,13 @@
|
|||
using System.Collections.Generic;
|
||||
using NUnit.Framework.Interfaces;
|
||||
using UnityEngine.TestRunner.TestLaunchers;
|
||||
using UnityEngine.TestTools;
|
||||
|
||||
namespace UnityEditor.TestTools.TestRunner
|
||||
{
|
||||
interface ITestListCacheData
|
||||
{
|
||||
List<TestPlatform> platforms { get; }
|
||||
List<ITest> cachedData { get; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7043e9a330ac2d84a80a965ada4589ad
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,11 @@
|
|||
using System.Collections.Generic;
|
||||
using NUnit.Framework.Interfaces;
|
||||
using UnityEngine.TestTools;
|
||||
|
||||
namespace UnityEditor.TestTools.TestRunner
|
||||
{
|
||||
interface ITestListProvider
|
||||
{
|
||||
IEnumerator<ITest> GetTestListAsync(TestPlatform platform);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 64689f8b25eadac4da519e96f514b653
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,56 @@
|
|||
using System.Collections.Generic;
|
||||
using NUnit.Framework.Interfaces;
|
||||
using UnityEditor.TestTools.TestRunner.Api;
|
||||
using UnityEngine.TestRunner.TestLaunchers;
|
||||
using UnityEngine.TestTools;
|
||||
|
||||
namespace UnityEditor.TestTools.TestRunner
|
||||
{
|
||||
internal class TestListCache : ITestListCache
|
||||
{
|
||||
private readonly ITestAdaptorFactory m_TestAdaptorFactory;
|
||||
private readonly IRemoteTestResultDataFactory m_TestResultDataFactory;
|
||||
private readonly ITestListCacheData m_TestListCacheData;
|
||||
|
||||
public TestListCache(ITestAdaptorFactory testAdaptorFactory, IRemoteTestResultDataFactory testResultDataFactory, ITestListCacheData testListCacheData)
|
||||
{
|
||||
m_TestAdaptorFactory = testAdaptorFactory;
|
||||
m_TestResultDataFactory = testResultDataFactory;
|
||||
m_TestListCacheData = testListCacheData;
|
||||
}
|
||||
|
||||
public void CacheTest(TestPlatform platform, ITest test)
|
||||
{
|
||||
var index = m_TestListCacheData.platforms.IndexOf(platform);
|
||||
if (index < 0)
|
||||
{
|
||||
m_TestListCacheData.cachedData.Add(test);
|
||||
m_TestListCacheData.platforms.Add(platform);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_TestListCacheData.cachedData[index] = test;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerator<ITestAdaptor> GetTestFromCacheAsync(TestPlatform platform)
|
||||
{
|
||||
var index = m_TestListCacheData.platforms.IndexOf(platform);
|
||||
if (index < 0)
|
||||
{
|
||||
yield return null;
|
||||
yield break;
|
||||
}
|
||||
|
||||
var testData = m_TestListCacheData.cachedData[index];
|
||||
yield return m_TestAdaptorFactory.Create(testData);
|
||||
}
|
||||
|
||||
[Callbacks.DidReloadScripts]
|
||||
private static void ScriptReloaded()
|
||||
{
|
||||
TestListCacheData.instance.cachedData.Clear();
|
||||
TestListCacheData.instance.platforms.Clear();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d685d97a1eb004f49afea0cc982ff728
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,27 @@
|
|||
using System.Collections.Generic;
|
||||
using NUnit.Framework.Interfaces;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestRunner.TestLaunchers;
|
||||
using UnityEngine.TestTools;
|
||||
|
||||
namespace UnityEditor.TestTools.TestRunner
|
||||
{
|
||||
internal class TestListCacheData : ScriptableSingleton<TestListCacheData>, ITestListCacheData
|
||||
{
|
||||
[SerializeField]
|
||||
private List<TestPlatform> m_Platforms = new List<TestPlatform>();
|
||||
|
||||
[SerializeField]
|
||||
private List<ITest> m_CachedData = new List<ITest>();
|
||||
|
||||
public List<TestPlatform> platforms
|
||||
{
|
||||
get { return m_Platforms; }
|
||||
}
|
||||
|
||||
public List<ITest> cachedData
|
||||
{
|
||||
get { return m_CachedData; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f1b6399349763114d9361bc6dfcd025b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor.TestTools.TestRunner.Api;
|
||||
using UnityEngine.TestTools;
|
||||
|
||||
namespace UnityEditor.TestTools.TestRunner
|
||||
{
|
||||
internal class TestListJob
|
||||
{
|
||||
private CachingTestListProvider m_TestListProvider;
|
||||
private TestPlatform m_Platform;
|
||||
private Action<ITestAdaptor> m_Callback;
|
||||
private IEnumerator<ITestAdaptor> m_ResultEnumerator;
|
||||
public TestListJob(CachingTestListProvider testListProvider, TestPlatform platform, Action<ITestAdaptor> callback)
|
||||
{
|
||||
m_TestListProvider = testListProvider;
|
||||
m_Platform = platform;
|
||||
m_Callback = callback;
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
m_ResultEnumerator = m_TestListProvider.GetTestListAsync(m_Platform);
|
||||
EditorApplication.update += EditorUpdate;
|
||||
}
|
||||
|
||||
private void EditorUpdate()
|
||||
{
|
||||
if (!m_ResultEnumerator.MoveNext())
|
||||
{
|
||||
m_Callback(m_ResultEnumerator.Current);
|
||||
EditorApplication.update -= EditorUpdate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: dec9066d4afefe444be0dad3f137730d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework.Interfaces;
|
||||
using UnityEngine.TestTools;
|
||||
using UnityEngine.TestTools.NUnitExtensions;
|
||||
|
||||
namespace UnityEditor.TestTools.TestRunner
|
||||
{
|
||||
internal class TestListProvider : ITestListProvider
|
||||
{
|
||||
private readonly EditorLoadedTestAssemblyProvider m_AssemblyProvider;
|
||||
private readonly UnityTestAssemblyBuilder m_AssemblyBuilder;
|
||||
|
||||
public TestListProvider(EditorLoadedTestAssemblyProvider assemblyProvider, UnityTestAssemblyBuilder assemblyBuilder)
|
||||
{
|
||||
m_AssemblyProvider = assemblyProvider;
|
||||
m_AssemblyBuilder = assemblyBuilder;
|
||||
}
|
||||
|
||||
public IEnumerator<ITest> GetTestListAsync(TestPlatform platform)
|
||||
{
|
||||
var assembliesTask = m_AssemblyProvider.GetAssembliesGroupedByTypeAsync(platform);
|
||||
while (assembliesTask.MoveNext())
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
|
||||
var assemblies = assembliesTask.Current.Where(pair => platform.IsFlagIncluded(pair.Key))
|
||||
.SelectMany(pair => pair.Value.Select(assemblyInfo => Tuple.Create(assemblyInfo.Assembly, pair.Key))).ToArray();
|
||||
|
||||
var settings = UnityTestAssemblyBuilder.GetNUnitTestBuilderSettings(platform);
|
||||
var test = m_AssemblyBuilder.BuildAsync(assemblies.Select(a => a.Item1).ToArray(), assemblies.Select(a => a.Item2).ToArray(), settings);
|
||||
while (test.MoveNext())
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
|
||||
yield return test.Current;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f15cbb987069826429540d0ea0937442
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue