Skip to content

Commit ca8e000

Browse files
committed
Add ITestRunCallbackExample
1 parent 664d91e commit ca8e000

File tree

4 files changed

+52
-6
lines changed

4 files changed

+52
-6
lines changed

Assets/APIExamples/Scripts/Editor/UnityTestFramework/CallbacksExample.cs renamed to Assets/APIExamples/Scripts/Editor/UnityTestFramework/ICallbacksExample.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2021 Koji Hasegawa.
1+
// Copyright (c) 2021-2025 Koji Hasegawa.
22
// This software is released under the MIT License.
33

44
using UnityEditor;
@@ -8,21 +8,21 @@
88
namespace APIExamples.Editor.UnityTestFramework
99
{
1010
/// <summary>
11-
/// Test RunnerコールバックAPI使用例
12-
/// <see href="https://docs.unity3d.com/Packages/com.unity.test-framework@1.1/manual/reference-ierror-callbacks.html"/>
11+
/// Test RunnerコールバックAPI使用例.
12+
/// <see href="https://docs.unity3d.com/Packages/com.unity.test-framework@1.6/api/UnityEditor.TestTools.TestRunner.Api.IErrorCallbacks.html"/>
1313
/// </summary>
1414
/// <remarks>
1515
/// `OnError()`を除いて、<see cref="UnityEditor.TestTools.TestRunner.Api.ICallbacks"/>に定義されている
1616
/// `OnError()`は、<see cref="UnityEditor.TestTools.TestRunner.Api.IErrorCallbacks"/>にのみ定義されている
1717
/// </remarks>
18-
/// <inheritdoc/>
19-
public class CallbacksExample : IErrorCallbacks
18+
/// <seealso cref="ITestRunCallbackExample"/>
19+
public class ICallbacksExample : IErrorCallbacks
2020
{
2121
[InitializeOnLoadMethod]
2222
private static void SetupCallbacks()
2323
{
2424
var api = ScriptableObject.CreateInstance<TestRunnerApi>();
25-
api.RegisterCallbacks(new CallbacksExample());
25+
api.RegisterCallbacks(new ICallbacksExample());
2626
}
2727

2828
/// <inheritdoc/>

Assets/APIExamples/Scripts/Editor/UnityTestFramework/CallbacksExample.cs.meta renamed to Assets/APIExamples/Scripts/Editor/UnityTestFramework/ICallbacksExample.cs.meta

File renamed without changes.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Copyright (c) 2021-2025 Koji Hasegawa.
2+
// This software is released under the MIT License.
3+
4+
using APIExamples.Editor.UnityTestFramework;
5+
using NUnit.Framework.Interfaces;
6+
using UnityEngine.TestRunner;
7+
8+
[assembly: TestRunCallback(typeof(ITestRunCallbackExample))]
9+
10+
namespace APIExamples.Editor.UnityTestFramework
11+
{
12+
/// <summary>
13+
/// Test RunnerコールバックAPI使用例.
14+
/// <see href="https://docs.unity3d.com/Packages/[email protected]/api/UnityEngine.TestRunner.ITestRunCallback.html"/>
15+
/// </summary>
16+
/// <seealso cref="ICallbacksExample"/>
17+
public class ITestRunCallbackExample : ITestRunCallback
18+
{
19+
/// <inheritdoc/>
20+
public void RunStarted(ITest testsToRun)
21+
{
22+
// テスト実行が開始されるときに呼ばれます
23+
}
24+
25+
/// <inheritdoc/>
26+
public void RunFinished(ITestResult testResults)
27+
{
28+
// テスト実行が終了したときに呼ばれます
29+
}
30+
31+
/// <inheritdoc/>
32+
public void TestStarted(ITest test)
33+
{
34+
// 個々の(Test Runnerウィンドウにおける)ツリーノードが開始されるときに呼ばれます
35+
}
36+
37+
/// <inheritdoc/>
38+
public void TestFinished(ITestResult result)
39+
{
40+
// 個々の(Test Runnerウィンドウにおける)ツリーノードが終了したときに呼ばれます
41+
}
42+
}
43+
}

Assets/APIExamples/Scripts/Editor/UnityTestFramework/ITestRunCallbackExample.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)