com.valectric.mooserunner 2.1.21 → 2.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -23
- package/CLI~/mooserunnerCli.exe +0 -0
- package/CLI~/mooserunnerCliDaemon.exe +0 -0
- package/Editor/HotReloadIntegration/MooseRunner.HotReloadIntegration.dll +0 -0
- package/Editor/HotReloadIntegration/MooseRunner.HotReloadIntegration.dll.meta +32 -32
- package/Editor/MooseRunner.Editor.asmdef +15 -15
- package/Editor/MooseRunner.Editor.asmdef.meta +6 -6
- package/Editor/MooseRunner.Internal.Editor.dll +0 -0
- package/Editor/MooseRunner.Internal.Editor.dll.meta +32 -32
- package/Editor/MooseRunner.Worker.dll +0 -0
- package/Editor/MooseRunner.Worker.dll.meta +32 -32
- package/Editor/SessionRecorder/MooseRunner.SessionRecorder.dll +0 -0
- package/Editor/SessionRecorder/MooseRunner.SessionRecorder.dll.meta +32 -32
- package/Editor/_WrapperStub.cs.meta +10 -10
- package/LICENSE.md +28 -28
- package/Runtime/MooseRunner.Helpers.Runtime.dll +0 -0
- package/Runtime/MooseRunner.Helpers.Runtime.dll.meta +26 -26
- package/Runtime/MooseRunner.Internal.dll +0 -0
- package/Runtime/MooseRunner.Internal.dll.meta +26 -26
- package/Runtime/MooseRunner.Multiplaytest.Types.dll +0 -0
- package/Runtime/MooseRunner.Multiplaytest.Types.dll.meta +26 -26
- package/Runtime/MooseRunner.Runtime.asmdef +15 -15
- package/Runtime/MooseRunner.Runtime.asmdef.meta +6 -6
- package/Runtime/MooseRunner.SessionRecorder.Public.dll +0 -0
- package/Runtime/MooseRunner.SessionRecorder.Public.dll.meta +26 -26
- package/Runtime/MooseRunner.SessionRecorder.Runtime.dll +0 -0
- package/Runtime/MooseRunner.SessionRecorder.Runtime.dll.meta +26 -26
- package/Runtime/MooseRunner.dll +0 -0
- package/Runtime/MooseRunner.dll.meta +26 -26
- package/Runtime/_WrapperStub.cs.meta +10 -10
- package/Samples~/Demos/MooseRunner.Demo.CancellationTokens.Tests/BatchCancellationTests.cs +37 -37
- package/Samples~/Demos/MooseRunner.Demo.CancellationTokens.Tests/CancellationTokenTests.cs +186 -186
- package/Samples~/Demos/MooseRunner.Demo.CancellationTokens.Tests/SetupTeardownCancellationTests.cs +85 -85
- package/Samples~/Demos/MooseRunner.Demo.Flow.TestSupport/LogEntry.cs +51 -51
- package/Samples~/Demos/MooseRunner.Demo.Flow.TestSupport/LogFileParser.cs +69 -69
- package/Samples~/Demos/MooseRunner.Demo.OrderAttribute/MethodOrderAttributeTests.cs +62 -62
- package/Samples~/Demos/MooseRunner.Demo.RealUseCase/Enemy.cs +100 -100
- package/Samples~/Demos/MooseRunner.Demo.RealUseCase/FireComponent.cs +18 -18
- package/Samples~/Demos/MooseRunner.Demo.Support/MessageDisplayManager.cs +291 -291
- package/Samples~/Demos/MooseRunner.Demo.Support/MooseRunnerSampleVersionCheck.cs +57 -57
- package/Samples~/Demos/MooseRunner.Demo.Support/MooseRunnerSampleVersionCheck.cs.meta +1 -1
- package/Samples~/Demos/MooseRunner.Demo.Tests/ExplicitAttributeTests.cs +36 -36
- package/Samples~/Demos/MooseRunner.Demo.Tests/InstanceHandlingVerificationTest.cs +99 -99
- package/Third Party Notices.md +37 -37
- package/package.json +1 -1
package/Samples~/Demos/MooseRunner.Demo.CancellationTokens.Tests/SetupTeardownCancellationTests.cs
CHANGED
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
using System.Threading;
|
|
2
|
-
using System.Threading.Tasks;
|
|
3
|
-
using NUnit.Framework;
|
|
4
|
-
using UnityEngine;
|
|
5
|
-
using UnityEngine.TestTools;
|
|
6
|
-
|
|
7
|
-
namespace MooseRunner.Internal.Tests
|
|
8
|
-
{
|
|
9
|
-
/// <summary>
|
|
10
|
-
/// Edge case tests for SetUp/TearDown/OneTimeSetUp/OneTimeTearDown cancellation behavior.
|
|
11
|
-
/// Tests the complete lifecycle with cancellation support at each phase.
|
|
12
|
-
/// </summary>
|
|
13
|
-
public class SetupTeardownCancellationTests
|
|
14
|
-
{
|
|
15
|
-
/// <summary>
|
|
16
|
-
/// OneTimeSetUp runs once before all tests in this class.
|
|
17
|
-
/// Expected: Can be cancelled during execution, which triggers OneTimeTearDown immediately,
|
|
18
|
-
/// then skips Setup, Test, and TearDown entirely (Setup never ran, nothing to tear down).
|
|
19
|
-
/// If re-run later, OneTimeSetUp will run again because state is reset.
|
|
20
|
-
/// </summary>
|
|
21
|
-
[OneTimeSetUp]
|
|
22
|
-
public async Task OneTimeSetupMethod(CancellationToken ct)
|
|
23
|
-
{
|
|
24
|
-
MooseRunnerSampleVersionCheck.EnsureSingleVersion();
|
|
25
|
-
Debug.Log("[OneTimeSetUp] OneTimeSetUp started - 5 second delay");
|
|
26
|
-
Debug.Log("[OneTimeSetUp] Click STOP during OneTimeSetUp to test cancellation");
|
|
27
|
-
await Task.Delay(5000, ct);
|
|
28
|
-
Debug.Log("[OneTimeSetUp] OneTimeSetUp completed");
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/// <summary>
|
|
32
|
-
/// SetUp runs before each test method.
|
|
33
|
-
/// Expected: Can be cancelled during execution, which skips the Test but still runs TearDown for cleanup.
|
|
34
|
-
/// If OneTimeSetUp failed, Setup will be skipped entirely.
|
|
35
|
-
/// </summary>
|
|
36
|
-
[SetUp]
|
|
37
|
-
public async Task Setup(CancellationToken ct)
|
|
38
|
-
{
|
|
39
|
-
Debug.Log("[Setup] Setup started - 5 second delay");
|
|
40
|
-
Debug.Log("[Setup] Click STOP during setup to test setup cancellation");
|
|
41
|
-
await Task.Delay(5000, ct);
|
|
42
|
-
Debug.Log("[Setup] Setup completed");
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/// <summary>
|
|
46
|
-
/// The actual test method.
|
|
47
|
-
/// Expected: Runs normally if Setup succeeds, or is skipped if Setup or OneTimeSetUp fails.
|
|
48
|
-
/// Can be cancelled during execution.
|
|
49
|
-
/// </summary>
|
|
50
|
-
[UnityTest]
|
|
51
|
-
public async Task TestMethod()
|
|
52
|
-
{
|
|
53
|
-
Debug.Log("[TestMethod] Test is running");
|
|
54
|
-
await Task.Delay(10000);
|
|
55
|
-
Debug.Log("[TestMethod] Test completed");
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/// <summary>
|
|
59
|
-
/// TearDown runs after each test method for cleanup.
|
|
60
|
-
/// Expected: Can be cancelled during execution. Runs even if Test fails.
|
|
61
|
-
/// Skipped if OneTimeSetUp fails (because Setup never ran, nothing to tear down).
|
|
62
|
-
/// </summary>
|
|
63
|
-
[TearDown]
|
|
64
|
-
public async Task Teardown(CancellationToken ct)
|
|
65
|
-
{
|
|
66
|
-
Debug.Log("[Teardown] Teardown started - 5 second delay");
|
|
67
|
-
await Task.Delay(5000, ct);
|
|
68
|
-
Debug.Log("[Teardown] Teardown completed");
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/// <summary>
|
|
72
|
-
/// OneTimeTearDown runs once after all tests in this class complete, or immediately if OneTimeSetUp fails.
|
|
73
|
-
/// Expected: Runs regardless of OneTimeSetUp/Setup/Test failures for cleanup.
|
|
74
|
-
/// This ensures resources allocated in OneTimeSetUp are properly cleaned up even if it was cancelled.
|
|
75
|
-
/// </summary>
|
|
76
|
-
[OneTimeTearDown]
|
|
77
|
-
public async Task OneTimeTeardownMethod(CancellationToken ct)
|
|
78
|
-
{
|
|
79
|
-
Debug.Log("[OneTimeTearDown] OneTimeTearDown started - 5 second delay");
|
|
80
|
-
Debug.Log("[OneTimeTearDown] This should run regardless of test failures");
|
|
81
|
-
await Task.Delay(5000, ct);
|
|
82
|
-
Debug.Log("[OneTimeTearDown] OneTimeTearDown completed");
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
1
|
+
using System.Threading;
|
|
2
|
+
using System.Threading.Tasks;
|
|
3
|
+
using NUnit.Framework;
|
|
4
|
+
using UnityEngine;
|
|
5
|
+
using UnityEngine.TestTools;
|
|
6
|
+
|
|
7
|
+
namespace MooseRunner.Internal.Tests
|
|
8
|
+
{
|
|
9
|
+
/// <summary>
|
|
10
|
+
/// Edge case tests for SetUp/TearDown/OneTimeSetUp/OneTimeTearDown cancellation behavior.
|
|
11
|
+
/// Tests the complete lifecycle with cancellation support at each phase.
|
|
12
|
+
/// </summary>
|
|
13
|
+
public class SetupTeardownCancellationTests
|
|
14
|
+
{
|
|
15
|
+
/// <summary>
|
|
16
|
+
/// OneTimeSetUp runs once before all tests in this class.
|
|
17
|
+
/// Expected: Can be cancelled during execution, which triggers OneTimeTearDown immediately,
|
|
18
|
+
/// then skips Setup, Test, and TearDown entirely (Setup never ran, nothing to tear down).
|
|
19
|
+
/// If re-run later, OneTimeSetUp will run again because state is reset.
|
|
20
|
+
/// </summary>
|
|
21
|
+
[OneTimeSetUp]
|
|
22
|
+
public async Task OneTimeSetupMethod(CancellationToken ct)
|
|
23
|
+
{
|
|
24
|
+
MooseRunnerSampleVersionCheck.EnsureSingleVersion();
|
|
25
|
+
Debug.Log("[OneTimeSetUp] OneTimeSetUp started - 5 second delay");
|
|
26
|
+
Debug.Log("[OneTimeSetUp] Click STOP during OneTimeSetUp to test cancellation");
|
|
27
|
+
await Task.Delay(5000, ct);
|
|
28
|
+
Debug.Log("[OneTimeSetUp] OneTimeSetUp completed");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/// <summary>
|
|
32
|
+
/// SetUp runs before each test method.
|
|
33
|
+
/// Expected: Can be cancelled during execution, which skips the Test but still runs TearDown for cleanup.
|
|
34
|
+
/// If OneTimeSetUp failed, Setup will be skipped entirely.
|
|
35
|
+
/// </summary>
|
|
36
|
+
[SetUp]
|
|
37
|
+
public async Task Setup(CancellationToken ct)
|
|
38
|
+
{
|
|
39
|
+
Debug.Log("[Setup] Setup started - 5 second delay");
|
|
40
|
+
Debug.Log("[Setup] Click STOP during setup to test setup cancellation");
|
|
41
|
+
await Task.Delay(5000, ct);
|
|
42
|
+
Debug.Log("[Setup] Setup completed");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/// <summary>
|
|
46
|
+
/// The actual test method.
|
|
47
|
+
/// Expected: Runs normally if Setup succeeds, or is skipped if Setup or OneTimeSetUp fails.
|
|
48
|
+
/// Can be cancelled during execution.
|
|
49
|
+
/// </summary>
|
|
50
|
+
[UnityTest]
|
|
51
|
+
public async Task TestMethod()
|
|
52
|
+
{
|
|
53
|
+
Debug.Log("[TestMethod] Test is running");
|
|
54
|
+
await Task.Delay(10000);
|
|
55
|
+
Debug.Log("[TestMethod] Test completed");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/// <summary>
|
|
59
|
+
/// TearDown runs after each test method for cleanup.
|
|
60
|
+
/// Expected: Can be cancelled during execution. Runs even if Test fails.
|
|
61
|
+
/// Skipped if OneTimeSetUp fails (because Setup never ran, nothing to tear down).
|
|
62
|
+
/// </summary>
|
|
63
|
+
[TearDown]
|
|
64
|
+
public async Task Teardown(CancellationToken ct)
|
|
65
|
+
{
|
|
66
|
+
Debug.Log("[Teardown] Teardown started - 5 second delay");
|
|
67
|
+
await Task.Delay(5000, ct);
|
|
68
|
+
Debug.Log("[Teardown] Teardown completed");
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/// <summary>
|
|
72
|
+
/// OneTimeTearDown runs once after all tests in this class complete, or immediately if OneTimeSetUp fails.
|
|
73
|
+
/// Expected: Runs regardless of OneTimeSetUp/Setup/Test failures for cleanup.
|
|
74
|
+
/// This ensures resources allocated in OneTimeSetUp are properly cleaned up even if it was cancelled.
|
|
75
|
+
/// </summary>
|
|
76
|
+
[OneTimeTearDown]
|
|
77
|
+
public async Task OneTimeTeardownMethod(CancellationToken ct)
|
|
78
|
+
{
|
|
79
|
+
Debug.Log("[OneTimeTearDown] OneTimeTearDown started - 5 second delay");
|
|
80
|
+
Debug.Log("[OneTimeTearDown] This should run regardless of test failures");
|
|
81
|
+
await Task.Delay(5000, ct);
|
|
82
|
+
Debug.Log("[OneTimeTearDown] OneTimeTearDown completed");
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
using System;
|
|
2
|
-
|
|
3
|
-
namespace MooseRunner.Internal.Tests {
|
|
4
|
-
/// <summary>
|
|
5
|
-
/// Represents a single log entry in MooseRunner, capturing essential information
|
|
6
|
-
/// about test execution such as timestamps, categories, and optional details
|
|
7
|
-
/// (e.g., assembly, class, or method).
|
|
8
|
-
/// </summary>
|
|
9
|
-
[Serializable]
|
|
10
|
-
public class LogEntry {
|
|
11
|
-
/// <summary>
|
|
12
|
-
/// The timestamp of this log entry in ISO 8601 format.
|
|
13
|
-
/// Example: "2025-01-04T12:34:56.789Z".
|
|
14
|
-
/// </summary>
|
|
15
|
-
public string timestamp;
|
|
16
|
-
|
|
17
|
-
/// <summary>
|
|
18
|
-
/// The category of this log entry (e.g., "TEST_EXECUTION", "ASSEMBLY_START", "CLASS_START", "METHOD_START", "ERROR", etc.).
|
|
19
|
-
/// </summary>
|
|
20
|
-
public string category;
|
|
21
|
-
|
|
22
|
-
/// <summary>
|
|
23
|
-
/// Indicates whether this entry describes a root-level test execution.
|
|
24
|
-
/// Typically set when <see cref="category"/> is "TEST_EXECUTION".
|
|
25
|
-
/// </summary>
|
|
26
|
-
public bool root;
|
|
27
|
-
|
|
28
|
-
/// <summary>
|
|
29
|
-
/// The name of the assembly associated with this log entry (if applicable).
|
|
30
|
-
/// For example, "MyGameAssembly".
|
|
31
|
-
/// </summary>
|
|
32
|
-
public string assembly;
|
|
33
|
-
|
|
34
|
-
/// <summary>
|
|
35
|
-
/// The name of the class associated with this log entry (if applicable).
|
|
36
|
-
/// We use <c>@class</c> to avoid conflicts with the C# <c>class</c> keyword.
|
|
37
|
-
/// </summary>
|
|
38
|
-
public string @class;
|
|
39
|
-
|
|
40
|
-
/// <summary>
|
|
41
|
-
/// The name of the method associated with this log entry (if applicable).
|
|
42
|
-
/// </summary>
|
|
43
|
-
public string method;
|
|
44
|
-
|
|
45
|
-
/// <summary>
|
|
46
|
-
/// An optional message providing additional context for this log entry.
|
|
47
|
-
/// </summary>
|
|
48
|
-
public string message;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
1
|
+
using System;
|
|
2
|
+
|
|
3
|
+
namespace MooseRunner.Internal.Tests {
|
|
4
|
+
/// <summary>
|
|
5
|
+
/// Represents a single log entry in MooseRunner, capturing essential information
|
|
6
|
+
/// about test execution such as timestamps, categories, and optional details
|
|
7
|
+
/// (e.g., assembly, class, or method).
|
|
8
|
+
/// </summary>
|
|
9
|
+
[Serializable]
|
|
10
|
+
public class LogEntry {
|
|
11
|
+
/// <summary>
|
|
12
|
+
/// The timestamp of this log entry in ISO 8601 format.
|
|
13
|
+
/// Example: "2025-01-04T12:34:56.789Z".
|
|
14
|
+
/// </summary>
|
|
15
|
+
public string timestamp;
|
|
16
|
+
|
|
17
|
+
/// <summary>
|
|
18
|
+
/// The category of this log entry (e.g., "TEST_EXECUTION", "ASSEMBLY_START", "CLASS_START", "METHOD_START", "ERROR", etc.).
|
|
19
|
+
/// </summary>
|
|
20
|
+
public string category;
|
|
21
|
+
|
|
22
|
+
/// <summary>
|
|
23
|
+
/// Indicates whether this entry describes a root-level test execution.
|
|
24
|
+
/// Typically set when <see cref="category"/> is "TEST_EXECUTION".
|
|
25
|
+
/// </summary>
|
|
26
|
+
public bool root;
|
|
27
|
+
|
|
28
|
+
/// <summary>
|
|
29
|
+
/// The name of the assembly associated with this log entry (if applicable).
|
|
30
|
+
/// For example, "MyGameAssembly".
|
|
31
|
+
/// </summary>
|
|
32
|
+
public string assembly;
|
|
33
|
+
|
|
34
|
+
/// <summary>
|
|
35
|
+
/// The name of the class associated with this log entry (if applicable).
|
|
36
|
+
/// We use <c>@class</c> to avoid conflicts with the C# <c>class</c> keyword.
|
|
37
|
+
/// </summary>
|
|
38
|
+
public string @class;
|
|
39
|
+
|
|
40
|
+
/// <summary>
|
|
41
|
+
/// The name of the method associated with this log entry (if applicable).
|
|
42
|
+
/// </summary>
|
|
43
|
+
public string method;
|
|
44
|
+
|
|
45
|
+
/// <summary>
|
|
46
|
+
/// An optional message providing additional context for this log entry.
|
|
47
|
+
/// </summary>
|
|
48
|
+
public string message;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
using MooseRunner.Internal.Tests;
|
|
2
|
-
using System;
|
|
3
|
-
using System.Collections.Generic;
|
|
4
|
-
using System.IO;
|
|
5
|
-
using UnityEngine;
|
|
6
|
-
|
|
7
|
-
namespace MooseRunner.Internal.Tests
|
|
8
|
-
{
|
|
9
|
-
public class LogFileParser
|
|
10
|
-
{
|
|
11
|
-
/// <summary>
|
|
12
|
-
/// Parses the log file and returns a list of LogEntry objects.
|
|
13
|
-
/// </summary>
|
|
14
|
-
/// <param name="filePath">Path to the log file.</param>
|
|
15
|
-
/// <returns>List of parsed LogEntry objects.</returns>
|
|
16
|
-
public List<LogEntry> ParseLogFile(string filePath)
|
|
17
|
-
{
|
|
18
|
-
var logEntries = new List<LogEntry>();
|
|
19
|
-
|
|
20
|
-
if (!File.Exists(filePath))
|
|
21
|
-
{
|
|
22
|
-
Debug.LogError($"Log file not found at path: {filePath}");
|
|
23
|
-
return logEntries;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
try
|
|
27
|
-
{
|
|
28
|
-
using (var reader = new StreamReader(filePath))
|
|
29
|
-
{
|
|
30
|
-
string line;
|
|
31
|
-
int lineNumber = 0;
|
|
32
|
-
|
|
33
|
-
while ((line = reader.ReadLine()) != null)
|
|
34
|
-
{
|
|
35
|
-
lineNumber++;
|
|
36
|
-
|
|
37
|
-
if (string.IsNullOrWhiteSpace(line))
|
|
38
|
-
{
|
|
39
|
-
// Skip empty lines
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
try
|
|
44
|
-
{
|
|
45
|
-
// Parse the JSON line into a LogEntry object
|
|
46
|
-
LogEntry logEntry = JsonUtility.FromJson<LogEntry>(line);
|
|
47
|
-
|
|
48
|
-
// Handle the 'root' field which might not be present in all log entries
|
|
49
|
-
// JsonUtility sets default values for missing fields, so 'root' defaults to false
|
|
50
|
-
// If 'root' is not present, it remains false
|
|
51
|
-
logEntries.Add(logEntry);
|
|
52
|
-
}
|
|
53
|
-
catch (Exception ex)
|
|
54
|
-
{
|
|
55
|
-
Debug.LogWarning($"Failed to parse JSON on line {lineNumber}: {ex.Message}");
|
|
56
|
-
Debug.LogWarning($"Line Content: {line}");
|
|
57
|
-
// Continue parsing the next lines
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
catch (Exception ex)
|
|
63
|
-
{
|
|
64
|
-
Debug.LogError($"Error reading the log file: {ex.Message}");
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return logEntries;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
1
|
+
using MooseRunner.Internal.Tests;
|
|
2
|
+
using System;
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using System.IO;
|
|
5
|
+
using UnityEngine;
|
|
6
|
+
|
|
7
|
+
namespace MooseRunner.Internal.Tests
|
|
8
|
+
{
|
|
9
|
+
public class LogFileParser
|
|
10
|
+
{
|
|
11
|
+
/// <summary>
|
|
12
|
+
/// Parses the log file and returns a list of LogEntry objects.
|
|
13
|
+
/// </summary>
|
|
14
|
+
/// <param name="filePath">Path to the log file.</param>
|
|
15
|
+
/// <returns>List of parsed LogEntry objects.</returns>
|
|
16
|
+
public List<LogEntry> ParseLogFile(string filePath)
|
|
17
|
+
{
|
|
18
|
+
var logEntries = new List<LogEntry>();
|
|
19
|
+
|
|
20
|
+
if (!File.Exists(filePath))
|
|
21
|
+
{
|
|
22
|
+
Debug.LogError($"Log file not found at path: {filePath}");
|
|
23
|
+
return logEntries;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
try
|
|
27
|
+
{
|
|
28
|
+
using (var reader = new StreamReader(filePath))
|
|
29
|
+
{
|
|
30
|
+
string line;
|
|
31
|
+
int lineNumber = 0;
|
|
32
|
+
|
|
33
|
+
while ((line = reader.ReadLine()) != null)
|
|
34
|
+
{
|
|
35
|
+
lineNumber++;
|
|
36
|
+
|
|
37
|
+
if (string.IsNullOrWhiteSpace(line))
|
|
38
|
+
{
|
|
39
|
+
// Skip empty lines
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
try
|
|
44
|
+
{
|
|
45
|
+
// Parse the JSON line into a LogEntry object
|
|
46
|
+
LogEntry logEntry = JsonUtility.FromJson<LogEntry>(line);
|
|
47
|
+
|
|
48
|
+
// Handle the 'root' field which might not be present in all log entries
|
|
49
|
+
// JsonUtility sets default values for missing fields, so 'root' defaults to false
|
|
50
|
+
// If 'root' is not present, it remains false
|
|
51
|
+
logEntries.Add(logEntry);
|
|
52
|
+
}
|
|
53
|
+
catch (Exception ex)
|
|
54
|
+
{
|
|
55
|
+
Debug.LogWarning($"Failed to parse JSON on line {lineNumber}: {ex.Message}");
|
|
56
|
+
Debug.LogWarning($"Line Content: {line}");
|
|
57
|
+
// Continue parsing the next lines
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
catch (Exception ex)
|
|
63
|
+
{
|
|
64
|
+
Debug.LogError($"Error reading the log file: {ex.Message}");
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return logEntries;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
70
|
}
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
using System.Collections.Generic;
|
|
2
|
-
using NUnit.Framework;
|
|
3
|
-
using UnityEngine;
|
|
4
|
-
|
|
5
|
-
namespace MooseRunner.Internal.Tests.OrderAttributeDemo
|
|
6
|
-
{
|
|
7
|
-
/// <summary>
|
|
8
|
-
/// Demonstrates NUnit [Order] attribute support for method-level ordering in MooseRunner.
|
|
9
|
-
/// Tests verify that methods within a single fixture execute in the order specified by [Order(n)] attribute.
|
|
10
|
-
/// </summary>
|
|
11
|
-
[TestFixture]
|
|
12
|
-
public class MethodOrderAttributeTests
|
|
13
|
-
{
|
|
14
|
-
private static List<string> _executionOrder = new List<string>();
|
|
15
|
-
|
|
16
|
-
[Test, Order(1)]
|
|
17
|
-
public void Order1_ShouldRunFirst()
|
|
18
|
-
{
|
|
19
|
-
// First test clears any previous state
|
|
20
|
-
_executionOrder.Clear();
|
|
21
|
-
_executionOrder.Add("Order1");
|
|
22
|
-
Debug.Log("[MethodOrderAttributeTests] Order1_ShouldRunFirst executed (cleared list, added Order1)");
|
|
23
|
-
Assert.Pass("Order(1) test executed");
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
[Test, Order(2)]
|
|
27
|
-
public void Order2_ShouldRunSecond()
|
|
28
|
-
{
|
|
29
|
-
_executionOrder.Add("Order2");
|
|
30
|
-
Debug.Log($"[MethodOrderAttributeTests] Order2_ShouldRunSecond executed. List: [{string.Join(", ", _executionOrder)}]");
|
|
31
|
-
Assert.Pass("Order(2) test executed");
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
[Test, Order(3)]
|
|
35
|
-
public void Order3_ShouldRunThird()
|
|
36
|
-
{
|
|
37
|
-
_executionOrder.Add("Order3");
|
|
38
|
-
Debug.Log($"[MethodOrderAttributeTests] Order3_ShouldRunThird executed. List: [{string.Join(", ", _executionOrder)}]");
|
|
39
|
-
Assert.Pass("Order(3) test executed");
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
[Test, Order(100)]
|
|
43
|
-
public void Order100_VerifyMethodExecutionOrder()
|
|
44
|
-
{
|
|
45
|
-
Debug.Log($"[MethodOrderAttributeTests] Verifying execution order: [{string.Join(", ", _executionOrder)}]");
|
|
46
|
-
|
|
47
|
-
Assert.AreEqual(3, _executionOrder.Count,
|
|
48
|
-
$"Expected 3 tests to have executed before this verification test. Actual: {_executionOrder.Count}. List: [{string.Join(", ", _executionOrder)}]");
|
|
49
|
-
|
|
50
|
-
Assert.AreEqual("Order1", _executionOrder[0],
|
|
51
|
-
$"First executed test should be Order1, but was {_executionOrder[0]}");
|
|
52
|
-
|
|
53
|
-
Assert.AreEqual("Order2", _executionOrder[1],
|
|
54
|
-
$"Second executed test should be Order2, but was {_executionOrder[1]}");
|
|
55
|
-
|
|
56
|
-
Assert.AreEqual("Order3", _executionOrder[2],
|
|
57
|
-
$"Third executed test should be Order3, but was {_executionOrder[2]}");
|
|
58
|
-
|
|
59
|
-
Debug.Log("[MethodOrderAttributeTests] Method order verification PASSED - tests executed in correct order: Order1 -> Order2 -> Order3");
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
1
|
+
using System.Collections.Generic;
|
|
2
|
+
using NUnit.Framework;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
|
|
5
|
+
namespace MooseRunner.Internal.Tests.OrderAttributeDemo
|
|
6
|
+
{
|
|
7
|
+
/// <summary>
|
|
8
|
+
/// Demonstrates NUnit [Order] attribute support for method-level ordering in MooseRunner.
|
|
9
|
+
/// Tests verify that methods within a single fixture execute in the order specified by [Order(n)] attribute.
|
|
10
|
+
/// </summary>
|
|
11
|
+
[TestFixture]
|
|
12
|
+
public class MethodOrderAttributeTests
|
|
13
|
+
{
|
|
14
|
+
private static List<string> _executionOrder = new List<string>();
|
|
15
|
+
|
|
16
|
+
[Test, Order(1)]
|
|
17
|
+
public void Order1_ShouldRunFirst()
|
|
18
|
+
{
|
|
19
|
+
// First test clears any previous state
|
|
20
|
+
_executionOrder.Clear();
|
|
21
|
+
_executionOrder.Add("Order1");
|
|
22
|
+
Debug.Log("[MethodOrderAttributeTests] Order1_ShouldRunFirst executed (cleared list, added Order1)");
|
|
23
|
+
Assert.Pass("Order(1) test executed");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
[Test, Order(2)]
|
|
27
|
+
public void Order2_ShouldRunSecond()
|
|
28
|
+
{
|
|
29
|
+
_executionOrder.Add("Order2");
|
|
30
|
+
Debug.Log($"[MethodOrderAttributeTests] Order2_ShouldRunSecond executed. List: [{string.Join(", ", _executionOrder)}]");
|
|
31
|
+
Assert.Pass("Order(2) test executed");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
[Test, Order(3)]
|
|
35
|
+
public void Order3_ShouldRunThird()
|
|
36
|
+
{
|
|
37
|
+
_executionOrder.Add("Order3");
|
|
38
|
+
Debug.Log($"[MethodOrderAttributeTests] Order3_ShouldRunThird executed. List: [{string.Join(", ", _executionOrder)}]");
|
|
39
|
+
Assert.Pass("Order(3) test executed");
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
[Test, Order(100)]
|
|
43
|
+
public void Order100_VerifyMethodExecutionOrder()
|
|
44
|
+
{
|
|
45
|
+
Debug.Log($"[MethodOrderAttributeTests] Verifying execution order: [{string.Join(", ", _executionOrder)}]");
|
|
46
|
+
|
|
47
|
+
Assert.AreEqual(3, _executionOrder.Count,
|
|
48
|
+
$"Expected 3 tests to have executed before this verification test. Actual: {_executionOrder.Count}. List: [{string.Join(", ", _executionOrder)}]");
|
|
49
|
+
|
|
50
|
+
Assert.AreEqual("Order1", _executionOrder[0],
|
|
51
|
+
$"First executed test should be Order1, but was {_executionOrder[0]}");
|
|
52
|
+
|
|
53
|
+
Assert.AreEqual("Order2", _executionOrder[1],
|
|
54
|
+
$"Second executed test should be Order2, but was {_executionOrder[1]}");
|
|
55
|
+
|
|
56
|
+
Assert.AreEqual("Order3", _executionOrder[2],
|
|
57
|
+
$"Third executed test should be Order3, but was {_executionOrder[2]}");
|
|
58
|
+
|
|
59
|
+
Debug.Log("[MethodOrderAttributeTests] Method order verification PASSED - tests executed in correct order: Order1 -> Order2 -> Order3");
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|