-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathICallbacksExample.cs
More file actions
58 lines (51 loc) · 2.05 KB
/
ICallbacksExample.cs
File metadata and controls
58 lines (51 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Copyright (c) 2021-2025 Koji Hasegawa.
// This software is released under the MIT License.
using UnityEditor;
using UnityEditor.TestTools.TestRunner.Api;
using UnityEngine;
namespace APIExamples.Editor.UnityTestFramework
{
/// <summary>
/// Test RunnerコールバックAPI使用例.
/// <see href="https://docs.unity3d.com/Packages/com.unity.test-framework@1.6/api/UnityEditor.TestTools.TestRunner.Api.IErrorCallbacks.html"/>
/// </summary>
/// <remarks>
/// `OnError()`を除いて、<see cref="UnityEditor.TestTools.TestRunner.Api.ICallbacks"/>に定義されている
/// `OnError()`は、<see cref="UnityEditor.TestTools.TestRunner.Api.IErrorCallbacks"/>にのみ定義されている
/// </remarks>
/// <seealso cref="ITestRunCallbackExample"/>
public class ICallbacksExample : IErrorCallbacks
{
[InitializeOnLoadMethod]
private static void SetupCallbacks()
{
var api = ScriptableObject.CreateInstance<TestRunnerApi>();
api.RegisterCallbacks(new ICallbacksExample());
}
/// <inheritdoc/>
public void RunStarted(ITestAdaptor testsToRun)
{
// テスト実行が開始されるときに呼ばれます
}
/// <inheritdoc/>
public void RunFinished(ITestResultAdaptor result)
{
// テスト実行が終了したときに呼ばれます
}
/// <inheritdoc/>
public void TestStarted(ITestAdaptor test)
{
// 個々の(Test Runnerウィンドウにおける)ツリーノードが開始されるときに呼ばれます
}
/// <inheritdoc/>
public void TestFinished(ITestResultAdaptor result)
{
// 個々の(Test Runnerウィンドウにおける)ツリーノードが終了したときに呼ばれます
}
/// <inheritdoc/>
public void OnError(string message)
{
// エラー発生時に呼ばれます(テストの失敗では呼ばれません)
}
}
}