feat: integrate performance upgrade and agent inspection tooling
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEditor.TestTools.TestRunner.Api;
|
||||
using UnityEngine;
|
||||
[InitializeOnLoad]
|
||||
public static class PlayerAcceptance
|
||||
{
|
||||
private static readonly TestRunnerApi Api;
|
||||
static PlayerAcceptance() { Api = ScriptableObject.CreateInstance<TestRunnerApi>(); Api.RegisterCallbacks(new Results()); }
|
||||
public static string Run()
|
||||
{
|
||||
SessionState.SetBool("Shrink.PlayerAcceptance.Active", true);
|
||||
return Api.Execute(new ExecutionSettings(new Filter { testMode = TestMode.PlayMode, assemblyNames = new[] { "ShrinkSDK.AgentSupport.PlayerTests" }, targetPlatform = BuildTarget.StandaloneWindows64 }));
|
||||
}
|
||||
private sealed class Results : ICallbacks
|
||||
{
|
||||
public void RunStarted(ITestAdaptor tests) { }
|
||||
public void TestStarted(ITestAdaptor test) { }
|
||||
public void TestFinished(ITestResultAdaptor result) { }
|
||||
public void RunFinished(ITestResultAdaptor result)
|
||||
{
|
||||
if (!SessionState.GetBool("Shrink.PlayerAcceptance.Active", false)) return;
|
||||
SessionState.SetBool("Shrink.PlayerAcceptance.Active", false);
|
||||
Directory.CreateDirectory("Artifacts/AgentSupport");
|
||||
File.WriteAllText("Artifacts/AgentSupport/unity-player-results.xml", result.ToXml().OuterXml);
|
||||
Debug.Log("Shrink Player acceptance: " + result.PassCount + " passed, " + result.FailCount + " failed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user