A game about forced loneliness, made by TACStudios
1using System;
2using System.IO;
3using UnityEditor.TestTools.TestRunner.Api;
4using UnityEditor.Utils;
5using UnityEngine;
6
7namespace UnityEditor.TestTools.TestRunner.CommandLineTest
8{
9 [Serializable]
10 internal class ResultsSavingCallbacks : ScriptableObject, ICallbacks
11 {
12 [SerializeField]
13 public string m_ResultFilePath;
14
15 public ResultsSavingCallbacks()
16 {
17 m_ResultFilePath = GetDefaultResultFilePath();
18 }
19
20 public void RunStarted(ITestAdaptor testsToRun)
21 {
22 }
23
24 public virtual void RunFinished(ITestResultAdaptor testResults)
25 {
26 if (string.IsNullOrEmpty(m_ResultFilePath))
27 {
28 m_ResultFilePath = GetDefaultResultFilePath();
29 }
30
31 TestRunnerApi.SaveResultToFile(testResults, m_ResultFilePath);
32 }
33
34 public void TestStarted(ITestAdaptor test)
35 {
36 }
37
38 public void TestFinished(ITestResultAdaptor result)
39 {
40 }
41
42 private static string GetDefaultResultFilePath()
43 {
44 var fileName = "TestResults-" + DateTime.Now.Ticks + ".xml";
45 var projectPath = Directory.GetCurrentDirectory();
46 return Paths.Combine(projectPath, fileName);
47 }
48 }
49}