This commit is contained in:
2026-08-28 15:56:12 +01:00
commit 4d5f73e29c
7349 changed files with 664196 additions and 0 deletions
@@ -0,0 +1,25 @@
using System;
using System.Collections;
using UnityEngine;
using UnityEngine.TestTools.TestRunner;
namespace UnityEditor.TestTools.TestRunner.TestRun.Tasks.Events
{
internal class CreateEventsTask : TestTaskBase
{
public CreateEventsTask()
{
RerunAfterResume = true;
}
public override IEnumerator Execute(TestJobData testJobData)
{
testJobData.RunStartedEvent = new RunStartedEvent();
testJobData.TestStartedEvent = new TestStartedEvent();
testJobData.TestFinishedEvent = new TestFinishedEvent();
testJobData.RunFinishedEvent = new RunFinishedEvent();
yield break;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f2675f346a0926b4aa7928805fd8bc9c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,26 @@
using System;
using System.Collections;
using UnityEditor.TestTools.TestRunner.Api;
namespace UnityEditor.TestTools.TestRunner.TestRun.Tasks.Events
{
internal class RegisterCallbackDelegatorEventsTask : TestTaskBase
{
public RegisterCallbackDelegatorEventsTask()
{
RerunAfterResume = true;
}
internal ICallbacksDelegator ApiCallbacksDelegator = CallbacksDelegator.instance;
public override IEnumerator Execute(TestJobData testJobData)
{
ApiCallbacksDelegator.SetTestRunFilter(testJobData.executionSettings.BuildNUnitFilter());
testJobData.RunStartedEvent.AddListener(ApiCallbacksDelegator.RunStarted);
testJobData.TestStartedEvent.AddListener(ApiCallbacksDelegator.TestStarted);
testJobData.TestFinishedEvent.AddListener(ApiCallbacksDelegator.TestFinished);
testJobData.RunFinishedEvent.AddListener(ApiCallbacksDelegator.RunFinished);
yield break;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 311d065aced2092409deadf0c0934f61
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,26 @@
using System;
using System.Collections;
using UnityEngine;
using UnityEngine.TestRunner.Utils;
namespace UnityEditor.TestTools.TestRunner.TestRun.Tasks.Events
{
internal class RegisterTestRunCallbackEventsTask : TestTaskBase
{
public RegisterTestRunCallbackEventsTask()
{
RerunAfterResume = true;
}
internal Func<TestRunCallbackListener> GetListener = () => ScriptableObject.CreateInstance<TestRunCallbackListener>();
public override IEnumerator Execute(TestJobData testJobData)
{
var listener = GetListener();
testJobData.RunStartedEvent.AddListener(v => listener.RunStarted(v));
testJobData.TestStartedEvent.AddListener(v => listener.TestStarted(v));
testJobData.TestFinishedEvent.AddListener(v => listener.TestFinished(v));
testJobData.RunFinishedEvent.AddListener(v => listener.RunFinished(v));
yield break;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d9b3520efe42f4ee887f8b99b7e1deae
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,28 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework.Interfaces;
using NUnit.Framework.Internal;
using UnityEditor.TestTools.TestRunner.Api;
using UnityEngine.TestRunner.NUnitExtensions;
using UnityEngine.TestTools.TestRunner;
namespace UnityEditor.TestTools.TestRunner.TestRun.Tasks.Events
{
internal class RunFinishedInvocationEvent : TestTaskBase
{
public override IEnumerator Execute(TestJobData testJobData)
{
if (testJobData.TestResults == null)
{
// Temporary workaround to ensure that we do not loose the non serializable results due to a test leaking a domain reload.
testJobData.TestResults = testJobData.editModeRunner.m_Runner.Result;
}
testJobData.editModeRunner.Dispose();
testJobData.RunFinishedEvent.Invoke(testJobData.TestResults);
yield break;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a8ea9765889ae054c9b32cce583af855
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,19 @@
using System;
using System.Collections;
using UnityEngine;
namespace UnityEditor.TestTools.TestRunner.TestRun.Tasks.Events
{
internal class RunStartedInvocationEvent : TestTaskBase
{
public override IEnumerator Execute(TestJobData testJobData)
{
if (testJobData.testTree == null)
{
throw new Exception("TestTree must be set before run started event.");
}
testJobData.RunStartedEvent.Invoke(testJobData.testTree);
yield break;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 59267e29055f657429098a57e13debe1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,62 @@
using System;
using System.Collections;
using NUnit.Framework.Interfaces;
using NUnit.Framework.Internal;
namespace UnityEditor.TestTools.TestRunner.TestRun.Tasks.Events
{
internal class UpdateTestProgressTask : TestTaskBase
{
private TestProgress m_TestProgress;
public UpdateTestProgressTask()
{
RerunAfterResume = true;
}
public override IEnumerator Execute(TestJobData testJobData)
{
if (testJobData.testProgress == null)
{
throw new RequiredTestRunDataMissingException(nameof(testJobData.testProgress));
}
if (testJobData.TestStartedEvent == null)
{
throw new RequiredTestRunDataMissingException(nameof(testJobData.TestStartedEvent));
}
if (testJobData.TestFinishedEvent == null)
{
throw new RequiredTestRunDataMissingException(nameof(testJobData.TestFinishedEvent));
}
m_TestProgress = testJobData.testProgress;
testJobData.TestStartedEvent.AddListener(TestStarted);
testJobData.TestFinishedEvent.AddListener(TestFinished);
yield break;
}
private void TestStarted(ITest test)
{
if (test.IsSuite || !(test is TestMethod))
{
return;
}
m_TestProgress.CurrentTest = test.Name;
}
private void TestFinished(ITestResult testResult)
{
if (testResult.Test.IsSuite)
{
return;
}
var name = testResult.Test.FullName;
m_TestProgress.RemainingTests.Remove(name);
m_TestProgress.CompletedTests.Add(name);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c5c78f2ef0d32a948bbb93266ef69a6a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: